Documentation
¶
Index ¶
- Constants
- Variables
- func Announce(mAddr, srcAddr, name string) error
- func Broadcast(addr, message string) error
- func ListenFor(addr string, names ...string) (<-chan Service, error)
- func Respond(mAddr, srcAddr, name string) error
- func Subscribe(addr string) (<-chan MulticastMsg, error)
- type MulticastMsg
- type Service
Constants ¶
const ( // TypeAnnounce should be used to announce presence TypeAnnounce = "announce" // TypeQuery should be used to ask whether a service with a // specific name is present TypeQuery = "query" // Response should be used to respond to TypeQuery messages TypeResponse = "response" // Report should be used to ask everyone on the network to // report that they are alive TypeReport = "report" )
Constants that denote the different types of service messages
Variables ¶
var MaxDatagramSize = 8192
MaxDatagramSize sets the maximum amount of bytes to be read
Functions ¶
func Announce ¶
Announce sends out an announcement on the mAddr that other clients can listen to. ListenFor can interpret these srvc messages
func Broadcast ¶
Broadcast sends a message to the multicast address via UDP. The address should be in an "ipaddr:port" fashion
func ListenFor ¶
ListenFor returns a channel that sends a message if any of the names that was requested has announced itself on the multicast addr. Once announced, the whole message will be returned and then removed from the watchlist
func Subscribe ¶
func Subscribe(addr string) (<-chan MulticastMsg, error)
Subscribe starts listening to a multicast address via UDP. The address should be in an "ipaddr:port" fashion.
Types ¶
type MulticastMsg ¶
MulticastMsg is used to communicate a message that was received on a multicast channel. Contains information about the sender as well, or an error if any arose.