Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultSettings = Settings{ MulticastAddress: "239.255.255.250", GroupPort: "9999", Limit: -1, Interval: 500 * time.Millisecond, Timeout: 5 * time.Second, IncludeSelf: false, Payload: []byte("discover"), }
DefaultSettings is the default configurations for peer discovering.
Functions ¶
This section is empty.
Types ¶
type Discovery ¶
Discovery provides additional fields that holds the peer discovery.
func NewDiscovery ¶
NewDiscovery returns a new `Discovery` struct with the specified settings.
type Peer ¶
type Peer string
Peer holds the IP address of a peer (string).
type Settings ¶
type Settings struct { // MulticastAddress defaults to 239.255.255.250 (Simple Service Discovery Protocol). MulticastAddress string // GroupPort defaults to 9999. GroupPort string // Limit is the max limit of peers to discover. Set to -1 for unlimited. Limit int // Interval is the time interval between each multicast. Interval time.Duration // Timeout is the most time given for the job to be done. Set to -1 if no timeout is needed. Timeout time.Duration // IncludeSelf includes the local address of this machine as discovered peer. IncludeSelf bool // Payload is the bytes that will be multicasted to group. Payload []byte // NotifyFunc will be called each time a new peer is discovered. NotifyFunc func(Peer) }
Settings is the configurations that will be passed to `Discovery`.
Click to show internal directories.
Click to hide internal directories.