Resolver

Trait Resolver 

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

Source

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.

Source

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.

Source

fn lookup_txt( &self, host: String, ) -> Pin<Box<dyn Future<Output = Result<Box<dyn Iterator<Item = TxtRecordData> + Send>, DnsError>> + Send>>

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§