feat(client): add Resolve, used by HttpConnector

This introduces a `Resolve` trait to describe asynchronous DNS
resolution. The `HttpConnector` can be configured with a resolver,
allowing a user to still use all the functionality of the
`HttpConnector`, while customizing the DNS resolution.

To prevent a breaking change, the `HttpConnector` has its `Resolve`
generic set by default to `GaiResolver`. This is same as the existing
resolver, which uses `getaddrinfo` inside a thread pool.

Closes #1517
This commit is contained in:
Sean McArthur
2018-10-17 16:06:49 -07:00
parent 8bfe3c220c
commit 2d5af177c1
4 changed files with 256 additions and 103 deletions

View File

@@ -15,6 +15,7 @@ use tokio_io::{AsyncRead, AsyncWrite};
#[cfg(feature = "runtime")] mod dns;
#[cfg(feature = "runtime")] mod http;
#[cfg(feature = "runtime")] pub use self::dns::{GaiResolver, Name, Resolve};
#[cfg(feature = "runtime")] pub use self::http::{HttpConnector, HttpInfo};
/// Connect to a destination, returning an IO transport.