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

hyper-trust-dns-connector

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

6 releases (breaking)

0.4.0 Apr 8, 2022
0.3.0 Jan 19, 2021
0.2.0 Feb 29, 2020
0.1.0 Mar 31, 2019
0.0.2 Mar 29, 2019

#515 in HTTP client

Download history 6/week @ 2024-01-06 1/week @ 2024-01-20 1/week @ 2024-01-27 4/week @ 2024-02-03 2/week @ 2024-02-17 21/week @ 2024-02-24 42/week @ 2024-03-02 23/week @ 2024-03-09 3/week @ 2024-03-16 10/week @ 2024-03-23

83 downloads per month

MIT license

11KB
89 lines

hyper-trust-dns-connector

MIT licensed Released API docs

A crate to make trust-dns-resolver's 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 trust_dns_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

~9–23MB
~331K SLoC