gate

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package gate gateway基础模块

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Base

type Base struct {
	*log.Logger
	// contains filtered or unexported fields
}

Base Gateway基础模块

func (*Base) BindOuterTCP

func (gateBase *Base) BindOuterTCP(addr string)

BindOuterTCP 绑定外部TCP地址

func (*Base) GetClient

func (gateBase *Base) GetClient(connectid string) *connect.Client

GetClient 根据连接ID获取一个Client

func (*Base) GetClientCount

func (gateBase *Base) GetClientCount() uint32

GetClientCount 获取当前已连接的Client数量

func (*Base) HookGate

func (gateBase *Base) HookGate(gateHook base.GateHook)

HookGate 注册gate服务处理钩子

func (*Base) Init

func (gateBase *Base) Init(moduleID string)

Init 初始化模块

func (*Base) OnAcceptClientConnect

func (gateBase *Base) OnAcceptClientConnect(conn net.Conn)

OnAcceptClientConnect 当收到一个客户端net连接时

func (*Base) OnConnectClose

func (gateBase *Base) OnConnectClose(client *connect.Client)

OnConnectClose 由Client调用,当Client关闭时触发

func (*Base) OnNewClient

func (gateBase *Base) OnNewClient(client *connect.Client)

OnNewClient 当新建一个Client对象时

func (*Base) OnRecvConnectMessage

func (gateBase *Base) OnRecvConnectMessage(client *connect.Client, msgbin *msg.MessageBinary)

OnRecvConnectMessage 由Client调用,当Client收到消息时

func (*Base) Range

func (gateBase *Base) Range(callback func(string, *connect.Client) bool)

Range 遍历所有连接到本模块的客户端

func (*Base) RangeRemove

func (gateBase *Base) RangeRemove(callback func(*connect.Client) bool)

RangeRemove 遍历所有的连接,检查需要移除的连接

Directories

Path Synopsis
Package base 网关的基本接口
Package base 网关的基本接口

Jump to

Keyboard shortcuts

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