Improved multicast DNS support
- Add support for multicast DNS (RFC6762) in the trie. (#35 from Luke Dunstan)
- mDNS doesn't use SOA nor delegation (RFC 6762 section 12), so some minor changes
to Trie are required to handle this. - mDNS doesn't echo the questions in the response (RFC 6762 section 6), except
in legacy mode, so abool
argument was added toQuery.response_of_answer
. Query.answer
still exists but nowQuery.answer_multiple
is also available
for answering multiple questions in one query to produce a single answer
(RFC 6762 section 5.3). One caveat is that responses may exceed the maximum
message length, but that is not really specific to mDNS. Also, in theory multiple
questions might require multiple separate response messages in unusual cases,
but that is complicated and the library does not deal with that yet.Query.answer_multiple
takes an optional function to allow the caller to control
thecache-flush
bit. This bit is only set for records that have been "confirmed
as unique". Using a callback requires minimal changes here but puts the burden of
maintaining uniqueness state elsewhere.Query.answer_multiple
takes an optional function to filter the answer, in order
to support "known answer suppression" (RFC 6762 section 7.1). Again, using a callback
requires minimal change to the core, but later on the mDNS-specific known answer
suppression logic could move into theQuery
module if that turns out to be simpler.- A query for
PTR
returns additional records forSRV
andTXT
, to support efficient
service discovery. Trie.iter
was added to support mDNS announcements.
- mDNS doesn't use SOA nor delegation (RFC 6762 section 12), so some minor changes
- Switch to
Bytes
instead ofString
for eventual-safe-string
support. - Partially remove some error printing to stderr. (#36)
Unit tests were added for some of the changes above, including a test-only
dependency on pcap-format
.