Versions in this module Expand all Collapse all v2 v2.0.0 Dec 4, 2023 Changes in this version + type BroadcastArgs = link.BroadcastArgs + type Context struct + Middleware *Middleware + Proxy *Proxy + Request *Request + func (c *Context) BindGate(uid int64) error + func (c *Context) BindNode() error + func (c *Context) Context() context.Context + func (c *Context) Disconnect(isForce ...bool) error + func (c *Context) GetIP() (string, error) + func (c *Context) Response(message interface{}) error + func (c *Context) UnbindGate() error + func (c *Context) UnbindNode() error + type DeliverArgs struct + Message *Message + NID string + UID int64 + type DisconnectArgs = link.DisconnectArgs + type Event struct + CID int64 + Event cluster.Event + GID string + Proxy *Proxy + UID int64 + type EventHandler func(event *Event) + type Events struct + func (e *Events) AddEventHandler(event cluster.Event, handler EventHandler) + type GetIPArgs = link.GetIPArgs + type Message = link.Message + type Middleware struct + func (m *Middleware) Next(ctx *Context) + func (m *Middleware) Skip(ctx *Context, skip int) + type MiddlewareHandler func(ctx *Context) + type MulticastArgs = link.MulticastArgs + type Node struct + func NewNode(opts ...Option) *Node + func (n *Node) Destroy() + func (n *Node) Init() + func (n *Node) Name() string + func (n *Node) Proxy() *Proxy + func (n *Node) Start() + type Option func(o *options) + func WithCodec(codec encoding.Codec) Option + func WithContext(ctx context.Context) Option + func WithEncryptor(encryptor crypto.Encryptor) Option + func WithID(id string) Option + func WithLocator(locator locate.Locator) Option + func WithName(name string) Option + func WithRegistry(r registry.Registry) Option + func WithTimeout(timeout time.Duration) Option + func WithTransporter(transporter transport.Transporter) Option + type Proxy struct + func (p *Proxy) AskGate(ctx context.Context, uid int64, gid string) (string, bool, error) + func (p *Proxy) AskNode(ctx context.Context, uid int64, name, nid string) (string, bool, error) + func (p *Proxy) BindGate(ctx context.Context, uid int64, gid string, cid int64) error + func (p *Proxy) BindNode(ctx context.Context, uid int64, nameAndNID ...string) error + func (p *Proxy) Broadcast(ctx context.Context, args *BroadcastArgs) (int64, error) + func (p *Proxy) Deliver(ctx context.Context, args *DeliverArgs) error + func (p *Proxy) Disconnect(ctx context.Context, args *DisconnectArgs) error + func (p *Proxy) Events() *Events + func (p *Proxy) FetchGateList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error) + func (p *Proxy) FetchNodeList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error) + func (p *Proxy) GetIP(ctx context.Context, args *GetIPArgs) (string, error) + func (p *Proxy) GetNodeID() string + func (p *Proxy) GetNodeName() string + func (p *Proxy) GetNodeState() cluster.State + func (p *Proxy) Invoke(fn func()) + func (p *Proxy) LocateGate(ctx context.Context, uid int64) (string, error) + func (p *Proxy) LocateNode(ctx context.Context, uid int64, name string) (string, error) + func (p *Proxy) Multicast(ctx context.Context, args *MulticastArgs) (int64, error) + func (p *Proxy) NewServiceClient(target string) (transport.ServiceClient, error) + func (p *Proxy) Push(ctx context.Context, args *PushArgs) error + func (p *Proxy) Response(ctx context.Context, req *Request, message interface{}) error + func (p *Proxy) Router() *Router + func (p *Proxy) SetNodeState(state cluster.State) + func (p *Proxy) Stat(ctx context.Context, kind session.Kind) (int64, error) + func (p *Proxy) UnbindGate(ctx context.Context, uid int64) error + func (p *Proxy) UnbindNode(ctx context.Context, uid int64, nameAndNID ...string) error + type PushArgs = link.PushArgs + type Request struct + CID int64 + GID string + Message *Message + NID string + UID int64 + func (r *Request) Parse(v interface{}) error + type RouteHandler func(ctx *Context) + type Router struct + func (r *Router) AddRouteHandler(route int32, stateful bool, handler RouteHandler, ...) + func (r *Router) CheckRouteStateful(route int32) (stateful bool, exist bool) + func (r *Router) Group(groups ...func(group *RouterGroup)) *RouterGroup + func (r *Router) HasDefaultRouteHandler() bool + func (r *Router) SetDefaultRouteHandler(handler RouteHandler) + type RouterGroup struct + func (g *RouterGroup) AddRouteHandler(route int32, stateful bool, handler RouteHandler, ...) *RouterGroup + func (g *RouterGroup) Middleware(middlewares ...MiddlewareHandler) *RouterGroup