pub trait Resolver:
Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn lookup_ipv4(
&self,
host: String,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = Ipv4Addr> + Send>, DnsError>> + Send>>;
fn lookup_ipv6(
&self,
host: String,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = Ipv6Addr> + Send>, DnsError>> + Send>>;
fn lookup_txt(
&self,
host: String,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = TxtRecordData> + Send>, DnsError>> + Send>>;
fn clear_cache(&self);
fn reset(&self) -> Box<dyn Resolver>;
}Available on non-
wasm_browser only.Expand description
Trait for DNS resolvers used in iroh.
Required Methods§
Sourcefn lookup_ipv4(
&self,
host: String,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = Ipv4Addr> + Send>, DnsError>> + Send>>
fn lookup_ipv4( &self, host: String, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = Ipv4Addr> + Send>, DnsError>> + Send>>
Looks up an IPv4 address.
Sourcefn lookup_ipv6(
&self,
host: String,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = Ipv6Addr> + Send>, DnsError>> + Send>>
fn lookup_ipv6( &self, host: String, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = Ipv6Addr> + Send>, DnsError>> + Send>>
Looks up an IPv6 address.
Sourcefn lookup_txt(
&self,
host: String,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = TxtRecordData> + Send>, DnsError>> + Send>>
fn lookup_txt( &self, host: String, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = TxtRecordData> + Send>, DnsError>> + Send>>
Looks up TXT records.
Sourcefn clear_cache(&self)
fn clear_cache(&self)
Clears the internal cache.
Sourcefn reset(&self) -> Box<dyn Resolver>
fn reset(&self) -> Box<dyn Resolver>
Returns a freshly-built resolver to replace self after a network change.
The returned resolver replaces the previous one inside DnsResolver via an
atomic swap. Build a new instance with re-bound sockets and re-read nameserver
configuration rather than mutating in place. Must not perform IO: defer DNS
queries and socket binds until the new resolver is first used. May be called
concurrently, in which case all but one allocated replacement is dropped unused.