Documentation ¶
Index ¶
Constants ¶
View Source
const ( HeaderSize = 2 MaxBodySize = 4 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
func ListenAndServeTcp ¶
func NewRWSession ¶
func NewRWSession(ph PacketHandler) *rwSession
Types ¶
type BytesPacket ¶
type BytesPacket []byte
func (BytesPacket) Bytes ¶
func (p BytesPacket) Bytes() []byte
func (BytesPacket) Len ¶
func (p BytesPacket) Len() int
type DecryptFunc ¶
type DecryptFunc func(dst, src []byte)
type EncryptFunc ¶
type EncryptFunc func(dst, src []byte)
type PacketHandler ¶
type PacketHandler func(b []byte)
type RWSession ¶
type RWSession interface { // Conn return the real connection // of the current client Conn() net.Conn // Send send the packet Send(p Packet) // SetCryptFunc set crypt function // if not set crypt will use default crypt SetEncryptFunc(encrypt EncryptFunc) // SetDecryptFunc set decrypt function // if not set will use default decrypt SetDecryptFunc(decrypt DecryptFunc) // Run start read write session // // the nil val of start/end the service will // not notify when service start or end Run(start, end func()) }
Click to show internal directories.
Click to hide internal directories.