Documentation
¶
Overview ¶
The mdns package listens and broadcasts for DNS packets
It listens on IP4 and IP6 connections for messages, and emits them to any subscribers. In order to create a task instance, use the `New` function with a `Config` object. The `Run` function is then used to start the task instance, until the passed context is cancelled, which closes the channels for all subscribers.
A `Message` can be created from a DNS packet (an answer) or with a question, and sent using the `Send` method.
Index ¶
Constants ¶
const ( DefaultName = "mdns" DefaultLabel = "local" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type DNSTask ¶
A `DNSTask` which receives and sends messages
func NewWithConfig ¶
Create a task instance from a `Config` object
type Message ¶
type Message interface { PTR() []Ptr // Return PTR records A() []net.IP // Return A records TXT() []string // Return TXT records SRV() []Srv // Return SRV records Bytes() ([]byte, error) // Return the packed message IsAnswer() bool // Return true when the message is an answer IfIndex() int // Interface to send and receive on, or nil }
A sent or received message
func MessageFromPacket ¶
Create a message from a received packet, with a sender and the interface that the message was received on