Skip to main content

resolve_host

Function resolve_host 

Source
pub async fn resolve_host(host: &str) -> Result<IpAddr, ResolveHostError>
Expand description

Resolves a host to an IP address.

host can be an IP literal, which is parsed without a DNS lookup, or a hostname, which is resolved using the system resolver. When a hostname resolves to several addresses, the first one is returned.

ยงErrors

If the lookup fails, ResolveHostError::LookupFailed is returned. If the lookup succeeds but returns no addresses, ResolveHostError::NoAddresses is returned.