gateway

package
v0.0.0-...-ee7ecfe Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2019 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

通用的代理器

网关接收器

网关发送器:gateway->client

通用的tcp网关

通用的websocket网关

Index

Constants

View Source
const (
	RECV_NORMAL = "recvnormal" // from client->gateway
	RECV_CTRL   = "recvctrl"   // from client->gateway
	SEND_NORMAL = "sendnormal" // from gateway->client
	SEND_CTRL   = "sendctrl"   // from gateway->client
)
View Source
const (
	SESS_AUTHFAILED  = 0x4 // 认证失败
	SESS_AUTHSUCCEED = 0x8 // 认证成功
)

Variables

View Source
var (
	ERROR_STREAM_NOT_OPEN = errors.New("stream not opened yet")
)

Functions

This section is empty.

Types

type Agent

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

func (*Agent) Close

func (agent *Agent) Close()

func (*Agent) GetUserData

func (agent *Agent) GetUserData() interface{}

func (*Agent) NewIagent

func (agent *Agent) NewIagent() network.Iagent

func (*Agent) SetUserData

func (agent *Agent) SetUserData(data interface{})

func (*Agent) Start

func (agent *Agent) Start(conn network.Iconn)

type Session

type Session struct {
	MQ                chan network.Data_Frame      // 返回给客户端的异步消息
	UserId            int32                        // 玩家ID
	Stream            network.Service_StreamClient // 后端游戏服数据流
	Die               chan struct{}                // 会话关闭信号
	Flag              int32                        // 会话标记
	ConnectTime       time.Time                    // 链接建立时间
	PacketTime        time.Time                    // 当前包的到达时间
	LastPacketTime    time.Time                    // 上一个包到达时间
	PacketCount       uint32                       // 对收到的包进行计数
	PacketCountOneMin int                          // 每分钟的包统计,用于RPM判断
}

type TcpGateway

type TcpGateway struct {
	Config string
	Coder  network.Imessage
	// contains filtered or unexported fields
}

func (*TcpGateway) OnDestroy

func (tcp *TcpGateway) OnDestroy()

func (*TcpGateway) OnInit

func (tcp *TcpGateway) OnInit()

func (*TcpGateway) Run

func (tcp *TcpGateway) Run(ChClose chan bool)

type WsGateway

type WsGateway struct {
	Config string
	Coder  network.Imessage
	// contains filtered or unexported fields
}

func (*WsGateway) OnDestroy

func (wg *WsGateway) OnDestroy()

func (*WsGateway) OnInit

func (wg *WsGateway) OnInit()

func (*WsGateway) Run

func (wg *WsGateway) Run(ChClose chan bool)

Jump to

Keyboard shortcuts

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