Skip to main content

lookup_host

Function lookup_host 

Source
pub async fn lookup_host<T: ToSocketAddrs>(
    host: T,
) -> Result<impl Iterator<Item = SocketAddr> + Send + 'static>
Expand description

Every address host names: numbers at once, a name looked up on the blocking pool. The iterator owns what it walks, so a slice given here is copied into it; the operations that take an address walk it in place.

let addrs: Vec<_> = nuclei::net::lookup_host("127.0.0.1:80").await?.collect();
assert_eq!(addrs, ["127.0.0.1:80".parse().unwrap()]);

ยงErrors

When the name cannot be looked up.