Documentation ¶
Index ¶
- type BaseRouter
- type Connect
- func (c *Connect) Close() error
- func (c *Connect) GetAddress() net.Addr
- func (c *Connect) GetEpFd() int
- func (c *Connect) GetFd() int
- func (c *Connect) GetID() int
- func (c *Connect) GetPacker() iface.IPacker
- func (c *Connect) GetWriteBuff() ([]byte, bool)
- func (c *Connect) Read(bs []byte) (int, error)
- func (c *Connect) SetEpFd(epfd int)
- func (c *Connect) SetPoller(poller iface.IPoller)
- func (c *Connect) SetWriteBuff(bytes []byte)
- func (c *Connect) Write(msgID uint32, bytes []byte) (int, error)
- type ConnectManager
- type Option
- type Options
- type RouterMgr
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseRouter ¶
type BaseRouter struct{}
type Connect ¶
Connect TCP连接成功建立后,会抽象一个Connect
func (*Connect) GetAddress ¶
func (*Connect) GetWriteBuff ¶ added in v0.0.3
GetWriteBuff .
func (*Connect) SetWriteBuff ¶ added in v0.0.3
SetWriteBuff .
type ConnectManager ¶
ConnectManager 所有连接都保存在这里
func (*ConnectManager) ClearByEpFd ¶
func (c *ConnectManager) ClearByEpFd(epfd int)
ClearByEpFd 删除在这个epfd上管理的所有连接,只有这个epoll出现错误的时候才会调用这个方法 一份数据最好不要存多个地方,在一个地方统一管理
type Option ¶
type Option = func(opts *Options)
func WithNumEventLoop ¶
WithNumEventLoop event-loop数量配置
func WithTCPKeepAlive ¶
WithTCPKeepAlive 设置时间 TCP keepalive
type Options ¶
type Options struct { NumEventLoop int // 配置event-loop数量,默认:2 NumWorker int // 用来处理业务逻辑的goroutine数量,默认CPU核心数 LogOutput io.Writer // 日志保存目标,默认:Stdout Packer iface.IPacker // 实现这个接口可以使用自定义的封包方式 TCPKeepAlive time.Duration // TCP keepalive Hooks iface.IHooks // hooks }
Options 可选项配置,未配置时使用默认值
type RouterMgr ¶
type RouterMgr struct {
// contains filtered or unexported fields
}
func NewRouterMgr ¶
func NewRouterMgr() *RouterMgr
Click to show internal directories.
Click to hide internal directories.