std/dns
The Domain Name System as values: DomainName with IDNA and the comparison of RFC 4343, the records as a closed set
of typed cases, and the wire format of RFC 1035 with name compression and EDNS0 - a Message from bytes and back,
query for the bytes of a query, and readResponse for the response to it.
std/dns touches nothing: it has no natives and needs no capability. Sending a query is a transport's -
std/network over UDP and TCP, std/tls for DNS over TLS, std/http for DNS over HTTPS - and every one of them
moves the bytes this package writes and reads (docs/design/DNS.md).
const name = DomainName.tryFrom("bücher.example")?
const bytes = query name, RecordType.Aaaa, 4660
print name
Modules
std/dns/codesThe numbers of the DNS as closed sets: [RecordType], [RecordClass], [Operation] and [ResponseCode].std/dns/errorDnsError: why a text is not a domain name, why bytes are not a DNS message, why a message cannot be written, and why a message is not the response to a query.std/dns/message[Message]: a DNS message of RFC 1035 section 4 as a value - the header with its flags, the four sections, and the EDNS0 record of RFC 6891 taken out of the additional section into [Edns].std/dns/name[DomainName]: a name of the DNS as a sequence of labels, read from what a person writes (IDNA, docs/design/DNS.md section 3), from the presentation format of a zone file, or from the labels of a message - and compared the way the DNS compares names, without regard to the case of ASCII letters (RFC 4343).std/dns/record[Record] and [RecordData]: a resource record of RFC 1035 section 3.2.1 with its data typed by its type - addresses ofstd/ip, names as [DomainName]s, numbers asInts - andUnknownfor every type this package does not model.std/dns/wireThe wire format of RFC 1035 section 4: a [Message] from bytes and back, names compressed by pointers (section 4.1.4), the EDNS0 record of RFC 6891, and the query and response helpers a transport needs - so thatstd/network,std/tlsandstd/httponly move bytes (docs/design/DNS.md section 2).
Everything
- type
DnsErrorWhy a name, a message or a response was refused. - extend
DnsError with From<ReadError>A read ofstd/binarythat failed on the bytes of a message: where they end is a truncated message, and anything else is a message that is not one. - type
DomainNameA domain name: its labels, most specific first, each one to 63 bytes, 255 bytes at most on the wire. - type
EdnsThe EDNS0 record (RFC 6891): what a client or a server says about itself beyond RFC 1035. - type
EdnsOptionOne option of the EDNS0 record (RFC 6891 section 6.1.2): its code and its data, as the bytes they are. - type
MessageA DNS message: a query or a response, as itskindsays. - type
MessageKindQR, the first bit of the header: whether a message asks or answers (RFC 1035 section 4.1.1). - type
OperationWhat a message asks the server to do: the four bits ofOPCODE(RFC 1035 section 4.1.1). - fn
queryThe bytes of a standard query for the records ofrecordTypeatname: one question in classInternet, recursion desired unlessrecursionDesiredsays otherwise, and an EDNS0 record that offers a UDP payload of 1232 bytes and sets the DO bit wherednssecOkasks for DNSSEC records. - type
QuestionA question: which records of which name a message asks for (RFC 1035 section 4.1.2). - fn
readResponseThe response inbytes, checked against thequeryit is supposed to answer: it is a response, its identifier and operation are the query's, and its question section is the query's, the names compared without their case - or empty, which a server may send with an error code. - type
RecordA resource record: the name it belongs to, its class, how many seconds it may be cached, and its data, whose case says the type. - type
RecordClassThe class of a record (RFC 1035 section 3.2.4). - type
RecordDataThe data of a record, one case per type: the closed set of docs/design/DNS.md section 4. - type
RecordTypeThe type of a record, or of the records a question asks for (RFC 1035 section 3.2.2, and the registry of IANA's "Resource Record (RR) TYPEs" for the later ones). - type
ResponseCodeHow a server answered: the twelve bits of the response code, four in the header and eight more in the EDNS0 record (RFC 6891 section 6.1.3). - extend
Result<Value, ReadError> - type
ServiceParameterOne parameter of a service binding (RFC 9460 section 7, and section 14.3's registry): the keys RFC 9460 defines, typed, andOtherfor every other key with its value as bytes.