Documentation ¶
Index ¶
Constants ¶
View Source
const ( ClientMode mode = iota ServerMode )
View Source
const ( Version = 6 VersionLength = 1 IDLength = 4 CMDLength = 1 HeaderWithoutPayloadLength = VersionLength + IDLength + CMDLength PSH Cmd = 1 << 7 CLOSE Cmd = 1 << 6 PING Cmd = 1 << 5 ACK Cmd = 1 << 4 // [4 bytes data readableBufSize] tell peer the readable size NEW Cmd = 1 << 3 // can take some data to reduce dial time, [4 bytes readableBufSize + optional data] ACPT Cmd = 1 << 2 // take [4 bytes readableBufSize] )
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { AcceptQueueSize int KeepaliveInterval time.Duration // if config mode is ServerMode, KeepaliveInterval will be ignored BufferSize int DebugLog bool // enable debug log Mode mode // manager run mode ReadBufSize int32 }
Config manager config.
func KeepaliveConfig ¶
func KeepaliveConfig(mode mode) Config
KeepaliveConfig DefaultConfig enable keepalive.
type ErrVersion ¶ added in v0.3.0
func (ErrVersion) Error ¶ added in v0.3.0
func (ev ErrVersion) Error() string
type Manager ¶
type Packet ¶
type Packet struct { Version uint8 ID uint32 // CMD 1 byte // PSH 0b1000,0000 // CLOSE 0b0100,0000 // PING 0b0010,0000 // ACK 0b0001,0000 // NEW 0b0000,1000 // ACPT 0b0000,0100 // RSV 0b0000,0000 CMD Cmd PayloadLength int Payload []byte // contains filtered or unexported fields }
header[VersionLength + IDLength + CMDLength + indefinite length bytes] [payload]
Source Files ¶
Click to show internal directories.
Click to hide internal directories.