Documentation ¶
Index ¶
- Constants
- Variables
- func TcpListener(addr string, reuseport bool) (l *tcpListener, err error)
- type Connection
- func (c *Connection) Access()
- func (c *Connection) Close() (err error)
- func (c *Connection) DelValue(keys ...string)
- func (c *Connection) GetLatestAccessTime() (latestAccessTime int64)
- func (c *Connection) GetValue(key string) (value interface{}, exits bool)
- func (c *Connection) SetValue(key string, value interface{})
- type Epoll
- func (e *Epoll) AddRead(fd int) error
- func (e *Epoll) AddReadWrite(fd int) error
- func (e *Epoll) AddWrite(fd int) error
- func (e *Epoll) ModRead(fd int) error
- func (e *Epoll) ModReadWrite(fd int) error
- func (e *Epoll) ModWrite(fd int) error
- func (e *Epoll) Poll(handler EventHandler)
- func (e *Epoll) Remove(fd int) error
- func (e *Epoll) Stop()
- type EventHandler
- type EventLoop
- type Listener
- type Manager
- type Server
Constants ¶
View Source
const ( EventRead = 1 << 1 EventWrite = 1 << 2 )
Variables ¶
View Source
var (
ErrUnsupportedProtocol = errors.New("only tcp/tcp4/tcp6/unix supported")
)
Functions ¶
func TcpListener ¶
Types ¶
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
func (*Connection) Access ¶
func (c *Connection) Access()
func (*Connection) Close ¶
func (c *Connection) Close() (err error)
func (*Connection) DelValue ¶
func (c *Connection) DelValue(keys ...string)
func (*Connection) GetLatestAccessTime ¶
func (c *Connection) GetLatestAccessTime() (latestAccessTime int64)
func (*Connection) GetValue ¶
func (c *Connection) GetValue(key string) (value interface{}, exits bool)
func (*Connection) SetValue ¶
func (c *Connection) SetValue(key string, value interface{})
type Epoll ¶
type Epoll struct {
// contains filtered or unexported fields
}
func (*Epoll) AddReadWrite ¶
func (*Epoll) ModReadWrite ¶
func (*Epoll) Poll ¶
func (e *Epoll) Poll(handler EventHandler)
type EventHandler ¶
type EventLoop ¶
type EventLoop interface { Start() (err error) Accept(fd int) (err error) Read(conn *Connection) (err error) Write(conn *Connection) (err error) }
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func NewManager ¶
func (*Manager) TotalConnections ¶
type Server ¶
type Server interface { OnInitComplete() OnShutdown() OnConnect(conn *Connection) OnReceive(conn *Connection, buffer []byte) OnClosed(conn *Connection, err error) }
Click to show internal directories.
Click to hide internal directories.