package transportimport ()// Protocol is MTProto transport protocol.//// See https://core.telegram.org/mtproto/mtproto-transportstypeProtocolstruct {codecfunc() Codec}// NewProtocol creates new transport protocol using user Codec constructor.//// See https://core.telegram.org/mtproto/mtproto-transportsfunc ( func() Codec) Protocol {returnProtocol{codec: , }}// Telegram transport protocols.//// See https://core.telegram.org/mtproto/mtproto-transportsvar (// Abridged is abridged transport protocol. // // See https://core.telegram.org/mtproto/mtproto-transports#abridgedAbridged = NewProtocol(func() Codec { returncodec.Abridged{} })// Intermediate is intermediate transport protocol. // // See https://core.telegram.org/mtproto/mtproto-transports#intermediateIntermediate = NewProtocol(func() Codec { returncodec.Intermediate{} })// PaddedIntermediate is padded intermediate transport protocol. // // See https://core.telegram.org/mtproto/mtproto-transports#padded-intermediatePaddedIntermediate = NewProtocol(func() Codec { returncodec.PaddedIntermediate{} })// Full is full transport protocol. // // See https://core.telegram.org/mtproto/mtproto-transports#fullFull = NewProtocol(func() Codec { return &codec.Full{} }))// Codec creates new codec using protocol settings.func ( Protocol) () Codec {return .codec()}// CodecNoHeader is Codec without header.func ( Protocol) () Codec {returncodec.NoHeader{Codec: .codec()}}// Handshake inits given net.Conn as MTProto connection.func ( Protocol) ( net.Conn) (Conn, error) { := .codec()if := .WriteHeader(); != nil {returnnil, errors.Wrap(, "write header") }return &connection{conn: ,codec: , }, nil}// Pipe creates an in-memory MTProto connection.func ( Protocol) () (, Conn) { , := net.Pipe()return &connection{conn: ,codec: .codec(), }, &connection{conn: ,codec: .codec(), }}
The pages are generated with Goldsv0.6.7. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.