gateway

package
v0.0.0-...-917d9ad Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	ClientID() *network.ClientID
	Secret() []byte
	Accept(ctx network.Context)
	Ping(ctx network.Context)
	Post(message interface{}) error
	Recvice(ctx network.Context)
	Closed(ctx network.Context)
	Destory()
	// contains filtered or unexported methods
}

type ClientConn

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

func (*ClientConn) Accept

func (dl *ClientConn) Accept(ctx network.Context)

func (*ClientConn) ClientID

func (dl *ClientConn) ClientID() *network.ClientID

func (*ClientConn) Closed

func (dl *ClientConn) Closed(ctx network.Context)

func (*ClientConn) Destory

func (dl *ClientConn) Destory()

func (*ClientConn) Ping

func (dl *ClientConn) Ping(ctx network.Context)

func (*ClientConn) Post

func (dl *ClientConn) Post(message interface{}) error

func (*ClientConn) Recvice

func (dl *ClientConn) Recvice(ctx network.Context)

func (*ClientConn) Secret

func (dl *ClientConn) Secret() []byte

type Encryption

type Encryption struct {
	Ecdh ecdh.ECDH
}

type Gateway

type Gateway struct {
	System *network.NetworkSystem
	Config *GatewayConfig
	// contains filtered or unexported fields
}

Gateway 网关

func New

func New(options ...GatewayConfigOption) *Gateway

func (*Gateway) FindRouter

func (g *Gateway) FindRouter(message proto.Message) *router.Router

FindRouter 查询路由

func (*Gateway) GetClient

func (g *Gateway) GetClient(cid *network.ClientID) Client

func (*Gateway) NewClientID

func (g *Gateway) NewClientID(id string) *network.ClientID

NewClientID 创建客户端连接者ID

func (*Gateway) Register

func (g *Gateway) Register(cid *network.ClientID, l Client) error

func (*Gateway) ReleaseClient

func (g *Gateway) ReleaseClient(c Client)

func (*Gateway) Start

func (g *Gateway) Start() error

func (*Gateway) Stop

func (g *Gateway) Stop() error

func (*Gateway) UnRegister

func (g *Gateway) UnRegister(cid *network.ClientID)

type GatewayClientPool

type GatewayClientPool interface {
	Get() network.Client
	Put(c Client)
}

func NewDefaultGatewayClientPool

func NewDefaultGatewayClientPool(g *Gateway) GatewayClientPool

type GatewayConfig

type GatewayConfig struct {
	VAddr             string
	LAddr             string
	LAddrServant      string
	NewNetworkSystem  func(options ...network.ConfigOption) *network.NetworkSystem
	ClientPool        GatewayClientPool
	NewEncryption     func() *Encryption
	Kleepalive        int32
	KleepaliveServant int32
	// RequestDefautTimeout int64
	OnlineOfNumber int
	Router         *router.RouterConfig
}

GatewayConfig 网关配置信息

func Configure

func Configure(options ...GatewayConfigOption) *GatewayConfig

type GatewayConfigOption

type GatewayConfigOption func(option *GatewayConfig)

GatewayConfigOption 是一个配置网关参数的函数

func WithClientPool

func WithClientPool(pool GatewayClientPool) GatewayConfigOption

WithClientPool 设置客户端池

func WithKleepalive

func WithKleepalive(timeout int32) GatewayConfigOption

WithNetworkTimeout 设置客户端网络连接保活时间

func WithKleepaliveServant

func WithKleepaliveServant(timeout int32) GatewayConfigOption

WithKleepaliveServant 设置内部服务网络连接保活时间

func WithLAddr

func WithLAddr(laddr string) GatewayConfigOption

func WithLAddrServant

func WithLAddrServant(laddr string) GatewayConfigOption

func WithNewEncryption

func WithNewEncryption(newFunc func() *Encryption) GatewayConfigOption

WithNewEncryption 设置密钥交换算法对象创建函数

func WithNewSystem

func WithNewSystem(newFunc func(options ...network.ConfigOption) *network.NetworkSystem) GatewayConfigOption

func WithOnlineOfNumber

func WithOnlineOfNumber(number int) GatewayConfigOption

WithOnlineOfNumber 设置最大在线人数

func WithRoute

func WithRoute(router *router.RouterConfig) GatewayConfigOption

WithRoute 设置路由配置

func WithVAddr

func WithVAddr(vaddr string) GatewayConfigOption

type GatewayServantActor

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

func (*GatewayServantActor) Closed

func (actor *GatewayServantActor) Closed(ctx context.Context)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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