Documentation ¶
Overview ¶
Package proto implements MTProto 2.0 primitives.
See https://core.telegram.org/mtproto/description for reference.
Index ¶
- Constants
- Variables
- func ReadIntermediate(r io.Reader, b *bin.Buffer) error
- func TypesMap() map[uint32]string
- func WriteIntermediate(w io.Writer, b *bin.Buffer) error
- type GZIP
- type GetConfig
- type InitConnection
- type InvokeWithLayer
- type Message
- type MessageContainer
- type MessageID
- type MessageType
- type Result
- type UnencryptedMessage
Constants ¶
const ( // CodeAuthKeyNotFound means that specified auth key ID cannot be found by the DC. CodeAuthKeyNotFound = 404 // CodeTransportFlood means that too many transport connections are // established to the same IP in a too short lapse of time, or if any // of the container/service message limits are reached. CodeTransportFlood = 429 )
const GZIPTypeID = 0x3072cfa1
GZIPTypeID is TL type id of GZIP.
const Layer = 121
Layer is current compatible layer.
const MessageContainerTypeID = 0x73f1f8dc
MessageContainerTypeID is TL type id of MessageContainer.
const ResultTypeID = 0xf35c6d01
ResultTypeID is TL type id of Result.
Variables ¶
var ErrMessageTooBig = errors.New("message is too big")
ErrMessageTooBig means that message length is too big to be handled.
var IntermediateClientStart = []byte{0xee, 0xee, 0xee, 0xee}
IntermediateClientStart is starting bytes sent by client in Intermediate mode.
Note that server does not respond with it.
Functions ¶
func ReadIntermediate ¶
ReadIntermediate reads payload from r to b.
Types ¶
type GZIP ¶
type GZIP struct {
Data []byte
}
GZIP represents a Packed Object.
Used to replace any other object (or rather, a serialization thereof) with its archived (gzipped) representation.
type InitConnection ¶
type InitConnection struct { Flags bin.Fields ID int DeviceModel string SystemVersion string AppVersion string SystemLangCode string LangPack string LangCode string Query bin.Encoder }
InitConnection is initConnection#c1cd5ea9 function.
type InvokeWithLayer ¶
InvokeWithLayer is invokeWithLayer#da9b0d0d function.
invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
type MessageContainer ¶
type MessageContainer struct {
Messages []Message
}
MessageContainer contains slice of messages.
type MessageID ¶
type MessageID int64
MessageID represents 64-bit message id.
func NewMessageID ¶
func NewMessageID(now time.Time, typ MessageType) MessageID
NewMessageID returns new message id for provided time and type.
type MessageType ¶
type MessageType byte
MessageType is type of message determined by message id.
A message is rejected over 300 seconds after it is created or 30 seconds before it is created (this is needed to protect from replay attacks).
The identifier of a message container must be strictly greater than those of its nested messages.
const ( // MessageUnknown reports that message id has unknown time and probably // should be ignored. MessageUnknown MessageType = iota // MessageFromClient is client message identifiers. MessageFromClient // MessageServerResponse is a response to a client message. MessageServerResponse // MessageFromServer is a message from the server. MessageFromServer )
type UnencryptedMessage ¶
UnencryptedMessage is plaintext message.