Expand description
§hyper-hickory
This crate provides a HTTP connector for hyper that uses the fast and advanced DNS resolver of hickory instead of the default threadpool implementation of hyper.
§Usage
use http_body_util::Full; // Or your preferred Body implementation
use hyper::body::Bytes;
use hyper_hickory::TokioHickoryResolver;
use hyper_util::{client::legacy::Client, rt::TokioExecutor};
let connector = TokioHickoryResolver::default().into_http_connector();
let client: Client<_, Full<Bytes>> = Client::builder(TokioExecutor::new()).build(connector);
§Resolvers
There is a HickoryResolver
resolver which can be built from an Resolver
using HickoryResolver::from_resolver
.
For most cases where you are happy to use the standard TokioRuntimeProvider
, the TokioHickoryResolver
should be used and is able to be built much more easily. It requires enabling the tokio
feature flag.
§Types of connectors
There are 2 connectors:
HickoryHttpConnector<C>
, a wrapper aroundHttpConnector<HickoryResolver<C>>
. Created withHickoryResolver::into_http_connector
.TokioHickoryHttpConnector
, an alias toHickoryHttpConnector<TokioConnectionProvider>
.
§Hickory options
The crate has other features that toggle functionality in hickory-resolver, such as DNSSEC or DOH / DOT.
Structs§
- Hickory
Resolver - A hyper resolver using
hickory
’sResolver
and any implementor ofConnectionProvider
. - Socket
Addrs - Iterator over DNS lookup results.
Type Aliases§
- Hickory
Http Connector - A
HttpConnector
that uses theHickoryResolver
. - Tokio
Hickory Http Connector tokio
- A
HttpConnector
that uses theTokioHickoryResolver
. - Tokio
Hickory Resolver tokio
- A hyper resolver using
hickory
’sTokioResolver
.