Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Discovered ¶
type Discovered struct { // Address is the local address of a discovered peer. Address string // Payload is the associated payload from discovered peer. Payload []byte }
Discovered is the structure of the discovered peers, which holds their local address (port removed) and a payload if there is one.
func Discover ¶ added in v1.0.0
func Discover(settings ...Settings) (discoveries []Discovered, err error)
Discover will use the created settings to scan for LAN peers. It will return an array of the discovered peers and their associate payloads. It will not return broadcasts sent to itself.
type Settings ¶
type Settings struct { // Limit is the number of peers to discover, use < 1 for unlimited. Limit int // Port is the port to broadcast on (the peers must also broadcast using the same port). // The default port is 9999. Port string // MulticastAddress specifies the multicast address. // You should be able to use any between 224.0.0.0 to 239.255.255.255. // By default it uses the Simple Service Discovery Protocol // address (239.255.255.250). MulticastAddress string // Payload is the bytes that are sent out with each broadcast. Must be short. Payload []byte // Delay is the amount of time between broadcasts. The default delay is 1 second. Delay time.Duration // TimeLimit is the amount of time to spend discovering, if the limit is not reached. // The default time limit is 10 seconds. TimeLimit time.Duration // AllowSelf will allow discovery the local machine (default false) AllowSelf bool // contains filtered or unexported fields }
Settings are the settings that can be specified for doing peer discovery.
Click to show internal directories.
Click to hide internal directories.