Documentation ¶
Overview ¶
Package proto implements MTProto 2.0 primitives.
See https://core.telegram.org/mtproto/description for reference.
Index ¶
Constants ¶
const GZIPTypeID = 0x3072cfa1
GZIPTypeID is TL type id of GZIP.
const InitConnectionID = 0xc1cd5ea9
InitConnectionID is TL type id of initConnection#c1cd5ea9.
const InvokeWithLayerID = 0xda9b0d0d
InvokeWithLayerID is TL type id of invokeWithLayer#da9b0d0d.
const InvokeWithoutUpdatesTypeID = 0xbf9459b7
InvokeWithoutUpdatesTypeID is TL type id of invokeWithoutUpdates#bf9459b7.
const MessageContainerTypeID = 0x73f1f8dc
MessageContainerTypeID is TL type id of MessageContainer.
const ResultTypeID = 0xf35c6d01
ResultTypeID is TL type id of Result.
Variables ¶
This section is empty.
Functions ¶
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 GetConfig ¶
type GetConfig struct{}
GetConfig is help.getConfig#c4f9186b function.
type InitConnection ¶
type InitConnection struct { Flags bin.Fields ID int DeviceModel string SystemVersion string AppVersion string SystemLangCode string LangPack string LangCode string Query bin.Object }
InitConnection is initConnection#c1cd5ea9 function.
type InvokeWithLayer ¶
InvokeWithLayer is invokeWithLayer#da9b0d0d function.
invokeWithLayer#da9b0d0d {X:Type} layer:int query:!X = X;
type InvokeWithoutUpdates ¶ added in v0.17.0
InvokeWithoutUpdates is invokeWithoutUpdates#bf9459b7 function.
invokeWithoutUpdates#bf9459b7 {X:Type} 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 MessageIDGen ¶ added in v0.16.0
type MessageIDGen struct {
// contains filtered or unexported fields
}
MessageIDGen is message id generator that provides collision prevention.
The main reason of such structure is that now() can return same time during multiple calls and that leads to duplicate message id.
func NewMessageIDGen ¶ added in v0.16.0
func NewMessageIDGen(now func() time.Time, n int) *MessageIDGen
NewMessageIDGen creates new message id generator.
Current time will be provided by now() function. The n parameter configures capacity of message id history, bigger n results in bigger memory consumption.
func (*MessageIDGen) New ¶ added in v0.16.0
func (g *MessageIDGen) New(t MessageType) int64
New generates new message id for provided type, protecting from collisions that are caused by low memory resolution.
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.