Documentation ¶
Overview ¶
Package transport contains different MTProto transport implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Abridged is abridged transport protocol. // // See https://core.telegram.org/mtproto/mtproto-transports#abridged Abridged = NewProtocol(func() Codec { return codec.Abridged{} }) // Intermediate is intermediate transport protocol. // // See https://core.telegram.org/mtproto/mtproto-transports#intermediate Intermediate = NewProtocol(func() Codec { return codec.Intermediate{} }) // PaddedIntermediate is padded intermediate transport protocol. // // See https://core.telegram.org/mtproto/mtproto-transports#padded-intermediate PaddedIntermediate = NewProtocol(func() Codec { return codec.PaddedIntermediate{} }) // Full is full transport protocol. // // See https://core.telegram.org/mtproto/mtproto-transports#full Full = NewProtocol(func() Codec { return &codec.Full{} }) )
Telegram transport protocols.
Functions ¶
This section is empty.
Types ¶
type Codec ¶
type Codec interface { // WriteHeader sends protocol tag if needed. WriteHeader(w io.Writer) error // ReadHeader reads protocol tag if needed. ReadHeader(r io.Reader) error // Write encode to writer message from given buffer. Write(w io.Writer, b *bin.Buffer) error // Read fills buffer with received message. Read(r io.Reader, b *bin.Buffer) error }
Codec is MTProto transport protocol encoding abstraction.
type Conn ¶ added in v0.12.0
type Conn interface { Send(ctx context.Context, b *bin.Buffer) error Recv(ctx context.Context, b *bin.Buffer) error Close() error }
Conn is transport connection.
type Protocol ¶ added in v0.33.0
type Protocol struct {
// contains filtered or unexported fields
}
Protocol is MTProto transport protocol.
See https://core.telegram.org/mtproto/mtproto-transports
func NewProtocol ¶ added in v0.33.0
NewProtocol creates new transport protocol using user Codec constructor.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a simple MTProto server.
func NewCustomServer ¶
NewCustomServer creates new MTProto server with custom transport codec.
func NewFullServer ¶ added in v0.12.0
NewFullServer creates new MTProto server with Full transport codec.
func NewIntermediateServer ¶
NewIntermediateServer creates new MTProto server with Intermediate transport codec.
Click to show internal directories.
Click to hide internal directories.