Skip to main content

Module dns

Module dns 

Source
Expand description

DNS resolver configuration for internal lookups.

The resolver itself is the combination of the Cloudflare and Quad9 endpoints supporting DoH and DoT.

use nym_http_api_client::HickoryDnsResolver;
let resolver = HickoryDnsResolver::new();
resolver.resolve_str("example.com").await?;

§Fallbacks

System Resolver – This resolver supports an optional fallback mechanism where, should the DNS-over-TLS resolution fail, a followup resolution will be done using the hosts configured default (e.g. /etc/resolv.conf on linux).

This is disabled by default and can be enabled using HickoryDnsResolver::use_system_resolver.

Static Table – There is also a second optional fallback mechanism that allows a static map to be used as a last resort. This can help when DNS encounters errors due to blocked resolvers or unknown conditions. This is enabled by default, and can be customized if building a new resolver.

§IPv4 / IPv6

By default the resolver uses only IPv4 nameservers, and is configured to do A lookups first, and only do AAAA if no A record is available.

§Connection provider

HickoryDnsResolver is generic over the ConnectionProvider used by the underlying hickory-resolver crate, defaulting to TokioRuntimeProvider so that it behaves exactly like a TokioResolver wrapper out of the box. A different connection provider can be supplied by naming it explicitly, e.g. HickoryDnsResolver::<MyProvider>::default(), though process-wide sharing (see HickoryDnsResolver::shared) is only available for the default provider.


Requires the https-ring, tls-ring, webpki-roots features for the hickory-resolver crate

Structs§

HickoryDnsResolver
Wrapper around a hickory-resolver Resolver, which implements the Resolve trait.

Enums§

ResolveError
Error occurring while resolving a hostname into an IP address.

Traits§

SharedResolverState
Associates a ConnectionProvider with the process-wide shared resolver instance backing HickoryDnsResolver::shared, if one exists for that provider.