Documentation
¶
Index ¶
Constants ¶
const ( ERROR = -1 INVALID = 0 WAIT_FIRST_PACKET = 1 WAIT_PACKET_LENGTH_1 = 2 WAIT_PACKET_LENGTH_1_PACKET = 3 WAIT_PACKET_LENGTH_3 = 4 WAIT_PACKET_LENGTH_3_PACKET = 5 WAIT_PACKET_LENGTH = 6 WAIT_PACKET = 7 )
const ( // Tcp Transport ABRIDGED_FLAG = 0xef ABRIDGED_INT32_FLAG = 0xefefefef INTERMEDIATE_FLAG = 0xeeeeeeee PADDED_INTERMEDIATE_FLAG = 0xdddddddd UNKNOWN_FLAG = 0x02010316 PVRG_FLAG = 0x47725650 // PVrG FULL_FLAG = 0x00000000 // Http Transport HTTP_HEAD_FLAG = 0x44414548 // HEAD HTTP_POST_FLAG = 0x54534f50 // POST HTTP_GET_FLAG = 0x20544547 // GET HTTP_OPTION_FLAG = 0x4954504f // OPTION )
const (
MAX_MTPRORO_FRAME_SIZE = 16777216
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AbridgedCodec ¶
type AbridgedCodec struct {
*AesCTR128Crypto
// contains filtered or unexported fields
}
func (*AbridgedCodec) Decode ¶
func (c *AbridgedCodec) Decode(conn gnet.Conn) (interface{}, error)
Decode decodes frames from TCP stream via specific implementation.
type AesCTR128Crypto ¶
type AesCTR128Crypto struct {
// contains filtered or unexported fields
}
AesCTR128Crypto AesCTR128Crypto
func (*AesCTR128Crypto) Decrypt ¶
func (e *AesCTR128Crypto) Decrypt(plaintext []byte) []byte
func (*AesCTR128Crypto) Encrypt ¶
func (e *AesCTR128Crypto) Encrypt(plaintext []byte) []byte
type FullCodec ¶
type FullCodec struct {
}
FullCodec FullCodec
type HttpProxyCodec ¶
type HttpProxyCodec struct {
// contains filtered or unexported fields
}
func (*HttpProxyCodec) Decode ¶
func (c *HttpProxyCodec) Decode(conn gnet.Conn) (interface{}, error)
Decode decodes frames from TCP stream via specific implementation.
type IntermediateCodec ¶
type IntermediateCodec struct {
*AesCTR128Crypto
// contains filtered or unexported fields
}
IntermediateCodec https://core.telegram.org/mtproto#tcp-transport
In case 4-byte data alignment is needed, an intermediate version of the original protocol may be used: if the client sends 0xeeeeeeee as the first int (four bytes), then packet length is encoded always by four bytes as in the original version, but the sequence number and CRC32 are omitted, thus decreasing total packet size by 8 bytes.
func (*IntermediateCodec) Decode ¶
func (c *IntermediateCodec) Decode(conn gnet.Conn) (interface{}, error)
Decode decodes frames from TCP stream via specific implementation.
type MTPRawMessage ¶
type MTPRawMessage struct {
IsHttp bool
AuthKeyId int64 // 由原始数据解压获得
QuickAckId int32 // EncryptedMessage,则可能存在
Payload []byte // 原始数据
}
MTPRawMessage MTPRawMessage
func NewMTPRawMessage ¶
func NewMTPRawMessage(isHttp bool, authKeyId int64, quickAckId int32, payload []byte) *MTPRawMessage
func (*MTPRawMessage) GetAuthKeyId ¶
func (m *MTPRawMessage) GetAuthKeyId() int64
func (*MTPRawMessage) GetIsHttp ¶
func (m *MTPRawMessage) GetIsHttp() bool
func (*MTPRawMessage) GetQuickAckId ¶
func (m *MTPRawMessage) GetQuickAckId() int32
func (*MTPRawMessage) String ¶
func (m *MTPRawMessage) String() string
type MTProtoCodec ¶
type MTProtoCodec struct {
// contains filtered or unexported fields
}
///////////////////////////////////////////////////////////////////////////////////////////////////
func NewMTProtoCodec ¶
func NewMTProtoCodec() *MTProtoCodec
func (*MTProtoCodec) Decode ¶
func (c *MTProtoCodec) Decode(conn gnet.Conn) (interface{}, error)
Decode decodes frames from TCP stream via specific implementation.
type ObfuscatedCodec ¶
type PaddedIntermediateCodec ¶
type PaddedIntermediateCodec struct {
*AesCTR128Crypto
// contains filtered or unexported fields
}
PaddedIntermediateCodec https://core.telegram.org/mtproto#tcp-transport
In case 4-byte data alignment is needed, an intermediate version of the original protocol may be used: if the client sends 0xeeeeeeee as the first int (four bytes), then packet length is encoded always by four bytes as in the original version, but the sequence number and CRC32 are omitted, thus decreasing total packet size by 8 bytes.
func (*PaddedIntermediateCodec) Clone ¶
func (c *PaddedIntermediateCodec) Clone() gnet.ICodec
Clone ...
func (*PaddedIntermediateCodec) Decode ¶
func (c *PaddedIntermediateCodec) Decode(conn gnet.Conn) (interface{}, error)
Decode decodes frames from TCP stream via specific implementation.