Versions in this module Expand all Collapse all v0 v0.2.4 Apr 29, 2021 Changes in this version + var ErrConnectionClosed = errors.New("connection closed") + type CallBack interface + OnClose func(c *Connection) + OnMessage func(c *Connection, ctx interface{}, data []byte) []byte + type Connection struct + func New(fd int, loop *eventloop.EventLoop, sa unix.Sockaddr, protocol Protocol, ...) *Connection + func (c *Connection) Close() error + func (c *Connection) Connected() bool + func (c *Connection) Context() interface{} + func (c *Connection) HandleEvent(fd int, events poller.Event) + func (c *Connection) PeerAddr() string + func (c *Connection) ReadBufferLength() int64 + func (c *Connection) Send(buffer []byte, callback func(error)) error + func (c *Connection) SetContext(ctx interface{}) + func (c *Connection) ShutdownWrite() error + func (c *Connection) UserBuffer() *[]byte + func (c *Connection) WriteBufferLength() int64 + type DefaultProtocol struct + func (d *DefaultProtocol) Packet(c *Connection, data []byte) []byte + func (d *DefaultProtocol) UnPacket(c *Connection, buffer *ringbuffer.RingBuffer) (interface{}, []byte) + type KeyValueContext struct + func (c *KeyValueContext) Delete(key string) + func (c *KeyValueContext) Get(key string) (value interface{}, exists bool) + func (c *KeyValueContext) Set(key string, value interface{}) + type Protocol interface + Packet func(c *Connection, data []byte) []byte + UnPacket func(c *Connection, buffer *ringbuffer.RingBuffer) (interface{}, []byte)