Skip to main content

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

Discord

§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 ring or aws-lc-rs
  • 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.6"
  • tokio

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

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

§Feature Matrix

FeatureDescriptionEnable With
Runtimes
tokioTokio runtime supportfeatures = ["tokio"]
smolSmol runtime supportfeatures = ["smol"]
Transport Protocols
tls-ringDNS over TLS (ring crypto)features = ["tls-ring"]
tls-aws-lc-rsDNS over TLS (aws-lc-rs crypto)features = ["tls-aws-lc-rs"]
https-ringDNS over HTTPS (ring crypto)features = ["https-ring"]
https-aws-lc-rsDNS over HTTPS (aws-lc-rs crypto)features = ["https-aws-lc-rs"]
quic-ringDNS over QUIC (ring crypto)features = ["quic-ring"]
quic-aws-lc-rsDNS over QUIC (aws-lc-rs crypto)features = ["quic-aws-lc-rs"]
h3-ringDNS over HTTP/3 (ring crypto)features = ["h3-ring"]
h3-aws-lc-rsDNS over HTTP/3 (aws-lc-rs crypto)features = ["h3-aws-lc-rs"]
Certificates
webpki-rootsUse webpki root certificatesfeatures = ["webpki-roots"]
rustls-platform-verifierUse platform certificate verifierfeatures = ["rustls-platform-verifier"]
DNSSEC
dnssec-ringDNSSEC with ring cryptofeatures = ["dnssec-ring"]
dnssec-aws-lc-rsDNSSEC with aws-lc-rs cryptofeatures = ["dnssec-aws-lc-rs"]
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
AsyncDnsUdp
DNS udp
AsyncRuntimeProvider
Defines which async runtime that handles IO and timers.
AsyncSpawn
Async spawner
ConnectionConfig
Configuration for a connection to a nameserver
NameServerConfig
Configuration for the NameServer
OpportunisticEncryptionConfig
Configuration parameters for opportunistic encryption.
OpportunisticEncryptionPersistence
Configuration for persistence of opportunistic encryption probe state.
ResolverConfig
Configuration for the upstream nameservers to use for resolution
ResolverOpts
Configuration for the Resolver
ServerGroup
A group of DNS servers.
Timer
Timer implementation for the dns.

Enums§

LookupIpStrategy
The lookup ip strategy
OpportunisticEncryption
Configuration for enabling RFC 9539 opportunistic encryption.
ProtocolConfig
Protocol configuration
ResolveHosts
Whether the system hosts file should be respected by the resolver.
ServerOrderingStrategy
The strategy for establishing the query order of name servers in a pool.

Constants§

CLOUDFLARE
Cloudflare’s 1.1.1.1 DNS service configuration.
GOOGLE
Google Public DNS configuration.
QUAD9
The Quad9 DNS service configuration.

Functions§

parse_resolv_confUnix and non-Android and non-Apple
read_resolv_confUnix and non-Android and non-Apple
Read the DNS configuration from a file.
read_system_confUnix or Windows

Type Aliases§

AsyncConnectionProvider
Creates DNS connections with the help of AsyncRuntimeProvider.
Dns
Agnostic async DNS resolver