#trust-dns #hyper #hyper-client #resolver #async #dns-resolver #hickory-dns

hyper-trust-dns-connector

A compatibility crate to use hickory-dns asynchronously with hyper client, instead the default dns threadpool

7 releases (breaking)

0.5.0 Dec 26, 2024
0.4.0 Apr 8, 2022
0.3.0 Jan 19, 2021
0.2.0 Feb 29, 2020
0.0.2 Mar 29, 2019

#253 in HTTP client

Download history 7/week @ 2024-09-18 11/week @ 2024-09-25 8/week @ 2024-10-02 9/week @ 2024-10-09 1/week @ 2024-10-16 3/week @ 2024-10-23 2/week @ 2024-10-30 5/week @ 2024-11-06 3/week @ 2024-11-13 1/week @ 2024-11-20 5/week @ 2024-11-27 10/week @ 2024-12-04 19/week @ 2024-12-11 1/week @ 2024-12-18 142/week @ 2024-12-25

172 downloads per month

MIT license

12KB
89 lines

hyper-trust-dns-connector

MIT licensed crates.io Released API docs

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.

Documentation

Motivations

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.

Example

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(())
}

Contributing

If you need a feature implemented, or want to help, don't hesitate to open an issue or a PR.

License

Provided under the MIT license (LICENSE or http://opensource.org/licenses/MIT)

Dependencies

~10–22MB
~318K SLoC