Expand description

hyper_trust_dns_connector

A crate to make trust-dns-resolver’s asynchronous resolver compatible with hyper client, to use instead of the default dns threadpool.

Features

  • hyper-tls-connector This feature includes hyper-tls and native-tls to provide a helper function to create a tls connector.

Usage

trust-dns-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

httpshyper-tls-connector

Provides a helper method to create an https connector using hyper-tls

Structs

Wrapper around trust-dns-resolver’s TokioAsyncResolver

Functions

A helper function to create an http connector and a dns task with the default configuration