Documentation ¶
Index ¶
- type Client
- type Conn
- func (c *Conn) Bind(uid int64)
- func (c *Conn) Close() error
- func (c *Conn) DelAttr(key any)
- func (c *Conn) GetAttr(key any) value.Value
- func (c *Conn) ID() int64
- func (c *Conn) LocalAddr() (net.Addr, error)
- func (c *Conn) LocalIP() (string, error)
- func (c *Conn) Push(message *cluster.Message) error
- func (c *Conn) RemoteAddr() (net.Addr, error)
- func (c *Conn) RemoteIP() (string, error)
- func (c *Conn) SetAttr(key, value any)
- func (c *Conn) UID() int64
- func (c *Conn) Unbind()
- type Context
- type DialOption
- type EventHandler
- type HookHandler
- type Option
- type Proxy
- func (p *Proxy) AddEventListener(event cluster.Event, handler EventHandler)
- func (p *Proxy) AddHookListener(hook cluster.Hook, handler HookHandler)
- func (p *Proxy) AddRouteHandler(route int32, handler RouteHandler)
- func (p *Proxy) Client() network.Client
- func (p *Proxy) Dial(opts ...DialOption) (*Conn, error)
- func (p *Proxy) ID() string
- func (p *Proxy) Name() string
- func (p *Proxy) SetDefaultRouteHandler(handler RouteHandler)
- type RouteHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Conn ¶ added in v2.1.0
type Conn struct {
// contains filtered or unexported fields
}
func (*Conn) RemoteAddr ¶ added in v2.1.0
RemoteAddr 获取远端地址
type DialOption ¶ added in v2.1.0
type DialOption func(o *dialOptions)
func WithConnAttr ¶ added in v2.1.0
func WithConnAttr(key string, value any) DialOption
WithConnAttr 设置连接属性
type EventHandler ¶
type EventHandler func(conn *Conn)
type HookHandler ¶ added in v2.1.0
type HookHandler func(proxy *Proxy)
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) AddEventListener ¶
func (p *Proxy) AddEventListener(event cluster.Event, handler EventHandler)
AddEventListener 添加事件监听器
func (*Proxy) AddHookListener ¶ added in v2.1.0
func (p *Proxy) AddHookListener(hook cluster.Hook, handler HookHandler)
AddHookListener 添加钩子监听器
func (*Proxy) AddRouteHandler ¶
func (p *Proxy) AddRouteHandler(route int32, handler RouteHandler)
AddRouteHandler 添加路由处理器
func (*Proxy) Dial ¶ added in v2.1.0
func (p *Proxy) Dial(opts ...DialOption) (*Conn, error)
Dial 拨号
func (*Proxy) SetDefaultRouteHandler ¶
func (p *Proxy) SetDefaultRouteHandler(handler RouteHandler)
SetDefaultRouteHandler 设置默认路由处理器,所有未注册的路由均走默认路由处理器
type RouteHandler ¶
type RouteHandler func(ctx *Context)
Click to show internal directories.
Click to hide internal directories.