gate

package
v1.0.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Overview

Package gate 提供网关组件,负责客户端连接管理和消息转发。 网关组件作为客户端与服务器集群之间的入口,处理连接建立、消息路由和负载均衡。

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gate

type Gate struct {
	component.Base
	cluster.BaseCluster
	// contains filtered or unexported fields
}

func NewGate

func NewGate(opts ...Option) *Gate

func (*Gate) Close

func (g *Gate) Close() error

Close 关闭节点

func (*Gate) Destroy

func (g *Gate) Destroy() error

Destroy 销毁组件

func (*Gate) Init

func (g *Gate) Init() error

Init 初始化

func (*Gate) Name

func (g *Gate) Name() string

Name 组件名称

func (*Gate) Start

func (g *Gate) Start() error

Start 启动组件

type Option

type Option func(o *options)

func WithAddr

func WithAddr(addr string) Option

WithAddr 设置监听地址

func WithContext

func WithContext(ctx context.Context) Option

WithContext 设置上下文

func WithDispatch

func WithDispatch(dispatch cluster.Dispatch) Option

WithDispatch 设置无状态路由消息分发策略

func WithExpose

func WithExpose(expose bool) Option

WithExpose 设置是否将内部通信地址暴露到公网

func WithID

func WithID(id string) Option

WithID 设置实例ID

func WithLocator

func WithLocator(locator locate.Locator) Option

WithLocator 设置用户定位器

func WithMetadata

func WithMetadata(metadata map[string]string) Option

WithMetadata 设置元数据

func WithName

func WithName(name string) Option

WithName 设置实例名称

func WithRegistry

func WithRegistry(r registry.Registry) Option

WithRegistry 设置服务注册器

func WithServer

func WithServer(server network.Server) Option

WithServer 设置服务器

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout 设置RPC调用超时时间

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL