Source File
unencrypted_message.go
Belonging Package
github.com/gotd/td/internal/proto
package protoimport ()// UnencryptedMessage is plaintext message.type UnencryptedMessage struct {MessageID int64MessageData []byte}// Decode implements bin.Decoder.func ( *UnencryptedMessage) ( *bin.Buffer) error {{// Reading auth_key_id that should be always equal to zero., := .Long()if != nil {return}if != 0 {return errors.Errorf("unexpected auth_key_id %d of plaintext message", )}}{, := .Long()if != nil {return}.MessageID =}// Reading data., := .Int32()if != nil {return}.MessageData = append(.MessageData[:0], make([]byte, )...)if := .ConsumeN(.MessageData, int()); != nil {return errors.Wrap(, "consume payload")}return nil}// Encode implements bin.Encoder.func ( UnencryptedMessage) ( *bin.Buffer) error {.PutLong(0).PutLong(.MessageID).PutInt32(int32(len(.MessageData))).Put(.MessageData)return nil}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |