Expand description
§DNS name resolution
Transport for libp2p.
This crate provides the type tokio::Transport based on hickory_resolver::TokioResolver.
A Transport is an address-rewriting libp2p_core::Transport wrapper around
an inner Transport. The composed transport behaves like the inner
transport, except that libp2p_core::Transport::dial resolves /dns/..., /dns4/...,
/dns6/... and /dnsaddr/... components of the given Multiaddr through
a DNS, replacing them with the resolved protocols (typically TCP/IP).
The tokio::Transport is enabled by default under the tokio feature.
Tokio users can furthermore opt-in to the tokio-dns-over-rustls and
tokio-dns-over-https-rustls features.
For more information about these features, please refer to the documentation
of trust-dns-resolver.
Alternative runtimes or resolvers can be used though a manual implementation of [Resolver].
On Unix systems, if no custom configuration is given, trust-dns-resolver
will try to parse the /etc/resolv.conf file. This approach comes with a
few caveats to be aware of:
- This fails (panics even!) if
/etc/resolv.confdoes not exist. This is the case on all versions of Android. - DNS configuration is only evaluated during startup. Runtime changes are thus ignored.
- DNS resolution is obviously done in process and consequently not using any system APIs
(like libc’s
gethostbyname). Again this is problematic on platforms like Android, where there’s a lot of complexity hidden behind the system APIs.
If the implementation requires different characteristics, one should
consider providing their own implementation of Transport or use
platform specific APIs to extract the host’s DNS configuration (if possible)
and provide a custom ResolverConfig.
Modules§
- tokio
tokio
Structs§
- Resolve
Error - The error type for errors that get returned in the crate
- Resolver
Config - Configuration for the upstream nameservers to use for resolution
- Resolver
Opts - Configuration for the Resolver
- Transport
- A
Transportfor performing DNS lookups when dialingMultiaddresses. You shouldn’t need to use this type directly. Usetokio::Transportinstead.
Enums§
- Error
- The possible errors of a
Transportwrapped transport. - Resolve
Error Kind - The error kind for errors that get returned in the crate