Expand description
DNS over HTTPS, for the records a stub resolver has no API for: a zone’s nameservers, a handle’s TXT record, a lexicon authority’s TXT record.
RFC 8484 carries DNS’s own wire format over HTTPS. Cloudflare’s and
Google’s resolvers also answer a JSON sibling of it: a GET naming the
record and its type, answered as application/dns-json. That JSON form is
what this speaks. query_url and parse need no network, and
lookup makes the request through crate::pinned_client.
Whoever runs the resolver sees every name asked of it, so every caller takes the resolver’s address as a parameter.
Constants§
- CLOUDFLARE
- Cloudflare’s resolver, which answers the JSON form.
- JSON_
ACCEPT - The
Acceptheader that asks a DoH endpoint for JSON rather than the wire format. - MAX_
ANSWER_ BYTES - The most of one answer
lookupreads. A TXT answer is a few hundred bytes. - TXT
- The
TXTrecord type, by its number and its name.
Functions§
- escape 🔒
- Percent-encodes what a hostname may legitimately carry and a query string
may not. A hostname is letters, digits, hyphens, dots and underscores
(
_atproto), so this is a narrow guard against a caller’s typo reaching the resolver as query syntax rather than a general encoder. - lookup
- The records of
record_type, by number and name, atname, as the resolver atresolveranswers: one GET through a client pinned to the resolver’s own addresses, its answer read underMAX_ANSWER_BYTESand byparse. - parse
- Reads one answer: the records of type
record_type, as strings. - query_
url - The URL one query is made at.
- status_
name 🔒 - The DNS RCODEs a public resolver actually answers with, by name.
- tidy 🔒
- A record’s
dataas a caller wants to read it: a nameserver without its root dot, a TXT record with its character-string quoting undone, and anything else as it came.