pub trait Resolver:
Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn lookup_ipv4(
&self,
host: String,
) -> BoxFuture<Result<BoxIter<Ipv4Addr>, DnsError>>;
fn lookup_ipv6(
&self,
host: String,
) -> BoxFuture<Result<BoxIter<Ipv6Addr>, DnsError>>;
fn lookup_txt(
&self,
host: String,
) -> BoxFuture<Result<BoxIter<TxtRecordData>, DnsError>>;
fn clear_cache(&self);
fn reset(&self) -> Box<dyn Resolver>;
}Expand description
Trait for DNS resolvers used in iroh.
Required Methods§
Sourcefn lookup_ipv4(
&self,
host: String,
) -> BoxFuture<Result<BoxIter<Ipv4Addr>, DnsError>>
fn lookup_ipv4( &self, host: String, ) -> BoxFuture<Result<BoxIter<Ipv4Addr>, DnsError>>
Looks up an IPv4 address.
Sourcefn lookup_ipv6(
&self,
host: String,
) -> BoxFuture<Result<BoxIter<Ipv6Addr>, DnsError>>
fn lookup_ipv6( &self, host: String, ) -> BoxFuture<Result<BoxIter<Ipv6Addr>, DnsError>>
Looks up an IPv6 address.
Sourcefn lookup_txt(
&self,
host: String,
) -> BoxFuture<Result<BoxIter<TxtRecordData>, DnsError>>
fn lookup_txt( &self, host: String, ) -> BoxFuture<Result<BoxIter<TxtRecordData>, DnsError>>
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.