Documentation ¶
Index ¶
- Constants
- type Cluster
- func (c *Cluster) BordcastMsg(data *protocol.SSMessage)
- func (c *Cluster) Close()
- func (c *Cluster) Init(c1 Event_OnConnect, c2 Event_OnDisconnect, c3 Event_OnMessage)
- func (c *Cluster) OnConnect(sessionID uint64, addr string)
- func (c *Cluster) OnDisconnect(sessionID uint64, err error)
- func (c *Cluster) OnMessage(sessionID uint64, msg *protocol.SSMessage)
- func (c *Cluster) Pack(payload *protocol.SSMessage, buf *bytes.Buffer)
- func (c *Cluster) SendMsg(sessionID uint64, data *protocol.SSMessage)
- func (c *Cluster) Unpack(reader io.Reader) (payload *protocol.SSMessage, err error)
- type Event_OnConnect
- type Event_OnDisconnect
- type Event_OnMessage
- type NodeConfig
Constants ¶
View Source
const ( LockKey = "/NodeLaunchMutex" // 节点启动锁 NodePrefix = "/AllNode/" // 节点前缀 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
NewCluster Launch a not exist node in cluster.
func (*Cluster) BordcastMsg ¶
BordcastMsg Send message to all of node.
func (*Cluster) Close ¶
func (c *Cluster) Close()
Close Shutdown the communicator and close all of already exist sessions.
func (*Cluster) Init ¶
func (c *Cluster) Init(c1 Event_OnConnect, c2 Event_OnDisconnect, c3 Event_OnMessage)
Init Launch a not exist node in cluster. Initalization cluster node, include listen port, registry and connect, if either operation fails, will panic.
func (*Cluster) OnConnect ¶
OnConnect Recive a new connect form listener/dialer If underlying support it, then convert it to NodeRemote and cache it
func (*Cluster) OnDisconnect ¶
OnDisconnect The session disconnected, the remote device initiates or actively disconnects
func (*Cluster) OnMessage ¶
OnMessage Recive a new message. Just recive the message from session. And push it to InPipe.
type Event_OnConnect ¶
type Event_OnDisconnect ¶
type Event_OnMessage ¶
type NodeConfig ¶
Click to show internal directories.
Click to hide internal directories.