Trait timeout_io::DnsResolvable[][src]

pub trait DnsResolvable {
    fn dns_resolve(&self, timeout: Duration) -> Result<SocketAddr>;
}

A trait for elements that contains a DNS-resolvable address

Required Methods

Resolves a domain-name or IP-address

Warning: because getaddrinfo only provides a synchronously API, we have to resolve in a background-thread. This means the background-thread may outlive this call until the OS' connect-timeout is reached.

Important: If you want to resolve an address like "localhost" or "crates.io" you must include the target-port-number like this: "localhost:80" or "crates.io:443"

Parameters:

  • timeout: The maximum time this function will wait until the address is resolved

Returns either the resolved address or a corresponding IoError

Implementors