Documentation ¶
Index ¶
- Constants
- type Node
- func (n *Node) Done() <-chan struct{}
- func (n *Node) Encode() []byte
- func (n *Node) Equal(b *Node) bool
- func (n *Node) IPv4() net.IP
- func (n *Node) IPv6() net.IP
- func (n *Node) KeepRegistered()
- func (n *Node) Multicast(ctx context.Context, multicastAddress string) <-chan error
- func (n *Node) RegisterCh() <-chan struct{}
- func (n *Node) Stop()
- func (n *Node) String() string
Constants ¶
View Source
const ( RegisterAction = iota DeregisterAction = iota )
Modes of a node being registered
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct { Payload []byte // max 256 bytes SrcIP net.IP SendInterval time.Duration Action int Heartbeat *time.Timer Mutex sync.Mutex // contains filtered or unexported fields }
Node represents a machine registered with Disco
func DecodeNode ¶
DecodeNode decodes the bytes and returns a *Node struct
func (*Node) Done ¶
func (n *Node) Done() <-chan struct{}
Done returns a channel that can be used to wait till Multicast is stopped
func (*Node) Encode ¶
Encode will convert a Node to a byte slice Checksum - 4 bytes IPv4 value - 4 bytes IPv6 value - 16 bytes Action value - 1 byte Send Interval - 8 bytes Payload (unknown length)
func (*Node) KeepRegistered ¶
func (n *Node) KeepRegistered()
KeepRegistered sends an anonymous struct{} to registeredChan to indicate the node should stay registered
func (*Node) RegisterCh ¶
func (n *Node) RegisterCh() <-chan struct{}
RegisterCh returns a channel to know if the node should stay registered
Click to show internal directories.
Click to hide internal directories.