DNS message encoder.
Note:
DNS is a client library, and its focus is on
sending queries, and
receiving replies.
Thefore, while this module is reasonably adept at query generation,
building a DNS server with this module requires additional work to
handle message size limits, correct UDP truncation, proper EDNS
negotiation, and so on. Support for server-side DNS is at best
rudimentary.
For sending queries, in most cases you should be using one of the
functions from
Lookup and
LookupRaw, or lastly, if you
want to handle the network reads and writes for yourself (with your
own code for UDP retries, TCP fallback, EDNS fallback, ...), then
perhaps
encodeQuestion (letting
DNS do the lookups for
you in an
async thread is likely much simpler).