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

        match fut.await {
            Ok(Ok(ip_addrs)) => {
                let ip_addrs: Vec<SocketAddr> = ip_addrs.map(canonical_socket_addr).collect();

                // if we're logging at debug level,
                // the full list of IP addresses will be shown in the log message
                let debug_span = debug_span!("", remote_ip_addrs = ?ip_addrs);
                let _span_guard = debug_span.enter();
                info!(seed = ?host, remote_ip_count = ?ip_addrs.len(), "resolved seed peer IP addresses");

                for ip in &ip_addrs {
                    // Count each initial peer, recording the seed config and resolved IP address.
                    //
                    // If an IP is returned by multiple seeds,
                    // each duplicate adds 1 to the initial peer count.
                    // (But we only make one initial connection attempt to each IP.)
                    metrics::counter!(
                        "zcash.net.peers.initial",
                        1,
                        "seed" => host.to_string(),
                        "remote_ip" => ip.to_string()
                    );
                }

                Ok(ip_addrs.into_iter().collect())
            }
            Ok(Err(e)) => {
                tracing::info!(?host, ?e, "DNS error resolving peer IP addresses");
                Err(e.into())
            }
            Err(e) => {
                tracing::info!(?host, ?e, "DNS timeout resolving peer IP addresses");
                Err(e.into())
            }
        }
    }
/// 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 error.
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 error.
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 error .
async fn resolve_host_once(host: &str) -> Result<HashSet<SocketAddr>, BoxError> {
        let fut = tokio::net::lookup_host(host);
        let fut = tokio::time::timeout(crate::constants::DNS_LOOKUP_TIMEOUT, fut);
        match fut.await {
            Ok(Ok(ip_addrs)) => {
                let ip_addrs: Vec<SocketAddr> = ip_addrs.map(canonical_socket_addr).collect();
                // if we're logging at debug level,
                // the full list of IP addresses will be shown in the log message
                let debug_span = debug_span!("", remote_ip_addrs = ?ip_addrs);
                let _span_guard = debug_span.enter();
                info!(seed = ?host, remote_ip_count = ?ip_addrs.len(), "resolved seed peer IP addresses");
                for ip in &ip_addrs {
                    // Count each initial peer, recording the seed config and resolved IP address.
                    //
                    // If an IP is returned by multiple seeds,
                    // each duplicate adds 1 to the initial peer count.
                    // (But we only make one initial connection attempt to each IP.)
                    metrics::counter!(
                        "zcash.net.peers.initial",
                        1,
                        "seed" => host.to_string(),
                        "remote_ip" => ip.to_string()
                    );
                }
                Ok(ip_addrs.into_iter().collect())
            }
            Ok(Err(e)) => {
                tracing::info!(?host, ?e, "DNS error resolving peer IP addresses");
                Err(e.into())
            }
            Err(e) => {
                tracing::info!(?host, ?e, "DNS timeout resolving peer IP addresses");
                Err(e.into())
            }
        }
    }
async fn resolve_host_once ( host : & str ) -> Result < HashSet < SocketAddr > , BoxError > { let fut = tokio :: net :: lookup_host ( host ) ; let fut = tokio :: time :: timeout ( crate :: constants :: DNS_LOOKUP_TIMEOUT , fut ) ; match fut . await { Ok ( Ok ( ip_addrs ) ) => { let ip_addrs : Vec < SocketAddr > = ip_addrs . map ( canonical_socket_addr ) . collect ( ) ; // if we're logging at debug level, // the full list of IP addresses will be shown in the log message let debug_span = debug_span ! ( " " remote_ip_addrs ip_addrs ) ; let _span_guard = debug_span . enter ( ) ; info ! ( seed host remote_ip_count ip_addrs len ( ) " " ) ; for ip in & ip_addrs { // Count each initial peer, recording the seed config and resolved IP address. // // If an IP is returned by multiple seeds, // each duplicate adds 1 to the initial peer count. // (But we only make one initial connection attempt to each IP.) metrics :: counter ! ( " " 1 " " host to_string ( ) " " ip to_string ( ) ) ; } Ok ( ip_addrs . into_iter ( ) . collect ( ) ) } Ok ( Err ( e ) ) => { tracing :: info ! ( host e " " ) ; Err ( e . into ( ) ) } Err ( e ) => { tracing :: info ! ( host e " " ) ; Err ( e . into ( ) ) } } }
Resolves `host` into zero or more IP addresses.
Resolves ` host ` into zero or more IP addresses .
host
&str