pub struct DnsResolver(/* private fields */);wasm_browser only.Expand description
The DNS resolver used throughout iroh.
Implementations§
Source§impl DnsResolver
impl DnsResolver
Sourcepub fn new() -> DnsResolver
pub fn new() -> DnsResolver
Creates a new DNS resolver with sensible cross-platform defaults.
+pub struct DnsResolver(/* private fields */);wasm_browser only.Expand description
The DNS resolver used throughout iroh.
Implementations§
Source§impl DnsResolver
impl DnsResolver
Sourcepub fn new() -> DnsResolver
pub fn new() -> DnsResolver
Creates a new DNS resolver with sensible cross-platform defaults.
We first try to read the system’s resolver from /etc/resolv.conf.
This does not work at least on some Androids, therefore we fallback
to the default ResolverConfig which uses eg. to google’s 8.8.8.8 or 8.8.4.4.
Sourcepub fn with_nameserver(nameserver: SocketAddr) -> DnsResolver
pub fn with_nameserver(nameserver: SocketAddr) -> DnsResolver
Creates a new DNS resolver configured with a single UDP DNS nameserver.
-Sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Creates a builder to construct a DNS resolver with custom options.
-Sourcepub fn custom(resolver: impl Resolver) -> DnsResolver
pub fn custom(resolver: impl Resolver) -> DnsResolver
Creates a new DnsResolver from a struct that implements Resolver.
Sourcepub fn with_nameserver(nameserver: SocketAddr) -> DnsResolver
pub fn with_nameserver(nameserver: SocketAddr) -> DnsResolver
Creates a new DNS resolver configured with a single UDP DNS nameserver.
+Sourcepub fn builder() -> Builder
pub fn builder() -> Builder
Creates a builder to construct a DNS resolver with custom options.
+Sourcepub fn custom(resolver: impl Resolver) -> DnsResolver
pub fn custom(resolver: impl Resolver) -> DnsResolver
Creates a new DnsResolver from a struct that implements Resolver.
If you need more customization for DNS resolving than the Builder allows, you can
implement the Resolver trait on a struct and implement DNS resolution
however you see fit.
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Removes all entries from the cache.
-Sourcepub async fn lookup_txt<T>(
+
pub async fn lookup_txt<T>( +
Sourcepub async fn clear_cache(&self)
pub async fn clear_cache(&self)
Removes all entries from the cache.
+Sourcepub async fn lookup_txt<T>(
&self,
host: T,
timeout: Duration,
) -> Result<impl Iterator<Item = TxtRecordData>, DnsError>where
T: ToString,
pub async fn lookup_txt<T>(
&self,
host: T,
timeout: Duration,
) -> Result<impl Iterator<Item = TxtRecordData>, DnsError>where
T: ToString,
Looks up a TXT record.
-Sourcepub async fn lookup_ipv4<T>(
+
pub async fn lookup_ipv4<T>( +
Sourcepub async fn lookup_ipv4<T>(
&self,
host: T,
timeout: Duration,
) -> Result<impl Iterator<Item = IpAddr> + use<T>, DnsError>where
T: ToString,
pub async fn lookup_ipv4<T>(
&self,
host: T,
timeout: Duration,
) -> Result<impl Iterator<Item = IpAddr> + use<T>, DnsError>where
T: ToString,
Performs an IPv4 lookup with a timeout.
-Sourcepub async fn lookup_ipv6<T>(
+
pub async fn lookup_ipv6<T>( +
Sourcepub async fn lookup_ipv6<T>(
&self,
host: T,
timeout: Duration,
) -> Result<impl Iterator<Item = IpAddr> + use<T>, DnsError>where
T: ToString,
pub async fn lookup_ipv6<T>(
&self,
host: T,
timeout: Duration,
) -> Result<impl Iterator<Item = IpAddr> + use<T>, DnsError>where
T: ToString,
Performs an IPv6 lookup with a timeout.
-Sourcepub async fn lookup_ipv4_ipv6<T>(
+
pub async fn lookup_ipv4_ipv6<T>( +
Sourcepub async fn lookup_ipv4_ipv6<T>(
&self,
host: T,
timeout: Duration,
@@ -38,13 +38,13 @@ however you see fit.
LookupIpStrategy::Ipv4AndIpv6 will wait for ipv6 resolution timeout, even if it is
not usable on the stack, so we manually query both lookups concurrently and time them out
individually.
-
pub async fn lookup_ipv4_ipv6<T>( &self, host: T, timeout: Duration, @@ -38,13 +38,13 @@ however you see fit.
LookupIpStrategy::Ipv4AndIpv6 will wait for ipv6 resolution timeout, even if it is
not usable on the stack, so we manually query both lookups concurrently and time them out
individually.
Sourcepub async fn resolve_host(
+
pub async fn resolve_host( +
Sourcepub async fn resolve_host(
&self,
url: &Url,
prefer_ipv6: bool,
timeout: Duration,
) -> Result<IpAddr, DnsError>
pub async fn resolve_host( &self, url: &Url, prefer_ipv6: bool, timeout: Duration, ) -> Result<IpAddr, DnsError>
Resolves a hostname from a URL to an IP address.
-