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 *gcluster.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
- func WithClient(client gnetwork.Client) Option
- func WithCodec(codec gencoding.Codec) Option
- func WithContext(ctx context.Context) Option
- func WithEncryptor(encryptor gcrypto.Encryptor) Option
- func WithID(id string) Option
- func WithName(name string) Option
- func WithTimeout(timeout time.Duration) Option
- type Proxy
- func (p *Proxy) AddEventListener(event gcluster.Event, handler EventHandler)
- func (p *Proxy) AddHookListener(hook gcluster.Hook, handler HookHandler)
- func (p *Proxy) AddRouteHandler(route int32, handler RouteHandler)
- func (p *Proxy) Client() gnetwork.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 DialOption ¶
type DialOption func(o *dialOptions)
type EventHandler ¶
type EventHandler func(conn *Conn)
type HookHandler ¶
type HookHandler func(proxy *Proxy)
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) AddEventListener ¶
func (p *Proxy) AddEventListener(event gcluster.Event, handler EventHandler)
AddEventListener 添加事件监听器
func (*Proxy) AddHookListener ¶
func (p *Proxy) AddHookListener(hook gcluster.Hook, handler HookHandler)
AddHookListener 添加钩子监听器
func (*Proxy) AddRouteHandler ¶
func (p *Proxy) AddRouteHandler(route int32, handler RouteHandler)
AddRouteHandler 添加路由处理器
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.