Documentation ¶
Index ¶
- Constants
- Variables
- func RegisterWebSocketOrigin(ori string)
- type Packet
- type PacketFormat
- type PacketPackager
- type PacketPackagerHTTP
- type PacketPackagerNB
- type PacketPackagerNBOrigin
- type PacketPackagerWS
- type PacketParser
- type PacketParserHTTP
- type PacketParserNB
- type PacketParserNBOrigin
- type PacketParserWS
Constants ¶
View Source
const ( PacketNBHeaderLength = 5 MaskNB = 0x80 MaskNBCompressSupport = 0x1 MaskNBEncrypt = 0x1 << 1 MaskNBCompressed = 0x1 << 2 MaskNBReserved = 0x1 << 3 MaskNBFeature = MaskNBReserved | MaskNB )
packet struct { mask -> bit (1) flag -> bit (7) protocol-type -> bit (4) protocol-ver -> bit (4) final-packet-size -> bit (24) compress-data -> memory (final-packet-size - sizeof(packet-header)) }
View Source
const ( PacketNBOriginHeaderLength = 2 + 2 + 4 + 4 + 4 MaskOriginCompress = 0x1 MaskOriginEncrypt = 0x1 << 1 MaskOriginImData = 0x1 << 2 MaskOriginCompressSupport = 0x1 << 3 MaskOriginJson = 0x1 << 4 )
View Source
const HttpHeaderMinLength = 16
View Source
const PacketMaxLength = 0xFFFFFF
View Source
const WSDataMinLength = 2
View Source
const WSHeaderMinLength = 16
View Source
const WSMagicStr = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
View Source
const WSRespFmt = "" /* 143-byte string literal not displayed */
View Source
const WSRespFmtWithoutProtocol = "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: %s\r\n\r\n"
Variables ¶
View Source
var PacketFormatHTTP = &packetFormatHTTP
View Source
var PacketFormatNB = &packetFormatNB
View Source
var PacketFormatNBOrigin = &packetFormatNBOrigin
View Source
var PacketFormatWS = &packetFormatWS
Functions ¶
func RegisterWebSocketOrigin ¶
func RegisterWebSocketOrigin(ori string)
Types ¶
type PacketFormat ¶
type PacketFormat struct { Tag string Priority int UnixNeed bool Parser PacketParser Packager PacketPackager }
type PacketPackagerHTTP ¶
type PacketPackagerHTTP struct { }
type PacketPackagerNB ¶
type PacketPackagerNB struct { }
type PacketPackagerNBOrigin ¶
type PacketPackagerNBOrigin struct { }
type PacketPackagerWS ¶
type PacketPackagerWS struct { }
type PacketParser ¶
type PacketParserNBOrigin ¶
type PacketParserNBOrigin struct { }
func (PacketParserNBOrigin) Pop ¶
func (receiver PacketParserNBOrigin) Pop(in []byte) (error, *Packet, int)
Click to show internal directories.
Click to hide internal directories.