3 unstable releases

0.1.0 May 8, 2024
0.0.2 Jan 25, 2024
0.0.1 Jan 25, 2024

#1269 in Command line utilities

Download history 2606/week @ 2024-02-23 2439/week @ 2024-03-01 1583/week @ 2024-03-08 2665/week @ 2024-03-15 2376/week @ 2024-03-22 2129/week @ 2024-03-29 1621/week @ 2024-04-05 1238/week @ 2024-04-12 1691/week @ 2024-04-19 1493/week @ 2024-04-26 1744/week @ 2024-05-03 3271/week @ 2024-05-10 2207/week @ 2024-05-17 1902/week @ 2024-05-24 2031/week @ 2024-05-31 1451/week @ 2024-06-07

8,096 downloads per month

Apache-2.0

10KB

reqwest-hickory-resolver   Build Status Latest Version

reqwest-hickory-resolver is the resolver for reqwest based on hickory-dns.

Quick Start

Init client with HickoryResolver.

use std::sync::Arc;

use reqwest::ClientBuilder;
use reqwest_hickory_resolver::HickoryResolver;

fn init_with_hickory_resolver() -> reqwest::Result<()> {
    let mut builder = ClientBuilder::new();
    builder = builder.dns_resolver(Arc::new(HickoryResolver::default()));
    builder.build()?;
    Ok(())
}

HickoryResolver has cache support, we can share the same resolver across different client for better performance.

use std::sync::Arc;
use once_cell::sync::Lazy;
use reqwest::ClientBuilder;
use reqwest_hickory_resolver::HickoryResolver;

static GLOBAL_RESOLVER: Lazy<Arc<HickoryResolver>> =
    Lazy::new(|| Arc::new(HickoryResolver::default()));
    
fn init_with_hickory_resolver() -> reqwest::Result<()> {
    let mut builder = ClientBuilder::new();
    builder = builder.dns_resolver(GLOBAL_RESOLVER.clone());
    builder.build()?;
    Ok(())
}

Contributing

Check out the CONTRIBUTING.md guide for more details on getting started with contributing to this project.

Getting help

Submit issues for bug report or asking questions in discussion.

Acknowledgements

This project is based on reqwest's TrustDnsResolver.

License

Licensed under Apache License, Version 2.0.

Dependencies

~9–21MB
~315K SLoC