package proto

Import Path
	github.com/gotd/td/internal/proto (on go.dev)

Dependency Relation
	imports 10 packages, and imported by 3 packages

Involved Source Files container.go Package proto implements MTProto 2.0 primitives. See https://core.telegram.org/mtproto/description for reference. gzip.go message_id.go registry.go rpc_result.go unencrypted_message.go
Package-Level Type Names (total 12, in which 10 are exported)
/* sort exporteds by: | */
DecompressionBombErr means that GZIP decode detected decompression bomb which decompressed payload is significantly higher than initial compressed size and stopped decompression to prevent OOM. Compressed int Decompressed int (*DecompressionBombErr) Error() string *DecompressionBombErr : error
GZIP represents a Packed Object. Used to replace any other object (or rather, a serialization thereof) with its archived (gzipped) representation. Data []byte Decode implements bin.Decoder. Encode implements bin.Encoder. *GZIP : github.com/gotd/td/bin.Decoder GZIP : github.com/gotd/td/bin.Encoder *GZIP : github.com/gotd/td/bin.Object
Message is element of MessageContainer. Body []byte Bytes int ID int64 SeqNo int Decode implements bin.Decoder. Encode implements bin.Encoder. *Message : github.com/gotd/td/bin.Decoder *Message : github.com/gotd/td/bin.Encoder *Message : github.com/gotd/td/bin.Object
MessageContainer contains slice of messages. Messages []Message Decode implements bin.Decoder. Encode implements bin.Decoder. *MessageContainer : github.com/gotd/td/bin.Decoder *MessageContainer : github.com/gotd/td/bin.Encoder *MessageContainer : github.com/gotd/td/bin.Object
MessageID represents 64-bit message id. ( MessageID) String() string Time returns approximate time when MessageID were generated. Type returns message type. MessageID : fmt.Stringer func NewMessageID(now time.Time, typ MessageType) MessageID func NewMessageIDNano(nano int64, typ MessageType) MessageID
MessageIDBuf stores last N message ids and is used in replay attack mitigation. Consume returns false if message should be discarded. *MessageIDBuf : github.com/gotd/td/internal/mtproto.MessageBuf func NewMessageIDBuf(n int) *MessageIDBuf
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. New generates new message id for provided type, protecting from collisions that are caused by low system time resolution. *MessageIDGen : github.com/gotd/td/internal/mtproto.MessageIDSource func NewMessageIDGen(now func() time.Time) *MessageIDGen
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. ( MessageType) String() string MessageType : fmt.Stringer func MessageID.Type() MessageType func NewMessageID(now time.Time, typ MessageType) MessageID func NewMessageIDNano(nano int64, typ MessageType) MessageID func (*MessageIDGen).New(t MessageType) int64 func github.com/gotd/td/internal/mtproto.MessageIDSource.New(t MessageType) int64 const MessageFromClient const MessageFromServer const MessageServerResponse const MessageUnknown
Result is rpc_result#f35c6d01. RequestMessageID int64 Result []byte Decode implements bin.Decoder. Encode implements bin.Encoder. *Result : github.com/gotd/td/bin.Decoder *Result : github.com/gotd/td/bin.Encoder *Result : github.com/gotd/td/bin.Object
UnencryptedMessage is plaintext message. MessageData []byte MessageID int64 Decode implements bin.Decoder. Encode implements bin.Encoder. *UnencryptedMessage : github.com/gotd/td/bin.Decoder UnencryptedMessage : github.com/gotd/td/bin.Encoder *UnencryptedMessage : github.com/gotd/td/bin.Object
Package-Level Functions (total 7, in which 5 are exported)
NewMessageID returns new message id for provided time and type.
NewMessageIDBuf initializes new message id buffer for last N stored values.
NewMessageIDGen creates new message id generator. Current time will be provided by now() function. This generator compensates time resolution problem removing probability of id collision. Such problem can be observed for relatively high RPS, sequential calls to time.Now() will return same time which leads to equal ids.
NewMessageIDNano returns new message id for provided current unix nanoseconds and type.
TypesMap returns mapping from type ids to TL type names.
Package-Level Variables (total 2, neither is exported)
Package-Level Constants (total 11, in which 7 are exported)
GZIPTypeID is TL type id of GZIP.
MessageContainerTypeID is TL type id of MessageContainer.
MessageFromClient is client message identifiers.
MessageFromServer is a message from the server.
MessageServerResponse is a response to a client message.
MessageUnknown reports that message id has unknown time and probably should be ignored.
ResultTypeID is TL type id of Result.