gate

package
v0.0.0-...-9c21ab8 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AgentCreatedEvent     = "NewAgent"
	AgentBeforeCloseEvent = "CloseAgent"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent interface {
	WriteMsg(msg interface{})
	LocalAddr() net.Addr
	RemoteAddr() net.Addr
	Close()
	Destroy()
	UserData() interface{}
	SetUserData(data interface{})
}

type IGate

type IGate interface {
	Processor() processor.Processor
	AgentChanRPC() *chanrpc.Server
}

路由

type TcpClient

type TcpClient struct {
	Server        string
	MsgProcessor  processor.Processor
	RPCServer     *chanrpc.Server
	BinaryParser  tcp.IParser
	AutoReconnect bool
	UserData      interface{}
}

func (*TcpClient) AgentChanRPC

func (c *TcpClient) AgentChanRPC() *chanrpc.Server

func (*TcpClient) OnDestroy

func (c *TcpClient) OnDestroy()

func (*TcpClient) Processor

func (c *TcpClient) Processor() processor.Processor

func (*TcpClient) Run

func (c *TcpClient) Run(closeSig chan struct{})

type TcpGate

type TcpGate struct {
	Addr            string
	MaxConnNum      int
	PendingWriteNum int
	MsgProcessor    processor.Processor
	RPCServer       *chanrpc.Server
	BinaryParser    tcp.IParser
}

func (*TcpGate) AgentChanRPC

func (gate *TcpGate) AgentChanRPC() *chanrpc.Server

func (*TcpGate) OnDestroy

func (gate *TcpGate) OnDestroy()

func (*TcpGate) Processor

func (gate *TcpGate) Processor() processor.Processor

func (*TcpGate) Run

func (gate *TcpGate) Run(closeSig chan struct{})

type WsClient

type WsClient struct {
	Server        string
	MsgTextFormat bool
	HttpTimeout   time.Duration
	MsgProcessor  processor.Processor
	RPCServer     *chanrpc.Server
	AutoReconnect bool
	UserData      interface{}
}

func (*WsClient) AgentChanRPC

func (w *WsClient) AgentChanRPC() *chanrpc.Server

func (*WsClient) OnDestroy

func (w *WsClient) OnDestroy()

func (*WsClient) Processor

func (w *WsClient) Processor() processor.Processor

func (*WsClient) Run

func (w *WsClient) Run(closeSig chan struct{})

type WsGate

type WsGate struct {
	MaxConnNum      int
	PendingWriteNum int
	MaxMsgLen       uint32
	MsgProcessor    processor.Processor
	MsgTextFormat   bool
	AuthFunc        func(*http.Request) (bool, interface{})
	RPCServer       *chanrpc.Server

	Addr        string
	HTTPTimeout time.Duration
	CertFile    string
	KeyFile     string
}

func (*WsGate) AgentChanRPC

func (gate *WsGate) AgentChanRPC() *chanrpc.Server

func (*WsGate) OnDestroy

func (gate *WsGate) OnDestroy()

func (*WsGate) Processor

func (gate *WsGate) Processor() processor.Processor

func (*WsGate) Run

func (gate *WsGate) Run(closeSig chan struct{})

Jump to

Keyboard shortcuts

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