Expand description

DNS Resolution used by the HttpConnector.

This module contains:

  • A GaiResolver that is the default resolver for the HttpConnector.
  • The Name type used as an argument to custom resolvers.

Resolvers are Services

A resolver is just a Service<Name, Response = impl Iterator<Item = SocketAddr>>.

A simple resolver that ignores the name and always returns a specific address:

use std::{convert::Infallible, iter, net::SocketAddr};

let resolver = tower::service_fn(|_name| async {
    Ok::<_, Infallible>(iter::once(SocketAddr::from(([127, 0, 0, 1], 8080))))
});

Structs

An iterator of IP addresses returned from getaddrinfo.

A future to resolve a name returned by GaiResolver.

A resolver using blocking getaddrinfo calls in a threadpool.

Error indicating a given string was not a valid domain name.

A domain name to resolve into IP addresses.