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
Create 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
Create 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
Create a new DNS resolver configured with a single UDP DNS nameserver.
-Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Removes all entries from the cache.
-Sourcepub async fn lookup_txt(
+
pub async fn lookup_txt( +
Sourcepub fn with_nameserver(nameserver: SocketAddr) -> DnsResolver
pub fn with_nameserver(nameserver: SocketAddr) -> DnsResolver
Create a new DNS resolver configured with a single UDP DNS nameserver.
+Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Removes all entries from the cache.
+Sourcepub async fn lookup_txt(
&self,
host: impl ToString,
timeout: Duration,
) -> Result<TxtLookup, DnsError>
pub async fn lookup_txt( &self, host: impl ToString, timeout: Duration, ) -> Result<TxtLookup, DnsError>
Lookup a TXT record.
-Sourcepub async fn lookup_ipv4(
+
pub async fn lookup_ipv4( +
Sourcepub async fn lookup_ipv4(
&self,
host: impl ToString,
timeout: Duration,
) -> Result<impl Iterator<Item = IpAddr>, DnsError>
pub async fn lookup_ipv4( &self, host: impl ToString, timeout: Duration, ) -> Result<impl Iterator<Item = IpAddr>, DnsError>
Perform an ipv4 lookup with a timeout.
-Sourcepub async fn lookup_ipv6(
+
pub async fn lookup_ipv6( +
Sourcepub async fn lookup_ipv6(
&self,
host: impl ToString,
timeout: Duration,
) -> Result<impl Iterator<Item = IpAddr>, DnsError>
pub async fn lookup_ipv6( &self, host: impl ToString, timeout: Duration, ) -> Result<impl Iterator<Item = IpAddr>, DnsError>
Perform an ipv6 lookup with a timeout.
-Sourcepub async fn lookup_ipv4_ipv6(
+
pub async fn lookup_ipv4_ipv6( +
Sourcepub async fn lookup_ipv4_ipv6(
&self,
host: impl ToString,
timeout: Duration,
@@ -28,74 +28,74 @@ to the default ResolverConfig which uses eg. to google’s 8.
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(
&self,
host: impl ToString,
timeout: Duration,
@@ -28,74 +28,74 @@ to the default ResolverConfig which uses eg. to google’s 8.
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.
-
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>
Resolve a hostname from a URL to an IP address.
-