Documentation ¶
Index ¶
- Constants
- func NewLocalSession(module IGateModule, data map[string]interface{}) (s core.IUserSession, err error)
- func NewRemoteSession(service base.IClusterService, data map[string]interface{}) (s core.IUserSession, err error)
- type AgentBase
- func (this *AgentBase) Destory()
- func (this *AgentBase) IP() string
- func (this *AgentBase) Id() string
- func (this *AgentBase) IsClosed() bool
- func (this *AgentBase) OnClose()
- func (this *AgentBase) OnCloseWait()
- func (this *AgentBase) OnInit(module IGateModule, coon IConn, agent IAgent) (err error)
- func (this *AgentBase) OnRecover(msg proto.IMessage)
- func (this *AgentBase) OnRun()
- func (this *AgentBase) RevNum() int64
- func (this *AgentBase) SendNum() int64
- func (this *AgentBase) WriteMsg(msg proto.IMessage) error
- type AgentMgrComp
- func (this *AgentMgrComp) Close(aId string) (result string, err string)
- func (this *AgentMgrComp) Connect(a IAgent)
- func (this *AgentMgrComp) Destroy() (err error)
- func (this *AgentMgrComp) DisConnect(a IAgent)
- func (this *AgentMgrComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, ...) (err error)
- func (this *AgentMgrComp) SendMsg(aId string, msg proto.IMessage) (result int, err string)
- type Gate
- func (this *Gate) CloseAgent(sId string) (result string, err string)
- func (this *Gate) Connect(a IAgent)
- func (this *Gate) DisConnect(a IAgent)
- func (this *Gate) OnRoute(a IAgent, msg proto.IMessage) (code int, err string)
- func (this *Gate) RegisterLocalRoute(comId uint16, ...)
- func (this *Gate) SendMsg(sId string, msg proto.IMessage) (result int, err string)
- func (this *Gate) UnRegisterLocalRoute(comId uint16, f func(session core.IUserSession, msg proto.IMessage))
- type IAgent
- type IConn
- type IGateModule
- type LocalRoute
- type LocalRouteMgrComp
- func (this *LocalRouteMgrComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, ...) (err error)
- func (this *LocalRouteMgrComp) OnRoute(agent IAgent, msg proto.IMessage) (code int, err string)
- func (this *LocalRouteMgrComp) RegisterRoute(comId uint16, ...)
- func (this *LocalRouteMgrComp) UnRegisterRoute(comId uint16, f func(session core.IUserSession, msg proto.IMessage))
- type LocalSession
- func (this *LocalSession) Close() (err error)
- func (this *LocalSession) GetGateId() string
- func (this *LocalSession) GetGateServerId() string
- func (this *LocalSession) GetIP() string
- func (this *LocalSession) GetSessionId() string
- func (this *LocalSession) SendMsg(comdId uint16, msgId uint16, msg interface{}) (err error)
- func (this *LocalSession) UpDateMap(data map[string]interface{}) (err error)
- type RemoteRoute
- type RemoteRouteMgrComp
- func (this *RemoteRouteMgrComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, ...) (err error)
- func (this *RemoteRouteMgrComp) OnRoute(agent IAgent, msg proto.IMessage) (code int, err string)
- func (this *RemoteRouteMgrComp) RegisterRoute(comId uint16, sId string) (result string, err string)
- func (this *RemoteRouteMgrComp) Start() (err error)
- func (this *RemoteRouteMgrComp) UnRegisterRoute(comId uint16, sId string)
- type RemoteSession
- func (this *RemoteSession) Close() (err error)
- func (this *RemoteSession) GetGateId() string
- func (this *RemoteSession) GetGateServerId() string
- func (this *RemoteSession) GetIP() string
- func (this *RemoteSession) GetSessionId() string
- func (this *RemoteSession) SendMsg(comdId uint16, msgId uint16, msg interface{}) (err error)
- func (this *RemoteSession) UpDateMap(data map[string]interface{}) (err error)
- type SessionData
- type TcpConn
- func (this *TcpConn) Close()
- func (this *TcpConn) Init(conn net.Conn)
- func (this *TcpConn) LocalAddr() net.Addr
- func (this *TcpConn) Read(b []byte) (int, error)
- func (this *TcpConn) RemoteAddr() net.Addr
- func (this *TcpConn) SetDeadline(t time.Time) error
- func (this *TcpConn) SetReadDeadline(t time.Time) error
- func (this *TcpConn) SetWriteDeadline(t time.Time) error
- func (this *TcpConn) Write(b []byte) (n int, err error)
- type TcpServerComp
- type WSHandler
- type WsConn
- func (this *WsConn) Close()
- func (this *WsConn) Init(conn *websocket.Conn)
- func (this *WsConn) LocalAddr() net.Addr
- func (this *WsConn) Read(p []byte) (int, error)
- func (this *WsConn) RemoteAddr() net.Addr
- func (this *WsConn) SetDeadline(t time.Time) error
- func (this *WsConn) SetReadDeadline(t time.Time) error
- func (this *WsConn) SetWriteDeadline(t time.Time) error
- func (this *WsConn) Write(b []byte) (n int, err error)
- type WsServerComp
Constants ¶
View Source
const ( Rpc_GateRouteRegister core.Rpc_Key = "GateRouteRegister" //网关路由注册 Rpc_GateRoute core.Rpc_Key = "GateRoute" //网关路由 Rpc_GateAgentsIsKeep core.Rpc_Key = "GateAgentsIsKeep" //校验代理是否还在 RPC_GateAgentBuild core.Rpc_Key = "GateAgentBuild" //代理绑定 RPC_GateAgentUnBuild core.Rpc_Key = "GateAgentUnBuild" //代理解绑 RPC_GateAgentSendMsg core.Rpc_Key = "GateAgentSendMsg" //代理发送消息 RPC_GateAgentClose core.Rpc_Key = "GateAgentClose" //代理关闭 )
Variables ¶
This section is empty.
Functions ¶
func NewLocalSession ¶
func NewLocalSession(module IGateModule, data map[string]interface{}) (s core.IUserSession, err error)
func NewRemoteSession ¶
func NewRemoteSession(service base.IClusterService, data map[string]interface{}) (s core.IUserSession, err error)
Types ¶
type AgentBase ¶
type AgentBase struct { Module IGateModule Agent IAgent Conn IConn Isclose bool // contains filtered or unexported fields }
远程链接代理
func (*AgentBase) OnCloseWait ¶
func (this *AgentBase) OnCloseWait()
type AgentMgrComp ¶
type AgentMgrComp struct { cbase.ModuleCompBase Agents *cont.BeeMap }
func (*AgentMgrComp) Close ¶
func (this *AgentMgrComp) Close(aId string) (result string, err string)
func (*AgentMgrComp) Connect ¶
func (this *AgentMgrComp) Connect(a IAgent)
func (*AgentMgrComp) Destroy ¶
func (this *AgentMgrComp) Destroy() (err error)
func (*AgentMgrComp) DisConnect ¶
func (this *AgentMgrComp) DisConnect(a IAgent)
type Gate ¶
type Gate struct {
cbase.ModuleBase
}
func (*Gate) CloseAgent ¶
主动关闭代理
func (*Gate) RegisterLocalRoute ¶
func (*Gate) UnRegisterLocalRoute ¶
type IAgent ¶
type IAgent interface { Id() string IP() string GetSessionData() map[string]interface{} OnInit(gate IGateModule, coon IConn, agent IAgent) (err error) WriteMsg(msg proto.IMessage) (err error) OnRecover(msg proto.IMessage) RevNum() int64 SendNum() int64 IsClosed() bool OnRun() OnClose() //主动关闭接口 OnCloseWait() //主动关闭接口 等待链接销毁 Destory() //关闭销毁 }
type IConn ¶
type IConn interface { Read(b []byte) (n int, err error) Write(b []byte) (n int, err error) RemoteAddr() net.Addr Close() }
func NewTcpConn ¶
type IGateModule ¶
type IGateModule interface { core.IModule //需重构处理 内部函数为重构代码 RegisterLocalRoute(comId uint16, f func(session core.IUserSession, msg proto.IMessage) (code int, err string)) UnRegisterLocalRoute(comId uint16, f func(session core.IUserSession, msg proto.IMessage)) OnRoute(a IAgent, msg proto.IMessage) (code int, err string) Connect(a IAgent) DisConnect(a IAgent) CloseAgent(sId string) (result string, err string) SendMsg(sId string, msg proto.IMessage) (result int, err string) }
type LocalRoute ¶
type LocalRoute struct { Module IGateModule ComId uint16 // contains filtered or unexported fields }
func NewLocalRoute ¶
func NewLocalRoute(module IGateModule, comId uint16, sf func(module IGateModule, data map[string]interface{}) (s core.IUserSession, err error), f func(session core.IUserSession, msg proto.IMessage) (code int, err string)) *LocalRoute
type LocalRouteMgrComp ¶
type LocalRouteMgrComp struct { cbase.ModuleCompBase NewSession func(module IGateModule, data map[string]interface{}) (s core.IUserSession, err error) // contains filtered or unexported fields }
func (*LocalRouteMgrComp) Init ¶
func (this *LocalRouteMgrComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, settings map[string]interface{}) (err error)
func (*LocalRouteMgrComp) RegisterRoute ¶
func (this *LocalRouteMgrComp) RegisterRoute(comId uint16, f func(session core.IUserSession, msg proto.IMessage) (code int, err string))
func (*LocalRouteMgrComp) UnRegisterRoute ¶
func (this *LocalRouteMgrComp) UnRegisterRoute(comId uint16, f func(session core.IUserSession, msg proto.IMessage))
type LocalSession ¶
type LocalSession struct {
// contains filtered or unexported fields
}
func (*LocalSession) Close ¶
func (this *LocalSession) Close() (err error)
func (*LocalSession) GetGateId ¶
func (this *LocalSession) GetGateId() string
func (*LocalSession) GetGateServerId ¶
func (this *LocalSession) GetGateServerId() string
func (*LocalSession) GetIP ¶
func (this *LocalSession) GetIP() string
func (*LocalSession) GetSessionId ¶
func (this *LocalSession) GetSessionId() string
func (*LocalSession) SendMsg ¶
func (this *LocalSession) SendMsg(comdId uint16, msgId uint16, msg interface{}) (err error)
func (*LocalSession) UpDateMap ¶
func (this *LocalSession) UpDateMap(data map[string]interface{}) (err error)
type RemoteRoute ¶
type RemoteRoute struct { Service base.IClusterService ComId uint16 ServiceType string // contains filtered or unexported fields }
func NewRemoteRoute ¶
func NewRemoteRoute(service base.IClusterService, comId uint16, f func(service base.IClusterService, data map[string]interface{}) (s core.IUserSession, err error), sNode registry.ServiceNode) *RemoteRoute
func (*RemoteRoute) Count ¶
func (this *RemoteRoute) Count() int32
func (*RemoteRoute) RegisterRoute ¶
func (this *RemoteRoute) RegisterRoute(sNode registry.ServiceNode) (err error)
注册远程路由
type RemoteRouteMgrComp ¶
type RemoteRouteMgrComp struct { cbase.ModuleCompBase NewSession func(service base.IClusterService, data map[string]interface{}) (s core.IUserSession, err error) // contains filtered or unexported fields }
func (*RemoteRouteMgrComp) Init ¶
func (this *RemoteRouteMgrComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, settings map[string]interface{}) (err error)
func (*RemoteRouteMgrComp) RegisterRoute ¶
func (this *RemoteRouteMgrComp) RegisterRoute(comId uint16, sId string) (result string, err string)
func (*RemoteRouteMgrComp) Start ¶
func (this *RemoteRouteMgrComp) Start() (err error)
func (*RemoteRouteMgrComp) UnRegisterRoute ¶
func (this *RemoteRouteMgrComp) UnRegisterRoute(comId uint16, sId string)
type RemoteSession ¶
type RemoteSession struct {
// contains filtered or unexported fields
}
func (*RemoteSession) Close ¶
func (this *RemoteSession) Close() (err error)
func (*RemoteSession) GetGateId ¶
func (this *RemoteSession) GetGateId() string
func (*RemoteSession) GetGateServerId ¶
func (this *RemoteSession) GetGateServerId() string
func (*RemoteSession) GetIP ¶
func (this *RemoteSession) GetIP() string
func (*RemoteSession) GetSessionId ¶
func (this *RemoteSession) GetSessionId() string
func (*RemoteSession) SendMsg ¶
func (this *RemoteSession) SendMsg(comdId uint16, msgId uint16, msg interface{}) (err error)
func (*RemoteSession) UpDateMap ¶
func (this *RemoteSession) UpDateMap(data map[string]interface{}) (err error)
type SessionData ¶
type TcpConn ¶
func (*TcpConn) RemoteAddr ¶
type TcpServerComp ¶
type TcpServerComp struct { cbase.ModuleCompBase NewTcpAgent func(gate IGateModule, coon IConn) (IAgent, error) // contains filtered or unexported fields }
func (*TcpServerComp) Destroy ¶
func (this *TcpServerComp) Destroy() (err error)
func (*TcpServerComp) Init ¶
func (this *TcpServerComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, settings map[string]interface{}) (err error)
func (*TcpServerComp) Start ¶
func (this *TcpServerComp) Start() (err error)
type WsConn ¶
type WsConn struct {
// contains filtered or unexported fields
}
func (*WsConn) RemoteAddr ¶
type WsServerComp ¶
type WsServerComp struct { cbase.ModuleCompBase CertFile string KeyFile string NewWsAgent func(gate IGateModule, coon IConn) (IAgent, error) // contains filtered or unexported fields }
func (*WsServerComp) Destroy ¶
func (this *WsServerComp) Destroy() (err error)
func (*WsServerComp) Init ¶
func (this *WsServerComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, settings map[string]interface{}) (err error)
func (*WsServerComp) Start ¶
func (this *WsServerComp) Start() (err error)
Click to show internal directories.
Click to hide internal directories.