FILE / ScuroNeko/mtg

mtproto/rpc/handshake_request.go

Исходный файл и его история в репозитории.
FILE 0344330230f9e07542a2eb6b127fad2330ba143c
Files
mtg/mtproto/rpc/handshake_request.go
T
2018-07-09 16:11:05 +03:00

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{}
}