Documentation ¶
Overview ¶
Package transport contains different MTProto transport implementations.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
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 Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection is MTProto connection.
type Dialer ¶
type Dialer interface {
DialContext(ctx context.Context, network, address string) (net.Conn, error)
}
Dialer dials using a context.
type Handler ¶
type Handler func(ctx context.Context, conn Connection) error
Handler is MTProto server connection handler.
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 NewIntermediateServer ¶
NewIntermediateServer creates new MTProto server with Intermediate transport codec.
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
Transport is MTProto connection creator.
func CustomTransport ¶
CustomTransport creates transport using user Codec constructor.
func Full ¶
Full creates Full transport.
See https://core.telegram.org/mtproto/mtproto-transports#full
func Intermediate ¶
Intermediate creates Intermediate transport.
See https://core.telegram.org/mtproto/mtproto-transports#intermediate
func (*Transport) DialContext ¶
DialContext creates new MTProto connection.