Skip to content

Add DNS over TCP, TLS, and QUIC support#813

Merged
ryanfowler merged 1 commit into
mainfrom
add-dns-tcp-tls-quic
Jun 30, 2026
Merged

Add DNS over TCP, TLS, and QUIC support#813
ryanfowler merged 1 commit into
mainfrom
add-dns-tcp-tls-quic

Conversation

@ryanfowler

Copy link
Copy Markdown
Owner

This PR extends --dns-server to support DNS over TCP, DNS over TLS (DoT), and DNS over QUIC (DoQ), in addition to the existing UDP and DoH transports.

New URL schemes

Scheme Transport Default port
IP[:PORT] / udp://IP[:PORT] UDP (TCP fallback on truncation) 53
tcp://IP[:PORT] DNS over TCP 53
tls://HOST[:PORT] / dot://HOST[:PORT] DNS over TLS 853
quic://HOST[:PORT] / doq://HOST[:PORT] DNS over QUIC 853
https://URL DoH existing

Implementation highlights

  • Shared scheme parsing and dispatch in src/dns/custom.rs.
  • New stream-based transports in src/dns/transport.rs for TCP, TLS (via tokio-rustls), and QUIC (via quinn with doq ALPN).
  • Pipelined A/AAAA resolution over one TCP/TLS connection and concurrent streams for QUIC in src/dns/resolver.rs.
  • --inspect-dns now supports all new transports.
  • Direct WebSocket dialing now uses the new transports via src/net.rs.
  • DoQ queries use DNS Message ID 0 per RFC 9250 §4.2.1.
  • Post-connect reads/writes are bounded by the remaining TimeoutBudget to prevent hangs.
  • Short framed DNS responses return an error instead of panicking.
  • Updated CLI help, configuration docs, advanced-features docs, and CLI reference docs.

Testing

  • Unit tests for scheme parsing (including bare IPv4/IPv6, bracketed IPv6, ports, and rejections).
  • TCP/TLS/QUIC lookup tests against local test servers.
  • Test for short framed DNS response handling.
  • Test for single-family TCP resolution used by WebSocket Happy Eyeballs.
  • Full existing test suite passes: cargo fmt --check, cargo clippy --locked --all-targets --all-features -- -D warnings, cargo test --locked --all-features --lib --bins, and integration tests for http/network/websocket.

Extend --dns-server to accept URL-style schemes for DNS over TCP
(tcp://), DNS over TLS (tls://, dot://), and DNS over QUIC
(quic://, doq://), in addition to the existing UDP and DoH support.

Key changes:
- Parse --dns-server values via a shared scheme dispatcher in
  src/dns/custom.rs.
- Add stream-based DNS transports in src/dns/transport.rs for TCP,
  TLS (tokio-rustls), and QUIC (quinn with doq ALPN).
- Implement pipelined A/AAAA resolution for TCP/TLS and concurrent
  streams for QUIC in src/dns/resolver.rs.
- Extend --inspect-dns to support all new transports.
- Wire new transports through WebSocket direct dialing in src/net.rs.
- Use DNS Message ID 0 for DoQ queries per RFC 9250.
- Bound post-connect reads/writes with the remaining TimeoutBudget to
  avoid hangs.
- Add validation for short framed DNS responses.
- Update CLI help, configuration docs, advanced-features docs, and
  CLI reference docs.

Tests added for scheme parsing, TCP/TLS/QUIC lookups, short frames,
  and single-family resolution.
@ryanfowler ryanfowler merged commit b771b8e into main Jun 30, 2026
4 checks passed
@ryanfowler ryanfowler deleted the add-dns-tcp-tls-quic branch June 30, 2026 19:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant