mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 15:54:03 +03:00
FILE / ScuroNeko/mtg
mtglib/internal/faketls/init.go
Исходный файл и его история в репозитории.
42 lines
869 B
Go
42 lines
869 B
Go
package faketls
|
|
|
|
import (
|
|
"bytes"
|
|
"errors"
|
|
)
|
|
|
|
const (
|
|
RandomLen = 32
|
|
|
|
ClientHelloRandomOffset = 6
|
|
ClientHelloSessionIDOffset = ClientHelloRandomOffset + RandomLen
|
|
ClientHelloMinLen = 4
|
|
|
|
WelcomePacketRandomOffset = 11
|
|
|
|
HandshakeTypeClient = 0x01
|
|
HandshakeTypeServer = 0x02
|
|
|
|
ChangeCipherValue = 0x01
|
|
|
|
ExtensionSNI = 0x00
|
|
)
|
|
|
|
var (
|
|
ErrBadDigest = errors.New("bad digest")
|
|
ErrAntiReplayAttack = errors.New("antireplay attack was detected")
|
|
|
|
serverHelloSuffix = []byte{
|
|
0x00, // no compression
|
|
0x00, 0x2e, // 46 bytes of data
|
|
0x00, 0x2b, // Extension - Supported Versions
|
|
0x00, 0x02, // 2 bytes are following
|
|
0x03, 0x04, // TLS 1.3
|
|
0x00, 0x33, // Extension - Key Share
|
|
0x00, 0x24, // 36 bytes
|
|
0x00, 0x1d, // x25519 curve
|
|
0x00, 0x20, // 32 bytes of key
|
|
}
|
|
clientHelloEmptyRandom = bytes.Repeat([]byte{0}, RandomLen)
|
|
)
|