Documentation ¶
Overview ¶
Package mdns provides utilities related to Multicast DNS (mDNS), as defined in https://tools.ietf.org/html/rfc6762.
Index ¶
- Constants
- func IsUniqueRecord(r dns.RR) (bool, dns.RR)
- func NewQuery(legacy bool, q ...dns.Question) *dns.Msg
- func NewResponse(query *dns.Msg, unicast bool) *dns.Msg
- func SetUnicastResponse(q dns.Question) dns.Question
- func SetUniqueRecord(r dns.RR) dns.RR
- func ValidateQuery(m *dns.Msg) error
- func WantsUnicastResponse(q dns.Question) (bool, dns.Question)
Constants ¶
const UnicastResponseBit = 1 << 15
UnicastResponseBit is a bit flag that is used to indicate that a DNS question prefers a unicast response.
In the Question Section of a Multicast DNS query, the top bit of the qclass field is used to indicate that unicast responses are preferred for this particular question. (See Section 5.4.)
See https://tools.ietf.org/html/rfc6762#section-18.12.
const UniqueRecordBit = 1 << 15
UniqueRecordBit is a bit flag that is used to indicate that a DNS RR is a "unique" record.
In the Resource Record Sections of a Multicast DNS response, the top bit of the rrclass field is used to indicate that the record is a member of a unique RRSet, and the entire RRSet has been sent together (in the same packet, or in consecutive packets if there are too many records to fit in a single packet). (See Section 10.2.)
Variables ¶
This section is empty.
Functions ¶
func IsUniqueRecord ¶
IsUniqueRecord returns true if the given RR is a "unique" record.
It returns a copy of the RR with the "unique record bit" cleared, to reflect the actual record class.
func NewQuery ¶
NewQuery returns a new (empty) DNS query.
If legacy is true, it indicates this query will be sent from a "legacy" or "one-shot" querier, which expects a unicast response.
func NewResponse ¶
NewResponse returns a new (empty) response to a mDNS query.
See https://tools.ietf.org/html/rfc6762#section-6 and https://tools.ietf.org/html/rfc6762#section-18.
func SetUnicastResponse ¶
SetUnicastResponse adds the "unicast response bit" to the given question.
func SetUniqueRecord ¶
SetUniqueRecord adds the "unique record bit" to the given RR.
func ValidateQuery ¶
ValidateQuery returns an error if m is not a valid mDNS query.
func WantsUnicastResponse ¶
WantsUnicastResponse returns true if the given question requested a unicast response.
It returns a copy of the question with the "unicast response bit" cleared, to reflect the actual question class.
Types ¶
This section is empty.