async fn resolve_host(host: &str) -> HashSet<SocketAddr> {
        let fut = tokio::net::lookup_host(host);
        let fut = tokio::time::timeout(crate::constants::DNS_LOOKUP_TIMEOUT, fut);

        match fut.await {
            Ok(Ok(ips)) => ips.collect(),
            Ok(Err(e)) => {
                tracing::info!(?host, ?e, "DNS error resolving peer IP address");
                HashSet::new()
            }
            Err(e) => {
                tracing::info!(?host, ?e, "DNS timeout resolving peer IP address");
                HashSet::new()
            }
        }
    }
/// Resolves `host` into zero or more IP addresses.
///
/// If `host` is a DNS name, performs DNS resolution with a timeout of a few seconds.
/// If DNS resolution fails or times out, returns an empty list.
Resolves `host` into zero or more IP addresses.
If `host` is a DNS name, performs DNS resolution with a timeout of a few seconds.
If DNS resolution fails or times out, returns an empty list.
Resolves ` host ` into zero or more IP addresses . If ` host ` is a DNS name performs DNS resolution with a timeout of a few seconds . If DNS resolution fails or times out returns an empty list .
async fn resolve_host(host: &str) -> HashSet<SocketAddr> {
        let fut = tokio::net::lookup_host(host);
        let fut = tokio::time::timeout(crate::constants::DNS_LOOKUP_TIMEOUT, fut);
        match fut.await {
            Ok(Ok(ips)) => ips.collect(),
            Ok(Err(e)) => {
                tracing::info!(?host, ?e, "DNS error resolving peer IP address");
                HashSet::new()
            }
            Err(e) => {
                tracing::info!(?host, ?e, "DNS timeout resolving peer IP address");
                HashSet::new()
            }
        }
    }
async fn resolve_host ( host : & str ) -> HashSet < SocketAddr > { let fut = tokio :: net :: lookup_host ( host ) ; let fut = tokio :: time :: timeout ( crate :: constants :: DNS_LOOKUP_TIMEOUT , fut ) ; match fut . await { Ok ( Ok ( ips ) ) => ips . collect ( ) , Ok ( Err ( e ) ) => { tracing :: info ! ( host e " " ) ; HashSet :: new ( ) } Err ( e ) => { tracing :: info ! ( host e " " ) ; HashSet :: new ( ) } } }
Resolves `host` into zero or more IP addresses.
Resolves ` host ` into zero or more IP addresses .
host
&str