Documentation ¶
Index ¶
- Variables
- func AddNodeAddrSpeed(addr nodeStore.AddressNet, speed time.Duration)
- func DelNodeAddrSpeed(addr nodeStore.AddressNet)
- func GetBytesForName(name string) []byte
- func GetNameForConn(conn net.Conn) (name string, err error)
- func InitSocks5Server()
- func Reclaim()
- func TryConn(AreaName [32]byte, srcNode *nodeStore.Node, nodeSelf *nodeStore.Node) bool
- func TryConnOld(AreaName [32]byte, srcNode *nodeStore.Node, nodeSelf *nodeStore.Node) bool
- func TryQuicConn(AreaName [32]byte, srcNode *nodeStore.Node, nodeSelf *nodeStore.Node) bool
- type AddrNetSpeedASC
- type AddrNetSpeedInfo
- type Area
- func (this *Area) AddAddrWhiteList(ip string, port uint16) (nodeStore.AddressNet, bool)
- func (this *Area) AddAddrWhiteListWithSessIndexBack(ip string, port uint16) (engine.Session, bool)
- func (this *Area) AddConnect(ip string, port uint16) (engine.Session, error)
- func (this *Area) AddWhiteList(addr nodeStore.AddressNet) bool
- func (this *Area) AskCloseConn_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) BroadcastsAll(msgid, p2pMsgid uint64, ...) error
- func (this *Area) CheckAutonomyFinish() (autoFinish bool)
- func (this *Area) CheckOnline() bool
- func (this *Area) CheckProxyClientIsOnline(nodeId *nodeStore.AddressNet, machineID string) bool
- func (this *Area) CheckRepeatHash(sendHash []byte) bool
- func (this *Area) CheckSupportQuicConn() bool
- func (this *Area) CheckSupportTcpConn() bool
- func (this *Area) CloseNet()
- func (this *Area) CloseVnode()
- func (this *Area) DelSelfVnodeByAddress(addr nodeStore.AddressNet)
- func (this *Area) DelVnodeInSelf(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) Destroy()
- func (this *Area) DestroyByGlobal(global *global.Global)
- func (this *Area) GetAddrProxy(recvid *nodeStore.AddressNet, recvMachineId string) (res []*proxyrec.ProxyInfo, err error)
- func (this *Area) GetIdInfo() nodeStore.IdInfo
- func (this *Area) GetLevelDB() *utilsleveldb.LevelDB
- func (this *Area) GetMachineID() string
- func (this *Area) GetNearConnectVnode(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) GetNearConnectVnode_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) GetNearSuperAddr(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) GetNearSuperAddr_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) GetNetId() nodeStore.AddressNet
- func (this *Area) GetNetworkInfo() *[]nodeStore.AddressNet
- func (this *Area) GetNodeMachineID(recvid *nodeStore.AddressNet) string
- func (this *Area) GetNodeManager() *nodeStore.NodeManager
- func (this *Area) GetNodeSelf() nodeStore.Node
- func (this *Area) GetVnodeId() virtual_node.AddressNetExtend
- func (this *Area) MulticastOffline_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) MulticastOnline_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) MulticastSendVnode_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) MulticastVnodeOffline_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) OpenVnode()
- func (this *Area) ReconnectNet() bool
- func (this *Area) RegisterCoreMsg()
- func (this *Area) Register_multicast(msgid uint64, handler message_center.MsgHandler)
- func (this *Area) Register_neighbor(msgid uint64, handler message_center.MsgHandler)
- func (this *Area) Register_nodeBeenGodAddrCallback(handler NodeEventCallbackHandler)
- func (this *Area) Register_nodeClosedCallback(handler NodeEventCallbackHandler)
- func (this *Area) Register_nodeNewConnCallback(handler NodeEventCallbackHandler)
- func (this *Area) Register_p2p(msgid uint64, handler message_center.MsgHandler)
- func (this *Area) Register_p2pHE(msgid uint64, handler message_center.MsgHandler)
- func (this *Area) Register_search_all(msgid uint64, handler message_center.MsgHandler)
- func (this *Area) Register_search_super(msgid uint64, handler message_center.MsgHandler)
- func (this *Area) Register_vnode_p2pHE(msgid uint64, handler message_center.MsgHandler)
- func (this *Area) Register_vnode_search(msgid uint64, handler message_center.MsgHandler)
- func (this *Area) RemoveWhiteList(addr nodeStore.AddressNet) bool
- func (this *Area) ResetAutonomyFinish()
- func (this *Area) SearchNetAddr(nodeId *nodeStore.AddressNet) (*nodeStore.AddressNet, error)
- func (this *Area) SearchNetAddrAuto(nodeId *nodeStore.AddressNet) (*nodeStore.AddressNet, error)
- func (this *Area) SearchNetAddrOneByOne(nodeId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
- func (this *Area) SearchNetAddrOneByOneAuto(nodeId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
- func (this *Area) SearchNetAddrOneByOneProxy(nodeId, recvProxyId, senderProxyId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
- func (this *Area) SearchNetAddrProxy(nodeId, recvProxyId, senderProxyId *nodeStore.AddressNet) (*nodeStore.AddressNet, error)
- func (this *Area) SearchNetAddrVnode(nodeId *virtual_node.AddressNetExtend) (*virtual_node.AddressNetExtend, error)
- func (this *Area) SearchNetAddrVnodeAuto(nodeId *virtual_node.AddressNetExtend) (*virtual_node.AddressNetExtend, error)
- func (this *Area) SearchNetAddrVnodeProxy(nodeId *virtual_node.AddressNetExtend, ...) (*virtual_node.AddressNetExtend, error)
- func (this *Area) SearchNetAddrWithNum(nodeId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
- func (this *Area) SearchNetAddrWithNumAuto(nodeId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
- func (this *Area) SearchNetAddrWithNumProxy(nodeId, recvProxyId, senderProxyId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
- func (this *Area) SearchNode(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) SearchNode_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
- func (this *Area) SearchVnodeId(vnodeid *virtual_node.AddressNetExtend) (*virtual_node.AddressNetExtend, error)
- func (this *Area) SearchVnodeIdAuto(vnodeid *virtual_node.AddressNetExtend) (*virtual_node.AddressNetExtend, error)
- func (this *Area) SearchVnodeIdOnebyone(vnodeid *virtual_node.AddressNetExtend, num uint16) ([]virtual_node.Vnodeinfo, error)
- func (this *Area) SearchVnodeIdOnebyoneAuto(vnodeid *virtual_node.AddressNetExtend, num uint16) ([]virtual_node.Vnodeinfo, error)
- func (this *Area) SearchVnodeIdOnebyoneProxy(vnodeid *virtual_node.AddressNetExtend, ...) ([]virtual_node.Vnodeinfo, error)
- func (this *Area) SearchVnodeIdProxy(vnodeid *virtual_node.AddressNetExtend, ...) (*virtual_node.AddressNetExtend, error)
- func (this *Area) SendMulticastMsg(msgid uint64, content *[]byte) error
- func (this *Area) SendNearLogicSuperIP(c context.Context)
- func (this *Area) SendNeighborMsg(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
- func (this *Area) SendNeighborMsgWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, ...) (*[]byte, error)
- func (this *Area) SendNeighborReplyMsg(message *message_center.Message, msgid uint64, content *[]byte, ...) error
- func (this *Area) SendP2pMsg(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, bool, bool, error)
- func (this *Area) SendP2pMsgAuto(msgid uint64, recvid *nodeStore.AddressNet, machineID string, content *[]byte, ...) (res []*ResMsgErr)
- func (this *Area) SendP2pMsgAutoWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, machineID string, content *[]byte, ...) (res []*ResBsErr)
- func (this *Area) SendP2pMsgEX(msgid uint64, recvid, recvSuperId *nodeStore.AddressNet, content *[]byte, ...) (*message_center.Message, error)
- func (this *Area) SendP2pMsgHE(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, bool, bool, error)
- func (this *Area) SendP2pMsgHEAuto(msgid uint64, recvid *nodeStore.AddressNet, machineID string, content *[]byte, ...) (res []*ResMsgErr)
- func (this *Area) SendP2pMsgHEAutoWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, machineID string, content *[]byte, ...) (res []*ResBsErr)
- func (this *Area) SendP2pMsgHEProxy(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*message_center.Message, bool, bool, error)
- func (this *Area) SendP2pMsgHEProxyMachineID(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*message_center.Message, bool, bool, error)
- func (this *Area) SendP2pMsgHEProxyMachineIDWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*[]byte, bool, bool, error)
- func (this *Area) SendP2pMsgHEProxyWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*[]byte, bool, bool, error)
- func (this *Area) SendP2pMsgHEWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, ...) (*[]byte, bool, bool, error)
- func (this *Area) SendP2pMsgProxy(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*message_center.Message, bool, bool, error)
- func (this *Area) SendP2pMsgProxyMachineID(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*message_center.Message, bool, bool, error)
- func (this *Area) SendP2pMsgProxyMachineIDWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*[]byte, bool, bool, error)
- func (this *Area) SendP2pMsgProxyWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*[]byte, bool, bool, error)
- func (this *Area) SendP2pMsgWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, ...) (*[]byte, bool, bool, error)
- func (this *Area) SendP2pReplyMsg(message *message_center.Message, msgid uint64, content *[]byte) error
- func (this *Area) SendP2pReplyMsgHE(message *message_center.Message, msgid uint64, content *[]byte) error
- func (this *Area) SendP2pReplyMsgHEProxy(message *message_center.Message, msgid uint64, content *[]byte, ...) error
- func (this *Area) SendP2pReplyMsgProxy(message *message_center.Message, msgid uint64, content *[]byte, ...) error
- func (this *Area) SendSearchAllMsg(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
- func (this *Area) SendSearchAllReplyMsg(message *message_center.Message, msgid uint64, content *[]byte) error
- func (this *Area) SendSearchSuperMsg(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
- func (this *Area) SendSearchSuperMsgAuto(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
- func (this *Area) SendSearchSuperMsgAutoWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, ...) (*[]byte, error)
- func (this *Area) SendSearchSuperMsgProxy(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*message_center.Message, error)
- func (this *Area) SendSearchSuperMsgProxyWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, ...) (*[]byte, error)
- func (this *Area) SendSearchSuperMsgWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, ...) (*[]byte, error)
- func (this *Area) SendSearchSuperReplyMsg(message *message_center.Message, msgid uint64, content *[]byte) error
- func (this *Area) SendSearchSuperReplyMsgProxy(message *message_center.Message, msgid uint64, content *[]byte, ...) error
- func (this *Area) SendVnodeP2pMsgHE(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*message_center.Message, error)
- func (this *Area) SendVnodeP2pMsgHEAuto(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (res []*ResSimpleMsgErr)
- func (this *Area) SendVnodeP2pMsgHEAutoWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (res []*ResSimpleBsErr)
- func (this *Area) SendVnodeP2pMsgHEProxy(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*message_center.Message, error)
- func (this *Area) SendVnodeP2pMsgHEProxyWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*[]byte, error)
- func (this *Area) SendVnodeP2pMsgHEWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*[]byte, error)
- func (this *Area) SendVnodeP2pReplyMsgHE(message *message_center.Message, msgid uint64, content *[]byte) error
- func (this *Area) SendVnodeSearchMsg(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*message_center.Message, error)
- func (this *Area) SendVnodeSearchMsgAuto(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*message_center.Message, error)
- func (this *Area) SendVnodeSearchMsgAutoWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*[]byte, error)
- func (this *Area) SendVnodeSearchMsgProxy(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*message_center.Message, error)
- func (this *Area) SendVnodeSearchMsgProxyWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*[]byte, error)
- func (this *Area) SendVnodeSearchMsgWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, ...) (*[]byte, error)
- func (this *Area) SendVnodeSearchReplyMsg(message *message_center.Message, msgid uint64, content *[]byte) error
- func (this *Area) SetAreaGodAddr(ip string, port int) (bool, string)
- func (this *Area) SetAreaGodAddrWithConnRes(ip string, port int) (bool, string, bool)
- func (this *Area) SetDiscoverPeer(hosts ...string)
- func (this *Area) SetLeveldbPath(dbpath string)
- func (this *Area) SetMachineID(machineID string) bool
- func (this *Area) SetNetTypeToTest()
- func (this *Area) SetP2pConnType(connType string) bool
- func (this *Area) SetPhoneNode()
- func (this *Area) ShutdownCallback()
- func (this *Area) StartEngine() bool
- func (this *Area) StartGlobalEngine(global *global.Global) bool
- func (this *Area) StartUP(isFirst bool, addr string, port uint16) error
- func (this *Area) StartUPGlobal(isFirst bool, global *global.Global, addr string, port uint16) error
- func (this *Area) WaitAutonomyFinish()
- func (this *Area) WaitAutonomyFinishVnode()
- type AreaManager
- type Auth
- func (this *Auth) GetAreaName() (areaName string)
- func (this *Auth) RecvKey(conn net.Conn, name string) (remoteName, machineID string, setGodTime int64, params interface{}, ...)
- func (this *Auth) RecvQuicKey(conn quic.Connection, stream quic.Stream, name string) (remoteName, machineID string, setGodTime int64, params interface{}, ...)
- func (this *Auth) SendKey(conn net.Conn, session engine.Session, name string, setGodAddr bool) (remoteName, machineID string, setGodTime int64, params interface{}, ...)
- func (this *Auth) SendQuicKey(conn quic.Connection, stream quic.Stream, session engine.Session, name string, ...) (remoteName, machineID string, setGodTime int64, params interface{}, ...)
- type Config
- type MessageVO
- type NodeEventCallbackHandler
- type ResBsErr
- type ResMsgErr
- type ResSimpleBsErr
- type ResSimpleMsgErr
Constants ¶
This section is empty.
Variables ¶
var ( Path_configDir = "conf" //配置文件存放目录 Core_keystore = "keystore.key" //密钥文件 )
var CommitInfo string
Functions ¶
func AddNodeAddrSpeed ¶
func AddNodeAddrSpeed(addr nodeStore.AddressNet, speed time.Duration)
添加保存一个节点超时时间
func DelNodeAddrSpeed ¶
func DelNodeAddrSpeed(addr nodeStore.AddressNet)
func GetNameForConn ¶
通过读连接中的bytes获取name字符串
func InitSocks5Server ¶
func InitSocks5Server()
func TryConnOld ¶
尝试去连接一个ip地址,判断对方是否是超级节点
Types ¶
type AddrNetSpeedASC ¶
type AddrNetSpeedASC struct {
// contains filtered or unexported fields
}
网络地址同步速度排序算法 超时时间从小到大排序
func NewAddrNetSpeedASC ¶
func NewAddrNetSpeedASC(addrs []nodeStore.AddressNet) *AddrNetSpeedASC
创建一个网络地址同步速度排序算法 不能有重复地址
func (AddrNetSpeedASC) Len ¶
func (this AddrNetSpeedASC) Len() int
func (AddrNetSpeedASC) Less ¶
func (this AddrNetSpeedASC) Less(i, j int) bool
func (AddrNetSpeedASC) Sort ¶
func (this AddrNetSpeedASC) Sort() []AddrNetSpeedInfo
func (AddrNetSpeedASC) Swap ¶
func (this AddrNetSpeedASC) Swap(i, j int)
type AddrNetSpeedInfo ¶
type AddrNetSpeedInfo struct { AddrNet nodeStore.AddressNet Speed int64 }
func SortNetAddrForSpeed ¶
func SortNetAddrForSpeed(netAddrs []nodeStore.AddressNet) []AddrNetSpeedInfo
通过同步节点速度排序节点地址
type Area ¶
type Area struct { AreaName [32]byte //域网络名称 Keystore keystore.KeystoreInterface // Pwd string //密码 NodeManager *nodeStore.NodeManager // MessageCenter *message_center.MessageCenter // SessionEngine *engine.Engine //消息引擎 Vm *virtual_node.VnodeManager // Vc *manager.VnodeCenter // GetNearSuperAddr_recvLock *sync.Mutex // GodHost string // 上帝节点地址 GodID *nodeStore.AddressNet // 上帝节点Id ProxyData *proxyrec.ProxyData // 代理节点记录信息 ProxyDetail *proxyrec.ProxyDetailInfo // 代理详情信息 ProxyCache *proxyrec.ProxyCache // 代理缓存信息 // contains filtered or unexported fields }
func NewAreaByGlobal ¶
func NewAreaByGlobal(areaName [32]byte, key keystore.KeystoreInterface, pwd string, global *global.Global) (*Area, error)
* NewAreaByGlobal 根据大区创建区域信息 * * @param areaName []byte 大区名称 * @param key keystore keystore * @param pwd string 密码 * @param global *Global 大区信息 * @return area *Area 生成的大区 * @return err error 错误信息
func (*Area) AddAddrWhiteList ¶
* 根据目标ip地址及端口添加到白名单
func (*Area) AddAddrWhiteListWithSessIndexBack ¶
* 根据目标ip地址及端口添加到白名单 * @auth qlw * @param ip string IP地址 * @param port uint16 端口 * @return sess uint64 session连接信息 * @return success bool 是否添加成功标识
func (*Area) AddConnect ¶
添加一个连接
func (*Area) AddWhiteList ¶
func (this *Area) AddWhiteList(addr nodeStore.AddressNet) bool
添加一个地址到白名单
func (*Area) AskCloseConn_recv ¶
func (this *Area) AskCloseConn_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
询问关闭这个链接 当双方都没有这个链接的引用时,就关闭这个链接
func (*Area) BroadcastsAll ¶
func (*Area) CheckAutonomyFinish ¶
* 检查网络自治是否已经完成
func (*Area) CheckProxyClientIsOnline ¶
func (this *Area) CheckProxyClientIsOnline(nodeId *nodeStore.AddressNet, machineID string) bool
* 检查被代理的客户端是否在线 * * @param recvid addressnet 接收者节点id * @param machineID string 接收方的机器id, 如果传入空串, 将发送给地址对应所有machineid的节点 * @return isOnline bool 是否在线
func (*Area) DelSelfVnodeByAddress ¶
func (this *Area) DelSelfVnodeByAddress(addr nodeStore.AddressNet)
*删除本节点虚拟节点
func (*Area) DelVnodeInSelf ¶
func (this *Area) DelVnodeInSelf(c engine.Controller, msg engine.Packet, message *message_center.Message)
* 接受处理其他节点消息,删除本节点up down排序中虚拟节点
func (*Area) DestroyByGlobal ¶
销毁 关闭连接,停止服务器,清理所有协程
func (*Area) GetAddrProxy ¶
func (this *Area) GetAddrProxy(recvid *nodeStore.AddressNet, recvMachineId string) (res []*proxyrec.ProxyInfo, err error)
* 获取指定地址和机器id的代理信息 * * @param recvid addressnet 接收者节点id * @param recvMachineId string 接收方机器Id, 如果传入空串, 将获取地址对应所有machineid的客户端地址 * @return proxyInfoes []ProxyInfo 代理信息数组 * @return err error 错误信息
func (*Area) GetMachineID ¶
* 获取本节点的机器id * * @return machineID string 机器id
func (*Area) GetNearConnectVnode ¶
func (this *Area) GetNearConnectVnode(c engine.Controller, msg engine.Packet, message *message_center.Message)
func (*Area) GetNearConnectVnode_recv ¶
func (this *Area) GetNearConnectVnode_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
func (*Area) GetNearSuperAddr ¶
func (this *Area) GetNearSuperAddr(c engine.Controller, msg engine.Packet, message *message_center.Message)
获取相邻节点的超级节点地址
func (*Area) GetNearSuperAddr_recv ¶
func (this *Area) GetNearSuperAddr_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
获取相邻节点的超级节点地址返回
func (*Area) GetNodeMachineID ¶
func (this *Area) GetNodeMachineID(recvid *nodeStore.AddressNet) string
* 获取指定节点的机器id * * @return machineID string 目标的机器id
func (*Area) MulticastOffline_recv ¶
func (this *Area) MulticastOffline_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
* 接收真实节点下线的广播
func (*Area) MulticastOnline_recv ¶
func (this *Area) MulticastOnline_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
接收上线的广播
func (*Area) MulticastSendVnode_recv ¶
func (this *Area) MulticastSendVnode_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
* 接收真实节点所有虚拟节点信息的广播 * * @author: qlw
func (*Area) MulticastVnodeOffline_recv ¶
func (this *Area) MulticastVnodeOffline_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
* 接收虚拟节点下线的广播
func (*Area) RegisterCoreMsg ¶
func (this *Area) RegisterCoreMsg()
func (*Area) Register_multicast ¶
func (this *Area) Register_multicast(msgid uint64, handler message_center.MsgHandler)
注册广播消息
func (*Area) Register_neighbor ¶
func (this *Area) Register_neighbor(msgid uint64, handler message_center.MsgHandler)
注册邻居节点消息,不转发
func (*Area) Register_nodeBeenGodAddrCallback ¶
func (this *Area) Register_nodeBeenGodAddrCallback(handler NodeEventCallbackHandler)
* 注册节点被设置为超级代理节点地址回调函数
func (*Area) Register_nodeClosedCallback ¶
func (this *Area) Register_nodeClosedCallback(handler NodeEventCallbackHandler)
* 注册节点关闭连接回调函数
func (*Area) Register_nodeNewConnCallback ¶
func (this *Area) Register_nodeNewConnCallback(handler NodeEventCallbackHandler)
* 注册节点新建连接回调函数
func (*Area) Register_p2p ¶
func (this *Area) Register_p2p(msgid uint64, handler message_center.MsgHandler)
注册点对点通信消息
func (*Area) Register_p2pHE ¶
func (this *Area) Register_p2pHE(msgid uint64, handler message_center.MsgHandler)
注册点对点通信消息
func (*Area) Register_search_all ¶
func (this *Area) Register_search_all(msgid uint64, handler message_center.MsgHandler)
注册消息 从所有节点中搜索节点,包括普通节点
func (*Area) Register_search_super ¶
func (this *Area) Register_search_super(msgid uint64, handler message_center.MsgHandler)
注册消息 从超级节点中搜索目标节点
func (*Area) Register_vnode_p2pHE ¶
func (this *Area) Register_vnode_p2pHE(msgid uint64, handler message_center.MsgHandler)
注册虚拟节点之间点对点加密消息
func (*Area) Register_vnode_search ¶
func (this *Area) Register_vnode_search(msgid uint64, handler message_center.MsgHandler)
注册虚拟节点搜索节点消息
func (*Area) RemoveWhiteList ¶
func (this *Area) RemoveWhiteList(addr nodeStore.AddressNet) bool
删除一个地址到白名单
func (*Area) SearchNetAddr ¶
func (this *Area) SearchNetAddr(nodeId *nodeStore.AddressNet) (*nodeStore.AddressNet, error)
搜索磁力节点网络地址
func (*Area) SearchNetAddrAuto ¶
func (this *Area) SearchNetAddrAuto(nodeId *nodeStore.AddressNet) (*nodeStore.AddressNet, error)
* 搜索磁力节点网络地址, 自动处理代理信息 * * @param nodeId *AddressNet 磁力地址 * @return nodeId *AddressNet 搜索到的磁力地址 * @return err error 错误信息
func (*Area) SearchNetAddrOneByOne ¶
func (this *Area) SearchNetAddrOneByOne(nodeId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
搜索磁力节点网络地址
func (*Area) SearchNetAddrOneByOneAuto ¶
func (this *Area) SearchNetAddrOneByOneAuto(nodeId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
* 搜索磁力节点网络地址, 自动处理代理信息 * * @param nodeId *AddressNetExtend 磁力地址 * @param num uint16 返回的最大数量 * @return nodeIds []AddressNet 搜索到的磁力地址列表 * @return err error 错误信息
func (*Area) SearchNetAddrOneByOneProxy ¶
func (this *Area) SearchNetAddrOneByOneProxy(nodeId, recvProxyId, senderProxyId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
搜索磁力节点网络地址
func (*Area) SearchNetAddrProxy ¶
func (this *Area) SearchNetAddrProxy(nodeId, recvProxyId, senderProxyId *nodeStore.AddressNet) (*nodeStore.AddressNet, error)
* 搜索磁力节点网络地址,可以指定发送端的代理节点
func (*Area) SearchNetAddrVnode ¶
func (this *Area) SearchNetAddrVnode(nodeId *virtual_node.AddressNetExtend) (*virtual_node.AddressNetExtend, error)
* 搜索磁力虚拟节点网络地址 * TODO zyz 优化使用细节
func (*Area) SearchNetAddrVnodeAuto ¶
func (this *Area) SearchNetAddrVnodeAuto(nodeId *virtual_node.AddressNetExtend) (*virtual_node.AddressNetExtend, error)
* 搜索磁力虚拟节点网络地址, 自动处理代理信息 * * @param nodeId *AddressNetExtend 磁力地址 * @return vnodeId *AddressNetExtend 搜索到的磁力地址 * @return err error 错误信息
func (*Area) SearchNetAddrVnodeProxy ¶
func (this *Area) SearchNetAddrVnodeProxy(nodeId *virtual_node.AddressNetExtend, recvProxyId, senderProxyId *nodeStore.AddressNet) (*virtual_node.AddressNetExtend, error)
* 搜索磁力虚拟节点网络地址,可以指定接收端和发送端的代理节点 * TODO zyz 优化使用细节
func (*Area) SearchNetAddrWithNum ¶
func (this *Area) SearchNetAddrWithNum(nodeId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
* 搜索磁力节点网络地址, 指定返回的数量地址 * * @param nodeId AddressNet 磁力地址 * @param num uint16 返回的数量 * @return addrs []*AddressNet 地址数组 * @return err error 错误信息
func (*Area) SearchNetAddrWithNumAuto ¶
func (this *Area) SearchNetAddrWithNumAuto(nodeId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
* 搜索磁力节点网络地址, 指定返回的数量地址, 自动处理代理信息 * * @param nodeId *AddressNet 磁力地址 * @param num uint16 返回的数量 * @return nodeIds []AddressNet 搜索到的磁力地址列表 * @return err error 错误信息
func (*Area) SearchNetAddrWithNumProxy ¶
func (this *Area) SearchNetAddrWithNumProxy(nodeId, recvProxyId, senderProxyId *nodeStore.AddressNet, num uint16) ([]nodeStore.AddressNet, error)
* 搜索磁力节点网络地址, 指定返回的数量地址 * * @param nodeId AddressNet 磁力地址 * @param num uint16 返回的数量 * @return addrs []*AddressNet 地址数组 * @return err error 错误信息
func (*Area) SearchNode ¶
func (this *Area) SearchNode(c engine.Controller, msg engine.Packet, message *message_center.Message)
查询一个节点是否在线
func (*Area) SearchNode_recv ¶
func (this *Area) SearchNode_recv(c engine.Controller, msg engine.Packet, message *message_center.Message)
func (*Area) SearchVnodeId ¶
func (this *Area) SearchVnodeId(vnodeid *virtual_node.AddressNetExtend) (*virtual_node.AddressNetExtend, error)
网络中查询一个逻辑节点地址的真实地址
func (*Area) SearchVnodeIdAuto ¶
func (this *Area) SearchVnodeIdAuto(vnodeid *virtual_node.AddressNetExtend) (*virtual_node.AddressNetExtend, error)
* 根据磁力地址查询匹配的一个虚拟地址, 自动处理代理信息 * * @param vnodeId *AddressNetExtend 虚拟磁力地址 * @return vs *AddressNetExtend 获取到的虚拟地址 * @return err error 错误信息
func (*Area) SearchVnodeIdOnebyone ¶
func (this *Area) SearchVnodeIdOnebyone(vnodeid *virtual_node.AddressNetExtend, num uint16) ([]virtual_node.Vnodeinfo, error)
func (*Area) SearchVnodeIdOnebyoneAuto ¶
func (this *Area) SearchVnodeIdOnebyoneAuto(vnodeid *virtual_node.AddressNetExtend, num uint16) ([]virtual_node.Vnodeinfo, error)
* 根据磁力地址查询匹配的虚拟地址列表, 自动处理代理信息 * * @param vnodeId *AddressNetExtend 虚拟磁力地址 * @param num uint16 需要返回的最大数量 * @return vs []VnodeInfo 获取到的虚拟地址信息数组 * @return err error 错误信息
func (*Area) SearchVnodeIdOnebyoneProxy ¶
func (this *Area) SearchVnodeIdOnebyoneProxy(vnodeid *virtual_node.AddressNetExtend, recvProxyId, senderProxyId *nodeStore.AddressNet, num uint16) ([]virtual_node.Vnodeinfo, error)
* 根据磁力地址查询匹配的虚拟地址列表,可以指定接收端和发送端的代理节点 * * @param vnodeId *AddressNetExtend 虚拟磁力地址 * @param recvProxyId *Addressnet 接收者代理节点id * @param senderProxyId *Addressnet 发送者代理节点id * @param num uint16 需要返回的最大数量 * @return vs []VnodeInfo 获取到的虚拟地址信息数组 * @return err error 错误信息
func (*Area) SearchVnodeIdProxy ¶
func (this *Area) SearchVnodeIdProxy(vnodeid *virtual_node.AddressNetExtend, recvProxyId, senderProxyId *nodeStore.AddressNet) (*virtual_node.AddressNetExtend, error)
* 根据磁力地址查询匹配的一个虚拟地址,可以指定接收端和发送端的代理节点 * * @param vnodeId *AddressNetExtend 虚拟磁力地址 * @param recvProxyId *Addressnet 接收者代理节点id * @param senderProxyId *Addressnet 发送者代理节点id * @return vs *AddressNetExtend 获取到的虚拟地址 * @return err error 错误信息
func (*Area) SendMulticastMsg ¶
发送一个新的广播消息
func (*Area) SendNearLogicSuperIP ¶
通过事件驱动,给邻居节点推送对方需要的逻辑节点
func (*Area) SendNeighborMsg ¶
func (this *Area) SendNeighborMsg(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
发送一个新邻居节点消息 @return bool 消息是否发送成功
func (*Area) SendNeighborMsgWaitRequest ¶
func (this *Area) SendNeighborMsgWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, error)
发送一个新邻居节点消息 发送出去,等返回
func (*Area) SendNeighborReplyMsg ¶
func (this *Area) SendNeighborReplyMsg(message *message_center.Message, msgid uint64, content *[]byte, session engine.Session) error
对某个消息回复
func (*Area) SendP2pMsg ¶
func (this *Area) SendP2pMsg(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, bool, bool, error)
发送一个新消息 @return *Message 返回的消息 @return bool 是否发送成功 @return bool 消息是发给自己
func (*Area) SendP2pMsgAuto ¶
func (this *Area) SendP2pMsgAuto(msgid uint64, recvid *nodeStore.AddressNet, machineID string, content *[]byte, isSuperRecv bool) (res []*ResMsgErr)
* 发送一个P2p消息, 自动处理代理信息 * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param machineID string 接收方的机器id, 如果传入空串, 将发送给地址对应所有machineid的节点 * @param content []byte 发送内容 * @param isSuperRecv bool 接收者是不是超级节点, true: 不会搜索它的代理节点, false: 自动搜索接收方的代理节点 * @return res []*ResMsgErr 发送的结果列表
func (*Area) SendP2pMsgAutoWaitRequest ¶
func (this *Area) SendP2pMsgAutoWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, machineID string, content *[]byte, timeout time.Duration, isSuperRecv bool) (res []*ResBsErr)
* 给指定节点发送一个消息, 自动处理代理信息 * * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param machineID string 接收方的机器id, 如果传入空串, 将发送给地址对应所有machineid的节点 * @param content []byte 发送内容 * @param timeout Duration 超时时间 * @param isSuperRecv bool 接收者是不是超级节点, true: 不会搜索它的代理节点, false: 自动搜索接收方的代理节点 * @return res []*ResBsErr 发送的结果列表
func (*Area) SendP2pMsgEX ¶
func (this *Area) SendP2pMsgEX(msgid uint64, recvid, recvSuperId *nodeStore.AddressNet, content *[]byte, hash *[]byte) (*message_center.Message, error)
发送一个新消息 是SendP2pMsg方法的定制版本,多了recvSuperId参数。
func (*Area) SendP2pMsgHE ¶
func (this *Area) SendP2pMsgHE(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, bool, bool, error)
发送一个加密消息,包括消息头也加密 @return *Message 返回的消息 @return bool 是否发送成功 @return bool 消息是发给自己
func (*Area) SendP2pMsgHEAuto ¶
func (this *Area) SendP2pMsgHEAuto(msgid uint64, recvid *nodeStore.AddressNet, machineID string, content *[]byte, isSuperRecv bool) (res []*ResMsgErr)
* 发送一个加密消息,包括消息头也加密, 自动处理代理信息 * * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param machineID string 接收方的机器id, 如果传入空串, 将发送给地址对应所有machineid的节点 * @param content []byte 发送内容 * @param isSuperRecv bool 接收者是不是超级节点, true: 不会搜索它的代理节点, false: 自动搜索接收方的代理节点 * @return res []*ResMsgErr 发送的结果列表
func (*Area) SendP2pMsgHEAutoWaitRequest ¶
func (this *Area) SendP2pMsgHEAutoWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, machineID string, content *[]byte, timeout time.Duration, isSuperRecv bool) (res []*ResBsErr)
* 发送一个加密消息,包括消息头也加密, 自动处理代理信息 * * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param machineID string 接收方的机器id, 如果传入空串, 将发送给地址对应所有machineid的节点 * @param content []byte 发送内容 * @param timeout Duration 超时时间 * @param isSuperRecv bool 接收者是不是超级节点, true: 不会搜索它的代理节点, false: 自动搜索接收方的代理节点 * @return res []*ResBsErr 发送的结果列表
func (*Area) SendP2pMsgHEProxy ¶
func (this *Area) SendP2pMsgHEProxy(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, content *[]byte) (*message_center.Message, bool, bool, error)
* 发送一个加密消息,包括消息头也加密,可以指定接收端和发送端的代理节点 * @msgid uint64 消息号 * @recvid addressnet 接收者节点id * @recvProxyId addressnet 接收者代理节点id * @senderProxyId addressnet 发送者代理节点id * @content []byte 发送内容 * @return *Message 返回的消息 * @return bool 是否发送成功 * @return bool 消息是发给自己
func (*Area) SendP2pMsgHEProxyMachineID ¶
func (this *Area) SendP2pMsgHEProxyMachineID(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, recvMachineId string, content *[]byte) (*message_center.Message, bool, bool, error)
* 发送一个加密消息,包括消息头也加密,可以指定接收端、发送端的代理节点和接收方机器id * * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param recvProxyId addressnet 接收者代理节点id * @param senderProxyId addressnet 发送者代理节点id * @param recvMachineId string 接收方机器Id * @param content []byte 发送内容 * @return msg *Message 返回的消息 * @return sendSuccess bool 是否发送成功 * @return toSelf bool 消息是发给自己
func (*Area) SendP2pMsgHEProxyMachineIDWaitRequest ¶
func (this *Area) SendP2pMsgHEProxyMachineIDWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, recvMachineId string, content *[]byte, timeout time.Duration) (*[]byte, bool, bool, error)
* 发送一个加密消息,包括消息头也加密,可以指定接收端、发送端的代理节点和接收方机器id * * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param recvProxyId addressnet 接收者代理节点id * @param senderProxyId addressnet 发送者代理节点id * @param recvMachineId string 接收方机器Id * @param content []byte 发送内容 * @param timeout Duration 超时时间 * @return msg *Message 返回的消息 * @return sendSuccess bool 是否发送成功 * @return toSelf bool 消息是发给自己
func (*Area) SendP2pMsgHEProxyWaitRequest ¶
func (this *Area) SendP2pMsgHEProxyWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, bool, bool, error)
* 发送一个加密消息,包括消息头也加密,可以指定接收端和发送端的代理节点 * @msgid uint64 消息号 * @recvid addressnet 接收者节点id * @recvProxyId addressnet 接收者代理节点id * @senderProxyId addressnet 发送者代理节点id * @content []byte 发送内容 * @return *Message 返回的消息 * @return bool 是否发送成功 * @return bool 消息是发给自己
func (*Area) SendP2pMsgHEWaitRequest ¶
func (this *Area) SendP2pMsgHEWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, bool, bool, error)
发送一个加密消息,包括消息头也加密 @return *Message 返回的消息 @return bool 是否发送成功 @return bool 消息是发给自己
func (*Area) SendP2pMsgProxy ¶
func (this *Area) SendP2pMsgProxy(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, content *[]byte) (*message_center.Message, bool, bool, error)
* 发送一个新消息,可以指定接收端和发送端的代理节点 * @msgid uint64 消息号 * @recvid addressnet 接收者节点id * @recvProxyId addressnet 接收者代理节点id * @senderProxyId addressnet 发送者代理节点id * @content []byte 发送内容 * @return *Message 返回的消息 * @return bool 是否发送成功 * @return bool 消息是发给自己
func (*Area) SendP2pMsgProxyMachineID ¶
func (this *Area) SendP2pMsgProxyMachineID(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, recvMachineId string, content *[]byte) (*message_center.Message, bool, bool, error)
* 发送一个新消息,可以指定接收端、发送端的代理节点和接收方机器id * * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param recvProxyId addressnet 接收者代理节点id * @param senderProxyId addressnet 发送者代理节点id * @param recvMachineId string 接收方机器Id * @param content []byte 发送内容 * @return msg *Message 返回的消息 * @return sendSuccess bool 是否发送成功 * @return toSelf bool 消息是发给自己
func (*Area) SendP2pMsgProxyMachineIDWaitRequest ¶
func (this *Area) SendP2pMsgProxyMachineIDWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, recvMachineId string, content *[]byte, timeout time.Duration) (*[]byte, bool, bool, error)
* 给指定节点发送一个消息,可以指定接收端、发送端的代理节点和接收方机器id * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param recvProxyId addressnet 接收者代理节点id * @param senderProxyId addressnet 发送者代理节点id * @param recvMachineId string 接收方机器Id * @param content []byte 发送内容 * @param timeout Duration 超时时间 * @return bs *[]byte 返回的内容 * @return sendSuccess bool 是否发送成功 * @return toSelf bool 消息是发给自己
func (*Area) SendP2pMsgProxyWaitRequest ¶
func (this *Area) SendP2pMsgProxyWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, bool, bool, error)
* 给指定节点发送一个消息,可以指定接收端和发送端的代理节点 * @msgid uint64 消息号 * @recvid addressnet 接收者节点id * @recvProxyId addressnet 接收者代理节点id * @senderProxyId addressnet 发送者代理节点id * @content []byte 发送内容 * @return *[]byte 返回的内容 * @return bool 是否发送成功 * @return bool 消息是发给自己
func (*Area) SendP2pMsgWaitRequest ¶
func (this *Area) SendP2pMsgWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, bool, bool, error)
给指定节点发送一个消息 @return *[]byte 返回的内容 @return bool 是否发送成功 @return bool 消息是发给自己
func (*Area) SendP2pReplyMsg ¶
func (this *Area) SendP2pReplyMsg(message *message_center.Message, msgid uint64, content *[]byte) error
对某个消息回复
func (*Area) SendP2pReplyMsgHE ¶
func (this *Area) SendP2pReplyMsgHE(message *message_center.Message, msgid uint64, content *[]byte) error
对某个消息回复
func (*Area) SendP2pReplyMsgHEProxy ¶
func (this *Area) SendP2pReplyMsgHEProxy(message *message_center.Message, msgid uint64, content *[]byte, senderProxyId *nodeStore.AddressNet) error
* 对某个消息回复,可以指定发送端的代理节点
func (*Area) SendP2pReplyMsgProxy ¶
func (this *Area) SendP2pReplyMsgProxy(message *message_center.Message, msgid uint64, content *[]byte, senderProxyId *nodeStore.AddressNet) error
* 对某个消息回复,可以指定发送端的代理节点
func (*Area) SendSearchAllMsg ¶
func (this *Area) SendSearchAllMsg(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
发送一个新的查找超级节点消息
func (*Area) SendSearchAllReplyMsg ¶
func (this *Area) SendSearchAllReplyMsg(message *message_center.Message, msgid uint64, content *[]byte) error
对某个消息回复
func (*Area) SendSearchSuperMsg ¶
func (this *Area) SendSearchSuperMsg(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
发送一个新的查找超级节点消息
func (*Area) SendSearchSuperMsgAuto ¶
func (this *Area) SendSearchSuperMsgAuto(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
* 发送一个新的查找超级节点消息, 自动处理代理信息 * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param content []byte 发送内容 * @return msg *Message 返回的消息 * @return err error 错误信息
func (*Area) SendSearchSuperMsgAutoWaitRequest ¶
func (this *Area) SendSearchSuperMsgAutoWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, error)
* 发送一个新的查找超级节点消息, 自动处理代理信息 * * @param msgid uint64 消息号 * @param recvid addressnet 接收者节点id * @param content []byte 发送内容 * @param timeout Duration 超时时间 * @return res *[]byte 返回结果 * @return err error 错误信息
func (*Area) SendSearchSuperMsgProxy ¶
func (this *Area) SendSearchSuperMsgProxy(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
* 发送一个新的查找超级节点消息,可以指定接收端和发送端的代理节点 * @msgid uint64 消息号 * @recvid addressnet 接收者节点id * @recvProxyId addressnet 接收者代理节点id * @senderProxyId addressnet 发送者代理节点id * @content []byte 发送内容
func (*Area) SendSearchSuperMsgProxyWaitRequest ¶
func (this *Area) SendSearchSuperMsgProxyWaitRequest(msgid uint64, recvid, recvProxyId, senderProxyId *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, error)
* 发送一个新的查找超级节点消息,可以指定接收端和发送端的代理节点 * @msgid uint64 消息号 * @recvid addressnet 接收者节点id * @recvProxyId addressnet 接收者代理节点id * @senderProxyId addressnet 发送者代理节点id * @content []byte 发送内容
func (*Area) SendSearchSuperMsgWaitRequest ¶
func (this *Area) SendSearchSuperMsgWaitRequest(msgid uint64, recvid *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, error)
发送一个新的查找超级节点消息
func (*Area) SendSearchSuperReplyMsg ¶
func (this *Area) SendSearchSuperReplyMsg(message *message_center.Message, msgid uint64, content *[]byte) error
对某个消息回复
func (*Area) SendSearchSuperReplyMsgProxy ¶
func (this *Area) SendSearchSuperReplyMsgProxy(message *message_center.Message, msgid uint64, content *[]byte, senderProxyId *nodeStore.AddressNet) error
* 对某个消息回复,可以指定发送端的代理节点
func (*Area) SendVnodeP2pMsgHE ¶
func (this *Area) SendVnodeP2pMsgHE(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, recvNodeId *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
* 发送虚拟节点之间点对点消息 * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvNodeId *AddressNet 接收方真实地址,可以传nil,如果传nil,则会先根据recvVnode找到nid,再进行p2p转发,否则将会直接发送p2p消息 * @param content *[]byte 内容 * @return msssage *Message 消息 * @return err error 错误信息
func (*Area) SendVnodeP2pMsgHEAuto ¶
func (this *Area) SendVnodeP2pMsgHEAuto(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, recvNodeId *nodeStore.AddressNet, machineID string, content *[]byte, isSuperRecv bool) (res []*ResSimpleMsgErr)
* 发送虚拟节点之间点对点消息, 自动处理代理信息 * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvNodeId *AddressNet 接收方真实地址, 必须传入 * @param machineID string 接收方的机器id, 如果传入空串, 将发送给地址对应所有machineid的节点 * @param content *[]byte 内容 * @param isSuperRecv bool 接收者是不是超级节点, true: 不会搜索它的代理节点, false: 自动搜索接收方的代理节点 * @return res []*ResSimpleMsgErr 发送的结果列表
func (*Area) SendVnodeP2pMsgHEAutoWaitRequest ¶
func (this *Area) SendVnodeP2pMsgHEAutoWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, recvNId *nodeStore.AddressNet, machineID string, content *[]byte, timeout time.Duration, isSuperRecv bool) (res []*ResSimpleBsErr)
* 发送虚拟节点之间点对点消息, 等待消息返回, 自动处理代理信息 * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvNId *AddressNet 接收方真实地址, 必须传入 * @param machineID string 接收方的机器id, 如果传入空串, 将发送给地址对应所有machineid的节点 * @param machineID string 接收方机器Id * @param content *[]byte 内容 * @param timeout time.Duration 超时时间 * @param isSuperRecv bool 接收者是不是超级节点, true: 不会搜索它的代理节点, false: 自动搜索接收方的代理节点 * @return res []*ResSimpleBsErr 发送的结果列表
func (*Area) SendVnodeP2pMsgHEProxy ¶
func (this *Area) SendVnodeP2pMsgHEProxy(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, recvNodeId, recvProxyId, senderProxyId *nodeStore.AddressNet, recvMachineId string, content *[]byte) (*message_center.Message, error)
* 发送虚拟节点之间点对点消息,可以指定接收端、发送端的代理节点和接收方机器id * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvNodeId *AddressNet 接收方真实地址,可以传nil,如果传nil,则会先根据recvVnode找到nid,再进行p2p转发,否则将会直接发送p2p消息 * @param recvProxyId *Addressnet 接收者代理节点id * @param senderProxyId *Addressnet 发送者代理节点id * @param recvMachineId string 接收方机器Id * @param content *[]byte 内容 * @return msssage *Message 消息 * @return err error 错误信息
func (*Area) SendVnodeP2pMsgHEProxyWaitRequest ¶
func (this *Area) SendVnodeP2pMsgHEProxyWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, recvNodeId, recvProxyId, senderProxyId *nodeStore.AddressNet, recvMachineId string, content *[]byte, timeout time.Duration) (*[]byte, error)
* 发送虚拟节点之间点对点消息, 等待消息返回, 可以指定接收端、发送端的代理节点和接收方机器id * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvNodeId *AddressNet 接收方真实地址,可以传nil,如果传nil,则会先根据recvVnode找到nid,再进行p2p转发,否则将会直接发送p2p消息 * @param recvProxyId *Addressnet 接收者代理节点id * @param senderProxyId *Addressnet 发送者代理节点id * @param recvMachineId string 接收方机器Id * @param content *[]byte 内容 * @param timeout time.Duration 超时时间 * @return msssage *Message 消息 * @return err error 错误信息
func (*Area) SendVnodeP2pMsgHEWaitRequest ¶
func (this *Area) SendVnodeP2pMsgHEWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, recvNodeId *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, error)
* 发送虚拟节点之间点对点消息, 等待消息返回 * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvNodeId *AddressNet 接收方真实地址,可以传nil,如果传nil,则会先根据recvVnode找到nid,再进行p2p转发,否则将会直接发送p2p消息 * @param timeout time.Duration 超时时间 * @param content *[]byte 内容 * @return msssage *Message 消息 * @return err error 错误信息
func (*Area) SendVnodeP2pReplyMsgHE ¶
func (this *Area) SendVnodeP2pReplyMsgHE(message *message_center.Message, msgid uint64, content *[]byte) error
对发送虚拟节点之间点对点消息回复
func (*Area) SendVnodeSearchMsg ¶
func (this *Area) SendVnodeSearchMsg(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, content *[]byte) (*message_center.Message, error)
发送虚拟节点搜索节点消息
func (*Area) SendVnodeSearchMsgAuto ¶
func (this *Area) SendVnodeSearchMsgAuto(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, content *[]byte) (*message_center.Message, error)
* 发送虚拟节点搜索节点消息, 自动处理代理信息 * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvNId *Addressnet 接收方真实节点id * @param machineID string 接收方的机器id, 如果传入空串, 将发送给地址对应所有machineid的节点 * @param content *[]byte 内容 * @param isSuperRecv bool 接收者是不是超级节点, true: 不会搜索它的代理节点, false: 自动搜索接收方的代理节点 * @return msssage *Message 消息 * @return err error 错误信息
func (*Area) SendVnodeSearchMsgAutoWaitRequest ¶
func (this *Area) SendVnodeSearchMsgAutoWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, content *[]byte, timeout time.Duration) (*[]byte, error)
* 发送虚拟节点搜索节点消息, 自动处理代理信息 * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param content *[]byte 内容 * @return msssage *Message 消息 * @return err error 错误信息
func (*Area) SendVnodeSearchMsgProxy ¶
func (this *Area) SendVnodeSearchMsgProxy(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, recvProxyId, senderProxyId *nodeStore.AddressNet, content *[]byte) (*message_center.Message, error)
* 发送虚拟节点搜索节点消息,可以指定接收端和发送端的代理节点 * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvProxyId *Addressnet 接收者代理节点id * @param senderProxyId *Addressnet 发送者代理节点id * @param content *[]byte 内容 * @return msssage *Message 消息 * @return err error 错误信息
func (*Area) SendVnodeSearchMsgProxyWaitRequest ¶
func (this *Area) SendVnodeSearchMsgProxyWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, recvProxyId, senderProxyId *nodeStore.AddressNet, content *[]byte, timeout time.Duration) (*[]byte, error)
* 发送虚拟节点搜索节点消息, 等待消息返回,可以指定接收端和发送端的代理节点 * * @param msgid uint64 消息号 * @param sendVnodeId *AddressNetExtend 发送方虚拟节点地址 * @param recvVnodeid *AddressNetExtend 接收方虚拟地址 * @param recvProxyId *Addressnet 接收者代理节点id * @param senderProxyId *Addressnet 发送者代理节点id * @param content *[]byte 内容 * @return msssage *Message 消息 * @return err error 错误信息
func (*Area) SendVnodeSearchMsgWaitRequest ¶
func (this *Area) SendVnodeSearchMsgWaitRequest(msgid uint64, sendVnodeid, recvVnodeid *virtual_node.AddressNetExtend, content *[]byte, timeout time.Duration) (*[]byte, error)
发送虚拟节点搜索节点消息
func (*Area) SendVnodeSearchReplyMsg ¶
func (this *Area) SendVnodeSearchReplyMsg(message *message_center.Message, msgid uint64, content *[]byte) error
对发送虚拟节点搜索节点消息回复
func (*Area) SetAreaGodAddr ¶
* 设置区域上帝地址信息 * * @auth qlw * @param ip string 服务器ip地址 * @param port int 服务器端口, 端口范围 (1024, 65535) * @return success bool 是否添加成功 * @return proxyAddr string 上帝节点地址,注意:如果区域没有启动,则该值为空串
func (*Area) SetAreaGodAddrWithConnRes ¶
* 设置区域上帝地址信息, 返回是否连接成功标识 * * @auth qlw * @param ip string 服务器ip地址 * @param port int 服务器端口, 端口范围 (1024, 65535) * @return success bool 是否添加成功 * @return proxyAddr string 上帝节点地址,注意:如果区域没有启动,则该值为空串 * @return connRel bool 是否连接成功标识
func (*Area) SetMachineID ¶
* 设置本节点的机器id * * @param machineID string 机器id * @return success bool 是否设置成功
func (*Area) SetP2pConnType ¶
* 设置本节点的机器id * * @param connType string p2p连接类型: all tcp udp * @return success bool 是否设置成功
func (*Area) StartEngine ¶
启动消息服务器 @isFirst bool 是否是首节点 @addr string 监听地址
func (*Area) StartGlobalEngine ¶
* 启动消息服务器 * * @param global *Global 大区信息 * @return success bool 是否设置成功
type AreaManager ¶
type AreaManager struct { }
type Auth ¶
type Auth struct { AreaName [32]byte // contains filtered or unexported fields }
func NewAuth ¶
func NewAuth(areaId [32]byte, nm *nodeStore.NodeManager, se *engine.Engine, vc *manager.VnodeCenter) *Auth
func (*Auth) GetAreaName ¶
* GetAreaName 获取区域名称 * * @return areaName string 区域名称
func (*Auth) RecvKey ¶
func (this *Auth) RecvKey(conn net.Conn, name string) (remoteName, machineID string, setGodTime int64, params interface{}, connectKey string, err error)
接收 name 自己的名称 @return remoteName 对方服务器的名称
func (*Auth) RecvQuicKey ¶
func (this *Auth) RecvQuicKey(conn quic.Connection, stream quic.Stream, name string) (remoteName, machineID string, setGodTime int64, params interface{}, connectKey string, err error)
接收 name 自己的名称 @return remoteName 对方服务器的名称
func (*Auth) SendKey ¶
func (this *Auth) SendKey(conn net.Conn, session engine.Session, name string, setGodAddr bool) (remoteName, machineID string, setGodTime int64, params interface{}, connectKey string, err error)
发送 @name 本机服务器的名称 @setGodAddr 是否设置对方为自己的上帝节点标识 @return remoteName 对方服务器的名称
func (*Auth) SendQuicKey ¶
func (this *Auth) SendQuicKey(conn quic.Connection, stream quic.Stream, session engine.Session, name string, setGodAddr bool) (remoteName, machineID string, setGodTime int64, params interface{}, connectKey string, err error)
发送 @name 本机服务器的名称 @setGodAddr 是否设置对方为自己的上帝节点标识 @return remoteName 对方服务器的名称
type NodeEventCallbackHandler ¶
type NodeEventCallbackHandler func(addr nodeStore.AddressNet, machineID string)
* 节点上下线及关闭回调函数 * * @param addr AddressNet 节点地址 * @param machineID string 节点机器id
type ResBsErr ¶
type ResBsErr struct { MachineID string // 机器id Bs *[]byte // 返回的字节数组 SendSuccess bool // 是否发送成功 SendSelf bool // 消息是发给自己 Err error // 错误信息 }
消息返回值, 带有字节数组、是否发送成功、是否发送给自己和错误信息
type ResMsgErr ¶
type ResMsgErr struct { MachineID string // 机器id Msg *message_center.Message // 发送的消息 SendSuccess bool // 是否发送成功 SendSelf bool // 消息是发给自己 Err error // 错误信息 }
消息返回值, 带有消息、是否发送成功、是否发送给自己和错误信息
type ResSimpleBsErr ¶
消息返回值, 带有字节数组和错误信息
type ResSimpleMsgErr ¶
type ResSimpleMsgErr struct { MachineID string // 机器id Msg *message_center.Message // 发送的消息 Err error // 错误信息 }
消息返回值, 带有消息和错误信息