Documentation ¶
Index ¶
- type Gateway
- func (gw *Gateway) Close()
- func (gw *Gateway) GetSendToAllClient() context.FuncTypeSendToAllClient
- func (gw *Gateway) GetSendToClient() context.FuncTypeSendToClient
- func (gw *Gateway) OnRecvFromClient(account string, cmd uint32, data []byte, flag uint8) (done bool)
- func (gw *Gateway) RegisterDecodeFunc(f context.FuncTypeDecode)
- func (gw *Gateway) RegisterEncodeFunc(f context.FuncTypeEncode)
- func (gw *Gateway) RegisterSendToAllClient(f context.FuncTypeSendToAllClient)
- func (gw *Gateway) RegisterSendToClient(f context.FuncTypeSendToClient)
- func (gw *Gateway) Start() bool
- func (gw *Gateway) VerifyToken(account, token string, clientSession context.IClientSesion) uint32
- type Session
- func (sess *Session) DoClose(sessbase *nodecommon.SessionBase)
- func (sess *Session) DoLose(msg *protocol.MSG_MGR_LOSE_SERVER)
- func (sess *Session) DoRecv(cmd uint64, data []byte, flag byte) (done bool)
- func (sess *Session) DoRegister(msg *protocol.MSG_MGR_REGISTER_SERVER)
- func (sess *Session) DoVerify(msg *protocol.MSG_MGR_REGISTER_SERVER)
- func (sess *Session) Init(root gocontext.Context, conn net.Conn, derived gotcp.ISession, ...)
- type User
- type UserMgr
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Gateway ¶
type Gateway struct { *nodecommon.Node // contains filtered or unexported fields }
Gateway : 网关节点
func (*Gateway) GetSendToAllClient ¶
func (gw *Gateway) GetSendToAllClient() context.FuncTypeSendToAllClient
GetSendToAllClient : 可自定义客户端交互协议
func (*Gateway) GetSendToClient ¶
func (gw *Gateway) GetSendToClient() context.FuncTypeSendToClient
GetSendToClient : 可自定义客户端交互协议
func (*Gateway) OnRecvFromClient ¶
func (gw *Gateway) OnRecvFromClient(account string, cmd uint32, data []byte, flag uint8) (done bool)
OnRecvFromClient : 可自定义客户端交互协议。data 格式需转化为框架层可理解的格式。done 为 true ,表示框架层接管处理该消息
func (*Gateway) RegisterDecodeFunc ¶
func (gw *Gateway) RegisterDecodeFunc(f context.FuncTypeDecode)
RegisterDecodeFunc : 可自定义加解密算法
func (*Gateway) RegisterEncodeFunc ¶
func (gw *Gateway) RegisterEncodeFunc(f context.FuncTypeEncode)
RegisterEncodeFunc : 可自定义加解密算法
func (*Gateway) RegisterSendToAllClient ¶
func (gw *Gateway) RegisterSendToAllClient(f context.FuncTypeSendToAllClient)
RegisterSendToAllClient : 可自定义客户端交互协议
func (*Gateway) RegisterSendToClient ¶
func (gw *Gateway) RegisterSendToClient(f context.FuncTypeSendToClient)
RegisterSendToClient : 可自定义客户端交互协议
func (*Gateway) VerifyToken ¶
func (gw *Gateway) VerifyToken(account, token string, clientSession context.IClientSesion) uint32
VerifyToken : 令牌验证。返回值: 0 成功;1 令牌错误; 2 系统错误
type Session ¶
type Session struct { *nodecommon.SessionBase // contains filtered or unexported fields }
Session : 网络会话类
func (*Session) DoClose ¶
func (sess *Session) DoClose(sessbase *nodecommon.SessionBase)
DoClose : 节点关闭时处理
func (*Session) DoLose ¶
func (sess *Session) DoLose(msg *protocol.MSG_MGR_LOSE_SERVER)
DoLose : 节点丢失时处理
func (*Session) DoRegister ¶
func (sess *Session) DoRegister(msg *protocol.MSG_MGR_REGISTER_SERVER)
DoRegister : 某节点注册时处理
func (*Session) DoVerify ¶
func (sess *Session) DoVerify(msg *protocol.MSG_MGR_REGISTER_SERVER)
DoVerify : 验证时保存自己的注册消息
type User ¶
type User struct { Account string Servers map[uint32]context.NodeID ActiveTimestamp int64 ClientSession context.IClientSesion }
User : 表示 1 个客户端对象
type UserMgr ¶
type UserMgr struct { ServerRedisCli go_redis_orm.IClient // contains filtered or unexported fields }
UserMgr : 客户端对象管理类
func NewUserMgr ¶
NewUserMgr : 客户端对象管理类构造函数
func (*UserMgr) AddUser ¶
func (userMgr *UserMgr) AddUser(account string, servers map[uint32]*protocol.SERVER_ID, clientSession context.IClientSesion) error
AddUser : 加入一个玩家
Click to show internal directories.
Click to hide internal directories.