gate

package
v0.0.0-...-aed9a31 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2023 License: Unlicense Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Gate

type Gate struct {
	// contains filtered or unexported fields
}

func NewGate

func NewGate(ctx context.Context, serverID string, process processor.Processor, opt *Options) *Gate

func (*Gate) Bind

func (g *Gate) Bind(s rpc.Server, msg *rpcmsg.RPCMessage)

func (*Gate) Close

func (p *Gate) Close()

func (*Gate) Push

func (g *Gate) Push(_ rpc.Server, msg *rpcmsg.RPCMessage)

func (*Gate) PushAll

func (g *Gate) PushAll(_ rpc.Server, msg *rpcmsg.RPCMessage)

func (*Gate) PushGroup

func (g *Gate) PushGroup(_ rpc.Server, msg *rpcmsg.RPCMessage)

func (*Gate) RegisterServerMsgHandler

func (g *Gate) RegisterServerMsgHandler(msgID string, handle func(rpc.Server, *rpcmsg.RPCMessage))

func (*Gate) Run

func (p *Gate) Run(watch ...string) error

func (*Gate) WatchService

func (r *Gate) WatchService(serverNames []string) error

type Option

type Option func(o *Options)

func WithClusterName

func WithClusterName(name string) Option

type Options

type Options struct {
	NatsAddr string // nats://127.0.0.1:4222,nats://127.0.0.1:4223
	User     string // 用户名
	Pwd      string // 密码

	ListenAddr string // 监听地址
	MaxMsgLen  int    // 最大消息长度(字节),默认1kb
	MaxConnNum int    // 最大连接数
	CertFile   string // 证书文件
	KeyFile    string // 秘钥文件
	ConsulAddr string
	Gate       discovery.ServiceInstance
	Agent      discovery.ServiceInstance
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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