mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 23:14:02 +03:00
FILE / ScuroNeko/mtg
mtproto/rpc/handshake_request.go
Исходный файл и его история в репозитории.
27 lines
663 B
Go
27 lines
663 B
Go
package rpc
|
|
|
|
import "bytes"
|
|
|
|
// HandshakeRequest is the data type which is responsible for
|
|
// constructing of correct handshake request.
|
|
type HandshakeRequest struct {
|
|
}
|
|
|
|
// Bytes returns serialized handshake request.
|
|
func (r *HandshakeRequest) Bytes() []byte {
|
|
buf := &bytes.Buffer{}
|
|
buf.Grow(len(TagHandshake) + len(HandshakeFlags) + len(HandshakeSenderPID) + len(HandshakePeerPID))
|
|
|
|
buf.Write(TagHandshake)
|
|
buf.Write(HandshakeFlags)
|
|
buf.Write(HandshakeSenderPID)
|
|
buf.Write(HandshakePeerPID)
|
|
|
|
return buf.Bytes()
|
|
}
|
|
|
|
// NewHandshakeRequest creates new HandshakeRequest instance.
|
|
func NewHandshakeRequest() *HandshakeRequest {
|
|
return &HandshakeRequest{}
|
|
}
|