#hickory #http-request #resolver #client #hickory-dns

reqwest-hickory-resolver

hickory resolver support for reqwest

3 unstable releases

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

#1489 in Command line utilities

Download history 1800/week @ 2024-07-24 1796/week @ 2024-07-31 1544/week @ 2024-08-07 1679/week @ 2024-08-14 980/week @ 2024-08-21 1004/week @ 2024-08-28 1281/week @ 2024-09-04 858/week @ 2024-09-11 1228/week @ 2024-09-18 760/week @ 2024-09-25 290/week @ 2024-10-02 1108/week @ 2024-10-09 889/week @ 2024-10-16 1237/week @ 2024-10-23 1281/week @ 2024-10-30 741/week @ 2024-11-06

4,246 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–20MB
~282K SLoC