Highly-opinionated (ex-bullshit-free) MTPROTO proxy for Telegram. If you use v1.0 or upgrade broke you proxy, please read the chapter Version 2
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

handshake_request.go 743B

1234567891011121314151617181920212223242526
  1. package rpc
  2. import "bytes"
  3. // HandshakeRequest is the data type which is responsible for
  4. // constructing of correct handshake request.
  5. type HandshakeRequest struct {
  6. }
  7. // Bytes returns serialized handshake request.
  8. func (r *HandshakeRequest) Bytes() []byte {
  9. buf := &bytes.Buffer{}
  10. buf.Grow(len(TagHandshake) + len(HandshakeFlags) + len(HandshakeSenderPID) + len(HandshakePeerPID))
  11. buf.Write(TagHandshake) // nolint: gosec
  12. buf.Write(HandshakeFlags) // nolint: gosec
  13. buf.Write(HandshakeSenderPID) // nolint: gosec
  14. buf.Write(HandshakePeerPID) // nolint: gosec
  15. return buf.Bytes()
  16. }
  17. // NewHandshakeRequest creates new HandshakeRequest instance.
  18. func NewHandshakeRequest() *HandshakeRequest {
  19. return &HandshakeRequest{}
  20. }