transport

package
v2.0.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCancelledAllRequests = errors.New("session config changed, need to retry all requests")

Functions

func NewTCP

func NewTCP(host string) (io.ReadWriteCloser, error)

Types

type Clock

type Clock interface {
	Now() time.Time
}

type ClockFunc

type ClockFunc func() time.Time

func (ClockFunc) Now

func (c ClockFunc) Now() time.Time

type ErrCode

type ErrCode uint32

See more: https://core.telegram.org/mtproto/mtproto-transports#transport-errors

const (
	ErrAuthKeyNotFound ErrCode = ^ErrCode(404) + 1
	ErrFlood           ErrCode = ^ErrCode(429) + 1
	ErrInvalidDC       ErrCode = ^ErrCode(444) + 1
)

func (ErrCode) Error

func (e ErrCode) Error() string

type ErrNotMultiple

type ErrNotMultiple struct {
	Len int
}

func (*ErrNotMultiple) Error

func (e *ErrNotMultiple) Error() string

type Transport

type Transport interface {
	Close() error
	WriteMsg(ctx context.Context, body []byte, initiator payload.Initiator) (payload.MsgID, error)
	Ack(ctx context.Context, ids []payload.MsgID) error
	ReadMsg(context.Context) (id payload.MsgID, body []byte, ack bool, err error)
}

func NewTransport

func NewTransport(mode mode.Mode, key [256]byte, salt uint64) Transport

func NewUnencrypted

func NewUnencrypted(mode mode.Mode) Transport

Jump to

Keyboard shortcuts

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