iroh_net::dns

Trait ResolverExt

Source
pub trait ResolverExt {
    // Required methods
    fn lookup_ipv4<N: IntoName>(
        &self,
        host: N,
        timeout: Duration,
    ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>;
    fn lookup_ipv6<N: IntoName>(
        &self,
        host: N,
        timeout: Duration,
    ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>;
    fn lookup_ipv4_ipv6<N: IntoName + Clone>(
        &self,
        host: N,
        timeout: Duration,
    ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>;
    fn lookup_by_name(
        &self,
        name: &str,
    ) -> impl Future<Output = Result<NodeAddr>>;
    fn lookup_by_id(
        &self,
        node_id: &NodeId,
        origin: &str,
    ) -> impl Future<Output = Result<NodeAddr>>;
    fn lookup_ipv4_staggered<N: IntoName + Clone>(
        &self,
        host: N,
        timeout: Duration,
        delays_ms: &[u64],
    ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>;
    fn lookup_ipv6_staggered<N: IntoName + Clone>(
        &self,
        host: N,
        timeout: Duration,
        delays_ms: &[u64],
    ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>;
    fn lookup_ipv4_ipv6_staggered<N: IntoName + Clone>(
        &self,
        host: N,
        timeout: Duration,
        delays_ms: &[u64],
    ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>;
    fn lookup_by_name_staggered(
        &self,
        name: &str,
        delays_ms: &[u64],
    ) -> impl Future<Output = Result<NodeAddr>>;
    fn lookup_by_id_staggered(
        &self,
        node_id: &NodeId,
        origin: &str,
        delays_ms: &[u64],
    ) -> impl Future<Output = Result<NodeAddr>>;
}
Expand description

Extension trait to DnsResolver.

Required Methods§

Source

fn lookup_ipv4<N: IntoName>( &self, host: N, timeout: Duration, ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>

Perform an ipv4 lookup with a timeout.

Source

fn lookup_ipv6<N: IntoName>( &self, host: N, timeout: Duration, ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>

Perform an ipv6 lookup with a timeout.

Source

fn lookup_ipv4_ipv6<N: IntoName + Clone>( &self, host: N, timeout: Duration, ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>

Race an ipv4 and ipv6 lookup with a timeout.

Source

fn lookup_by_name(&self, name: &str) -> impl Future<Output = Result<NodeAddr>>

Looks up node info by DNS name.

Source

fn lookup_by_id( &self, node_id: &NodeId, origin: &str, ) -> impl Future<Output = Result<NodeAddr>>

Looks up node info by NodeId and origin domain name.

Source

fn lookup_ipv4_staggered<N: IntoName + Clone>( &self, host: N, timeout: Duration, delays_ms: &[u64], ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>

Perform an ipv4 lookup with a timeout in a staggered fashion.

From the moment this function is called, each lookup is scheduled after the delays in delays_ms with the first call being done immediately. [200ms, 300ms] results in calls at T+0ms, T+200ms and T+300ms. The timeout is applied to each call individually. The result of the first successful call is returned, or a summary of all errors otherwise.

Source

fn lookup_ipv6_staggered<N: IntoName + Clone>( &self, host: N, timeout: Duration, delays_ms: &[u64], ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>

Perform an ipv6 lookup with a timeout in a staggered fashion.

From the moment this function is called, each lookup is scheduled after the delays in delays_ms with the first call being done immediately. [200ms, 300ms] results in calls at T+0ms, T+200ms and T+300ms. The timeout is applied to each call individually. The result of the first successful call is returned, or a summary of all errors otherwise.

Source

fn lookup_ipv4_ipv6_staggered<N: IntoName + Clone>( &self, host: N, timeout: Duration, delays_ms: &[u64], ) -> impl Future<Output = Result<impl Iterator<Item = IpAddr>>>

Race an ipv4 and ipv6 lookup with a timeout in a staggered fashion.

From the moment this function is called, each lookup is scheduled after the delays in delays_ms with the first call being done immediately. [200ms, 300ms] results in calls at T+0ms, T+200ms and T+300ms. The timeout is applied as stated in Self::lookup_ipv4_ipv6. The result of the first successful call is returned, or a summary of all errors otherwise.

Source

fn lookup_by_name_staggered( &self, name: &str, delays_ms: &[u64], ) -> impl Future<Output = Result<NodeAddr>>

Looks up node info by DNS name in a staggered fashion.

From the moment this function is called, each lookup is scheduled after the delays in delays_ms with the first call being done immediately. [200ms, 300ms] results in calls at T+0ms, T+200ms and T+300ms. The result of the first successful call is returned, or a summary of all errors otherwise.

Source

fn lookup_by_id_staggered( &self, node_id: &NodeId, origin: &str, delays_ms: &[u64], ) -> impl Future<Output = Result<NodeAddr>>

Looks up node info by NodeId and origin domain name.

From the moment this function is called, each lookup is scheduled after the delays in delays_ms with the first call being done immediately. [200ms, 300ms] results in calls at T+0ms, T+200ms and T+300ms. The result of the first successful call is returned, or a summary of all errors otherwise.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§