Versions in this module Expand all Collapse all v0 v0.1.0 Mar 11, 2021 Changes in this version + var ErrConnClosing = errors.New("use of closed network connection") + var ErrReadBlocking = errors.New("read packet was blocking") + var ErrWriteBlocking = errors.New("write packet was blocking") + type Config struct + ConnReadTimeout time.Duration + ConnWriteTimeout time.Duration + PacketReceiveChanLimit uint32 + PacketSendChanLimit uint32 + type Conn struct + func NewConn(conn net.Conn, srv *Server) *Conn + func (c *Conn) AsyncWritePacket(p Packet, timeout time.Duration) (err error) + func (c *Conn) Close() + func (c *Conn) Do() + func (c *Conn) GetExtraData() interface{} + func (c *Conn) GetRawConn() net.Conn + func (c *Conn) IsClosed() bool + func (c *Conn) PutExtraData(data interface{}) + func (c *Conn) SetCallback(callback ConnCallback) + type ConnCallback interface + OnClose func(*Conn) + OnConnect func(*Conn) bool + OnMessage func(*Conn, Packet) bool + type ConnectionCreator func(net.Conn, *Server) *Conn + type DefaultPacket struct + func NewDefaultPacket(buff []byte) *DefaultPacket + func (this *DefaultPacket) GetBody() []byte + func (this *DefaultPacket) Serialize() []byte + type DefaultProtocol struct + func (this *DefaultProtocol) ReadPacket(r io.Reader) (Packet, error) + type Packet interface + Serialize func() []byte + type Protocol interface + ReadPacket func(conn io.Reader) (Packet, error) + type Server struct + func NewServer(config *Config, callback ConnCallback, protocol Protocol) *Server + func (s *Server) Start(listener net.Listener, create ConnectionCreator) + func (s *Server) Stop()