Crate agnostic_dns

Crate agnostic_dns 

Source
Expand description

Agnostic DNS

agnostic-dns is an agnostic abstraction layer over hickory-dns.

github LoC Build codecov

docs.rs crates.io crates.io license

§Introduction

agnostic-dns provides runtime-agnostic DNS resolution built on hickory-dns. It supports multiple transport protocols (UDP, TCP, DoT, DoH, DoQ, DoH3) and DNSSEC validation - all working seamlessly across tokio, and smol runtimes.

§Key Features

  • Multiple Transport Protocols:
    • DNS over UDP/TCP (standard)
    • DNS over TLS (DoT)
    • DNS over HTTPS (DoH)
    • DNS over QUIC (DoQ)
    • DNS over HTTP/3 (DoH3)
  • DNSSEC Support: Validate DNS responses with OpenSSL or ring
  • Runtime Agnostic: Works with tokio, and smol
  • Flexible Configuration: Use system settings or custom resolvers
  • Comprehensive: Built on the mature hickory-dns library

§Supported Runtimes

  • tokio - Enable with features = ["tokio"]
  • smol - Enable with features = ["smol"]

§Installation

[dependencies]
agnostic-dns = "0.3"
  • tokio

    agnostic-dns = { version = "0.3", features = ["tokio"] }
  • smol

    agnostic-dns = { version = "0.3", features = ["smol"] }

§Feature Matrix

FeatureDescriptionEnable With
Core
dnsBasic DNS resolutionDefault
Runtimes
tokioTokio runtime supportfeatures = ["tokio"]
smolSmol runtime supportfeatures = ["smol"]
Transport Protocols
dns-over-rustlsDNS over TLS with rustlsfeatures = ["dns-over-rustls"]
dns-over-opensslDNS over TLS with OpenSSLfeatures = ["dns-over-openssl"]
dns-over-native-tlsDNS over TLS with native-tlsfeatures = ["dns-over-native-tls"]
dns-over-https-rustlsDNS over HTTPS with rustlsfeatures = ["dns-over-https-rustls"]
dns-over-quicDNS over QUIC (RFC 9250)features = ["dns-over-quic"]
dns-over-h3DNS over HTTP/3features = ["dns-over-h3"]
Certificates
dns-webpki-rootsUse webpki root certificatesfeatures = ["dns-webpki-roots"]
dns-native-certsUse OS native certificatesfeatures = ["dns-native-certs"]
DNSSEC
dnssecBasic DNSSEC validationfeatures = ["dnssec"]
dnssec-opensslDNSSEC with OpenSSL cryptofeatures = ["dnssec-openssl"]
dnssec-ringDNSSEC with ring cryptofeatures = ["dnssec-ring"]
Other
tracingDistributed tracing supportfeatures = ["tracing"]
§License

agnostic-dns is under the terms of both the MIT license and the Apache License (Version 2.0).

See LICENSE-APACHE, LICENSE-MIT for details.

Copyright (c) 2025 Al Liu.

Re-exports§

pub use agnostic_net as net;

Structs§

AgnosticTime
DNS time
AsyncConnectionProvider
Create DnsHandle with the help of AsyncRuntimeProvider.
AsyncDnsUdp
DNS udp
AsyncRuntimeProvider
Defines which async runtime that handles IO and timers.
AsyncSpawn
Async spawner
NameServerConfig
Configuration for the NameServer
NameServerConfigGroup
A set of name_servers to associate with a ResolverConfig.
ResolverConfig
Configuration for the upstream nameservers to use for resolution
ResolverOpts
Configuration for the Resolver
Timer
Timer implementation for the dns.

Enums§

LookupIpStrategy
The lookup ip strategy
Protocol
The protocol on which a NameServer should be communicated with
ServerOrderingStrategy
The strategy for establishing the query order of name servers in a pool.

Constants§

CLOUDFLARE_IPS
IP addresses for Cloudflare’s 1.1.1.1 DNS service
GOOGLE_IPS
IP addresses for Google Public DNS
QUAD9_IPS
IP address for the Quad9 DNS service

Functions§

parse_resolv_confUnix
read_resolv_confUnix
Read the DNS configuration from a file.
read_system_conf

Type Aliases§

Dns
Agnostic aysnc DNS resolver