Resolver

Trait Resolver 

Source
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§

Source

fn lookup_ipv4( &self, host: String, ) -> BoxFuture<Result<BoxIter<Ipv4Addr>, DnsError>>

Looks up an IPv4 address.

Source

fn lookup_ipv6( &self, host: String, ) -> BoxFuture<Result<BoxIter<Ipv6Addr>, DnsError>>

Looks up an IPv6 address.

Source

fn lookup_txt( &self, host: String, ) -> BoxFuture<Result<BoxIter<TxtRecordData>, DnsError>>

Looks up TXT records.

Source

fn clear_cache(&self)

Clears the internal cache.

Source

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.

Implementors§