Documentation ¶
Index ¶
- type HookHandler
- type Mesh
- type Option
- func WithCodec(codec encoding.Codec) Option
- func WithContext(ctx context.Context) Option
- func WithEncryptor(encryptor crypto.Encryptor) 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
- func (p *Proxy) AddHookListener(hook cluster.Hook, handler HookHandler)
- func (p *Proxy) AddServiceProvider(name string, desc interface{}, provider interface{})
- func (p *Proxy) AskGate(ctx context.Context, gid string, uid int64) (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, gid string, cid, uid int64) error
- func (p *Proxy) BindNode(ctx context.Context, uid int64, name, nid string) error
- func (p *Proxy) Broadcast(ctx context.Context, args *cluster.BroadcastArgs) error
- func (p *Proxy) Deliver(ctx context.Context, args *cluster.DeliverArgs) error
- func (p *Proxy) Disconnect(ctx context.Context, args *cluster.DisconnectArgs) error
- 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) GetID() string
- func (p *Proxy) GetIP(ctx context.Context, args *cluster.GetIPArgs) (string, error)
- func (p *Proxy) GetName() string
- func (p *Proxy) IsOnline(ctx context.Context, args *cluster.IsOnlineArgs) (bool, error)
- 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 *cluster.MulticastArgs) error
- func (p *Proxy) NewMeshClient(target string) (transport.Client, error)
- func (p *Proxy) PackBuffer(message any) ([]byte, error)
- func (p *Proxy) PackMessage(message *cluster.Message) ([]byte, error)
- func (p *Proxy) Push(ctx context.Context, args *cluster.PushArgs) error
- 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, name, nid string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HookHandler ¶ added in v2.1.0
type HookHandler func(proxy *Proxy)
type Option ¶
type Option func(o *options)
func WithTransporter ¶
func WithTransporter(transporter transport.Transporter) Option
WithTransporter 设置消息传输器
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
func (*Proxy) AddHookListener ¶ added in v2.1.0
func (p *Proxy) AddHookListener(hook cluster.Hook, handler HookHandler)
AddHookListener 添加钩子监听器
func (*Proxy) AddServiceProvider ¶
AddServiceProvider 添加服务提供者
func (*Proxy) BindNode ¶
BindNode 绑定节点 单个用户可以绑定到多个节点服务器上,相同名称的节点服务器只能绑定一个,多次绑定会到相同名称的节点服务器会覆盖之前的绑定。 绑定操作会通过发布订阅方式同步到网关服务器和其他相关节点服务器上。
func (*Proxy) Disconnect ¶
Disconnect 断开连接
func (*Proxy) FetchGateList ¶
func (p *Proxy) FetchGateList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error)
FetchGateList 拉取网关列表
func (*Proxy) FetchNodeList ¶
func (p *Proxy) FetchNodeList(ctx context.Context, states ...cluster.State) ([]*registry.ServiceInstance, error)
FetchNodeList 拉取节点列表
func (*Proxy) LocateGate ¶
LocateGate 定位用户所在网关
func (*Proxy) LocateNode ¶
LocateNode 定位用户所在节点
func (*Proxy) NewMeshClient ¶ added in v2.1.0
NewMeshClient 新建微服务客户端 target参数可分为三种模式: 服务直连模式: direct://127.0.0.1:8011 服务直连模式: direct://711baf8d-8a06-11ef-b7df-f4f19e1f0070 服务发现模式: discovery://service_name
func (*Proxy) PackBuffer ¶ added in v2.2.0
PackBuffer 打包Buffer
func (*Proxy) PackMessage ¶ added in v2.2.0
PackMessage 打包消息
func (*Proxy) UnbindGate ¶
UnbindGate 解绑网关
Click to show internal directories.
Click to hide internal directories.