FILE / ScuroNeko/mtg

_mtproto/rpc/handshake_request.go

Исходный файл и его история в репозитории.
FILE e81c5970d41aea502043a03065ae1ed89c84ace0
Files
mtg/_mtproto/rpc/handshake_request.go
T
2019-09-04 10:19:01 +03:00

27 lines
743 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) // nolint: gosec
buf.Write(HandshakeFlags) // nolint: gosec
buf.Write(HandshakeSenderPID) // nolint: gosec
buf.Write(HandshakePeerPID) // nolint: gosec
return buf.Bytes()
}
// NewHandshakeRequest creates new HandshakeRequest instance.
func NewHandshakeRequest() *HandshakeRequest {
return &HandshakeRequest{}
}