Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInterfaceIsNil = errors.New("interface is nil") ErrModeNotSupported = errors.New("mode is not supported") ErrAmbiguousModeAnnounce = errors.New("ambiguous mode announce, expected other byte sequence") )
View Source
var (
ErrChecksumMismatch = errors.New("checksum mismatch")
)
Functions ¶
This section is empty.
Types ¶
type ErrNotMultiple ¶
type ErrNotMultiple struct {
Len int
}
func (ErrNotMultiple) Error ¶
func (e ErrNotMultiple) Error() string
type Mode ¶
type Mode interface { WriteMsg([]byte) error // this is not same as the io.Writer ReadMsg() ([]byte, error) // contains filtered or unexported methods }
Mode is an interface that defines how the connection sides determine the size of transmitted messages. Unlike HTTP or UDP connections, raw TCP connections and WebSockets don't have a standard way to determine the size of transmitted or received messages. Their main purpose is to transmit bytes in the correct order. Mode allows the connection sides to avoid analyzing traffic or using end-of-message sequences.
In the MTProto world, Mode acts like a microprotocol. It packages messages in a container that announces its size in advance.
Click to show internal directories.
Click to hide internal directories.