Documentation ¶
Index ¶
- Constants
- Variables
- func NewBufferPoll() (pool sync.Pool)
- type Action
- type Connection
- type ConnectionHandler
- type EventHandler
- type EventLoop
- func (ev *EventLoop) AddFdHandler(fd int, handler EventHandler) error
- func (ev *EventLoop) DelFdHandler(fd int) error
- func (ev *EventLoop) EnableRead(fd int) error
- func (ev *EventLoop) EnableReadWrite(fd int) error
- func (ev *EventLoop) PacketBuf() []byte
- func (ev *EventLoop) Stop() error
- func (ev *EventLoop) Trigger(fn func())
- func (ev *EventLoop) Wait()
- type ListenHandler
- type Listener
- type Options
- type Protocol
- type Server
Constants ¶
View Source
const (
ConnectFdContextKey = "connect-fd-context-key"
)
Variables ¶
View Source
var ErrConnectionClosed = errors.New("connection closed")
View Source
var ErrServerClosed = errors.New("evnio: Server closed")
Functions ¶
func NewBufferPoll ¶
Types ¶
type Connection ¶
type ConnectionHandler ¶
type ConnectionHandler interface { OnOpen(c Connection) OnMessage(c Connection, data []byte) OnClose(c Connection) }
type EventHandler ¶
type EventLoop ¶
type EventLoop struct {
// contains filtered or unexported fields
}
func (*EventLoop) AddFdHandler ¶
func (ev *EventLoop) AddFdHandler(fd int, handler EventHandler) error
func (*EventLoop) DelFdHandler ¶
func (*EventLoop) EnableRead ¶
func (*EventLoop) EnableReadWrite ¶
type ListenHandler ¶
type Listener ¶
type Listener struct {
// contains filtered or unexported fields
}
func NewListener ¶
func NewListener(addr string, evLoop *EventLoop, handler ListenHandler) (*Listener, error)
type Options ¶
type Options struct { Addr string NumLoops int Protocol Protocol Handler ConnectionHandler }
func NewOptions ¶
func NewOptions() *Options
func (*Options) SetHandler ¶
func (opts *Options) SetHandler(handler ConnectionHandler) *Options
func (*Options) SetNumLoops ¶
func (*Options) SetProtocol ¶
type Protocol ¶
type Protocol interface { UnPacket(Connection, *bytes.Buffer) []byte Packet(Connection, []byte) []byte }
Source Files ¶
Click to show internal directories.
Click to hide internal directories.