Karta. DNS. Message
(Karta v1.0.0)
A DNS message (RFC 1035 §4.1) as Karta.DNS.Wire encodes and decodes it.
- Header flags are booleans;
adandcdare the DNSSEC bits of RFC 4035 §3.2 that Erlang'sinet_dnsdoes not expose. rcodeis the full response code: the 4 header bits plus, with EDNS, the 8 extended bits (RFC 6891 §6.1.3). Known codes are atoms (:noerror,:formerr,:servfail,:nxdomain,:notimp,:refused); others are integers.additionalnever holds the OPT pseudo-record; it is decoded intoednsinstead (nilwhen the message has none).
Summary
Types
EDNS(0) parameters (RFC 6891): the requestor's UDP payload size, the
version, the DNSSEC OK bit (RFC 3225) and options as {code, data}.
Functions
A recursive query for one name and type, as Karta sends it: RD set, EDNS(0) with the DO bit and a 1232-octet UDP payload size (the DNS Flag Day 2020 value, which avoids IP fragmentation), and AD set so a validating resolver reports whether the answer is authenticated (RFC 6840 §5.7).
Types
@type edns() :: %{ udp_size: 0..65535, version: 0..255, dnssec_ok: boolean(), options: [{0..65535, binary()}] }
EDNS(0) parameters (RFC 6891): the requestor's UDP payload size, the
version, the DNSSEC OK bit (RFC 3225) and options as {code, data}.
@type rcode() ::
:noerror | :formerr | :servfail | :nxdomain | :notimp | :refused | 0..4095
@type t() :: %Karta.DNS.Message{ aa: boolean(), ad: boolean(), additional: [Karta.DNS.Record.t()], answer: [Karta.DNS.Record.t()], authority: [Karta.DNS.Record.t()], cd: boolean(), edns: edns() | nil, id: 0..65535, opcode: 0..15, qr: boolean(), question: [Karta.DNS.Question.t()], ra: boolean(), rcode: rcode(), rd: boolean(), tc: boolean() }
Functions
@spec query(0..65535, String.t(), Karta.DNS.Record.type(), keyword()) :: t()
A recursive query for one name and type, as Karta sends it: RD set, EDNS(0) with the DO bit and a 1232-octet UDP payload size (the DNS Flag Day 2020 value, which avoids IP fragmentation), and AD set so a validating resolver reports whether the answer is authenticated (RFC 6840 §5.7).