messages

package
v1.0.1-0...-a77bf53 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Common

type Common interface {
	GetMsg() []byte
	GetMsgID() int
	GetSeqNo() int
}

Common это сообщение (зашифрованое либо открытое) которыми общаются между собой клиент и сервер

type Encrypted

type Encrypted struct {
	Msg         []byte
	MsgID       int64
	AuthKeyHash []byte

	Salt      int64
	SessionID int64
	SeqNo     int32
	MsgKey    []byte
}

func DeserializeEncrypted

func DeserializeEncrypted(data, authKey []byte) (*Encrypted, error)

func (*Encrypted) GetMsg

func (msg *Encrypted) GetMsg() []byte

func (*Encrypted) GetMsgID

func (msg *Encrypted) GetMsgID() int

func (*Encrypted) GetSeqNo

func (msg *Encrypted) GetSeqNo() int

func (*Encrypted) Serialize

func (msg *Encrypted) Serialize(client MessageInformator, requireToAck bool) ([]byte, error)

type MessageInformator

type MessageInformator interface {
	GetSessionID() int64
	GetSeqNo() int32
	GetServerSalt() int64
	GetAuthKey() []byte
}

MessageInformator нужен что бы отдавать информацию о текущей сессии для сериализации сообщения по факту это *MTProto структура

type Unencrypted

type Unencrypted struct {
	Msg   []byte
	MsgID int64
}

func DeserializeUnencrypted

func DeserializeUnencrypted(data []byte) (*Unencrypted, error)

func (*Unencrypted) GetMsg

func (msg *Unencrypted) GetMsg() []byte

func (*Unencrypted) GetMsgID

func (msg *Unencrypted) GetMsgID() int

func (*Unencrypted) GetSeqNo

func (msg *Unencrypted) GetSeqNo() int

func (*Unencrypted) Serialize

func (msg *Unencrypted) Serialize(client MessageInformator) ([]byte, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL