| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Network.DNS.Encode
Description
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).
Synopsis
- encode :: DNSMessage -> ByteString
Encode a DNS query (or response).
encode :: DNSMessage -> ByteString Source #
Encode a DNSMessage for transmission over UDP. For transmission over
TCP encapsulate the result via encodeVC, or use
sendVC, which handles this internally. If any
ResourceRecord in the message contains incorrectly encoded Domain name
ByteStrings, this function may raise a DecodeError.