| Crates.io | hyper-trust-dns-connector |
| lib.rs | hyper-trust-dns-connector |
| version | 0.5.0 |
| created_at | 2019-03-27 15:23:35.807813+00 |
| updated_at | 2024-12-26 23:53:23.364814+00 |
| description | A compatibility crate to use hickory-dns asynchronously with hyper client, instead the default dns threadpool |
| homepage | |
| repository | https://github.com/paullgdc/hyper-trust-dns-connector |
| max_upload_size | |
| id | 124179 |
| size | 15,446 |
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.
By default hyper HttpConnector uses the std provided resolver wich is blocking in a threadpool with a configurable number of threads. This crate provides an alternative using hickory-resolver, a dns resolver written in Rust, with async features.
use hyper::{Body, Client};
use hyper_trust_dns_connector::new_async_http_connector;
#[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 status_code = client
.get(hyper::Uri::from_static("http://httpbin.org/ip"))
.await?
.status();
assert_eq!(status_code, 200);
Ok(())
}
If you need a feature implemented, or want to help, don't hesitate to open an issue or a PR.
Provided under the MIT license (LICENSE or http://opensource.org/licenses/MIT)