Expand description
§hyper_trust_dns_connector
A crate to make hickory-resolver’s (previously trust_dns_resolver) asynchronous resolver compatible with hyper client, to use instead of the default dns threadpool.
§Features
hyper-tls-connector
This feature includeshyper-tls
andnative-tls
to provide a helper function to create a tls connector.
§Usage
hickory-resolver creates an async resolver for dns queries, which is then used by hyper
§Example
use hyper_trust_dns_connector::new_async_http_connector;
use hyper::{Client, Body};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let http = new_async_http_connector()?;
let client = Client::builder().build::<_, Body>(http);
let res = client.get(hyper::Uri::from_static("http://httpbin.org/ip"))
.await?;
assert_eq!(res.status(), 200);
Ok(())
}
Modules§
Structs§
- Async
Hyper Resolver - Wrapper around hickory-resolver’s
TokioAsyncResolver
Functions§
- new_
async_ http_ connector - A helper function to create an http connector and a dns task with the default configuration