Documentation ¶
Overview ¶
Generate init packet
Index ¶
Constants ¶
View Source
const ( FlagNotEncrypted uint32 = 0x02 FlagHasAdTag uint32 = 0x8 FlagMagic uint32 = 0x1000 FlagExtNode2 uint32 = 0x20000 FlagPad uint32 = 0x8000000 FlagIntermediate uint32 = 0x20000000 FlagAbbridged uint32 = 0x40000000 FlagQuickAck uint32 = 0x80000000 )
View Source
const ( Abridged = 0xef Intermediate = 0xee //0xeeeeeeee Padded = 0xdd //0xdddddddd Full = 0 )
View Source
const AddTagLength = 16
View Source
const FakeTlsHandshakeLen = 1 + 2 + 2 + 512 // handshake version payload_length payload
View Source
const MaxPayloadSize = 1024 * 1024 // 131200 // supposed to be 1<<17-1 but i've 131176 in abridged and more in padded
View Source
const NonceSize = 64
View Source
const RpcNonceLen = 16
Variables ¶
View Source
var ( RpcNonceTag = [4]byte{0xaa, 0x87, 0xcb, 0x7a} RpcCryptoAesTag = [4]byte{0x01, 0, 0, 0} RpcHandShakeTag = [4]byte{0xf5, 0xee, 0x82, 0x76} RpcProxyAnsTag = [4]byte{0x0d, 0xda, 0x03, 0x44} RpcCloseExtTag = [4]byte{0xa2, 0x34, 0xb6, 0x5e} RpcSimpleAckTag = [4]byte{0x9b, 0x40, 0xac, 0x3b} RpcUnknown = [4]byte{0xdf, 0xa2, 0x30, 0x57} RpcProxyReqTag = [4]byte{0xee, 0xf1, 0xce, 0x36} ProxyTag = [4]byte{0xae, 0x26, 0x1e, 0xdb} ExtraSize = [4]byte{0x18, 0x00, 0x00, 0x00} PaddingFiller = [4]byte{0x4, 0, 0, 0} )
View Source
var FakeTlsHeader = [...]byte{
0x16,
0x03,
0x01,
0x02,
0x00,
0x01,
0x00,
0x01,
0xfc,
0x03,
0x03}
View Source
var WrongNonceStarters = [...][]byte{
{0xef},
{0x48, 0x45, 0x41, 0x44},
{0x50, 0x4f, 0x53, 0x54},
{0x47, 0x45, 0x54, 0x20},
{0x4f, 0x50, 0x54, 0x49},
{0x16, 0x03, 0x01, 0x02},
{0xdd, 0xdd, 0xdd, 0xdd},
{0xee, 0xee, 0xee, 0xee},
}
Functions ¶
func IsWrongNonce ¶
Check if nonce is correct. Usefull for clients validation
Types ¶
type DcCtx ¶
Context for obfuscation proxy-DC connection
func (*DcCtx) DecryptNext ¶
func (*DcCtx) EncryptNext ¶
type FakeTlsCtx ¶
type FakeTlsCtx struct { Header FakeTlsHandshake Digest [32]byte Timestamp uint32 Secret *Secret }
func FakeTlsCtxFromTlsHeader ¶
func FakeTlsCtxFromTlsHeader(header FakeTlsHandshake, secret *Secret) (c *FakeTlsCtx, err error)
Checks handshake bytes against user secret (does not check timestamp) Returb faketls context in case os success.
type FakeTlsHandshake ¶ added in v0.7.1
type FakeTlsHandshake = [FakeTlsHandshakeLen]byte
FakeTlsHandshake is a set of bytes client supposed to send for initiate faketls connection.
type MiddleCtx ¶ added in v0.8.0
type MiddleCtx struct { CliNonce RpcNonce AdTag []byte Out netip.AddrPort MP netip.AddrPort Obf *MpCtx }
func NewMiddleCtx ¶ added in v0.8.0
func (*MiddleCtx) DecryptBlock ¶ added in v0.8.0
func (*MiddleCtx) EncryptBlock ¶ added in v0.8.0
type MpCtx ¶ added in v0.8.0
type MpCtx struct {
// contains filtered or unexported fields
}
func (*MpCtx) DecryptBlocks ¶ added in v0.8.0
func (*MpCtx) EncryptBlocks ¶ added in v0.8.0
type ObfCtx ¶ added in v0.7.1
type ObfCtx struct { Nonce Nonce Secret *Secret Protocol uint8 Dc int16 Random [2]byte // contains filtered or unexported fields }
Context for client-proxy obfuscation
func ObfCtxFromNonce ¶ added in v0.7.1
Generate client encryption context
func (*ObfCtx) DecryptNext ¶ added in v0.7.1
func (*ObfCtx) EncryptNext ¶ added in v0.7.1
type Obfuscator ¶ added in v0.7.1
Common interface that supports encryption and decryption of obfuscated messages.
type RpcNonce ¶ added in v0.8.0
type RpcNonce [RpcNonceLen]byte
type Secret ¶
type Secret struct { RawSecret []byte Type SecretType Tag byte Fakehost string }
func NewSecretHex ¶
Generate secret from hex string
type SecretType ¶
type SecretType int
const ( Simple SecretType = 1 Secured SecretType = 2 FakeTLS SecretType = 3 )
Click to show internal directories.
Click to hide internal directories.