rpc

package
v1.0.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 9, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeqNoNonce     = -2
	SeqNoHandshake = -1
)

SeqNo* is the number of the sequence which have special meaning for the Telegram.

Variables

View Source
var (
	TagCloseExt     = []byte{0xa2, 0x34, 0xb6, 0x5e}
	TagProxyAns     = []byte{0x0d, 0xda, 0x03, 0x44}
	TagSimpleAck    = []byte{0x9b, 0x40, 0xac, 0x3b}
	TagHandshake    = []byte{0xf5, 0xee, 0x82, 0x76}
	TagNonce        = []byte{0xaa, 0x87, 0xcb, 0x7a}
	TagProxyRequest = []byte{0xee, 0xf1, 0xce, 0x36}

	NonceCryptoAES = []byte{0x01, 0x00, 0x00, 0x00}

	HandshakeFlags = []byte{0x00, 0x00, 0x00, 0x00}

	ProxyRequestExtraSize = []byte{0x18, 0x00, 0x00, 0x00}
	ProxyRequestProxyTag  = []byte{0xae, 0x26, 0x1e, 0xdb}

	HandshakeSenderPID = []byte("IPIPPRPDTIME")
	HandshakePeerPID   = []byte("IPIPPRPDTIME")
)

Different constants for RPC protocol.

View Source
var ProxyRequestFlagsEncryptedPrefix [8]byte

Functions

This section is empty.

Types

type HandshakeResponse

type HandshakeResponse struct {
	Type      []byte
	Flags     []byte
	SenderPID []byte
	PeerPID   []byte
}

func NewHandshakeResponse

func NewHandshakeResponse(data []byte) (*HandshakeResponse, error)

NewHandshakeResponse constructs new handshake response from the given data.

func (*HandshakeResponse) Bytes

func (r *HandshakeResponse) Bytes() []byte

Bytes returns a serialized handshake response.

func (*HandshakeResponse) Valid

func (r *HandshakeResponse) Valid() error

Valid checks that handshake response compliments request.

type NonceRequest

type NonceRequest struct {
	KeySelector []byte
	CryptoTS    []byte
	Nonce       []byte
}

func NewNonceRequest

func NewNonceRequest(proxySecret []byte) (*NonceRequest, error)

NewNonceRequest builds new none request based on proxy secret.

func (*NonceRequest) Bytes

func (r *NonceRequest) Bytes() []byte

Bytes returns serialized nonce request.

type NonceResponse

type NonceResponse struct {
	NonceRequest

	Type   []byte
	Crypto []byte
}

func NewNonceResponse

func NewNonceResponse(data []byte) (*NonceResponse, error)

NewNonceResponse build new nonce response based on the given data.

func (*NonceResponse) Bytes

func (r *NonceResponse) Bytes() []byte

Bytes returns serialized form of the nonce response.

func (*NonceResponse) Valid

func (r *NonceResponse) Valid(req *NonceRequest) error

type ProxyRequestFlags

type ProxyRequestFlags uint32
const (
	ProxyRequestFlagsHasAdTag     ProxyRequestFlags = 0x8
	ProxyRequestFlagsEncrypted    ProxyRequestFlags = 0x2
	ProxyRequestFlagsMagic        ProxyRequestFlags = 0x1000
	ProxyRequestFlagsExtMode2     ProxyRequestFlags = 0x20000
	ProxyRequestFlagsIntermediate ProxyRequestFlags = 0x20000000
	ProxyRequestFlagsAbdridged    ProxyRequestFlags = 0x40000000
	ProxyRequestFlagsQuickAck     ProxyRequestFlags = 0x80000000
	ProxyRequestFlagsPad          ProxyRequestFlags = 0x8000000
)

func (ProxyRequestFlags) Bytes

func (r ProxyRequestFlags) Bytes() []byte

func (ProxyRequestFlags) String

func (r ProxyRequestFlags) String() string

type ProxyResponse

type ProxyResponse struct {
	Type    ProxyResponseType
	ConnID  conntypes.ConnID
	Payload conntypes.Packet
}

func ParseProxyResponse

func ParseProxyResponse(packet conntypes.Packet) (*ProxyResponse, error)

type ProxyResponseType

type ProxyResponseType uint8
const (
	ProxyResponseTypeAns ProxyResponseType = iota
	ProxyResponseTypeSimpleAck
	ProxyResponseTypeCloseExt
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL