Skip to content

deps!: replace hickory with simple-dns and n0-dns-resolver - #93

Merged
Frando merged 5 commits into
mainfrom
deps/simple-dns
Nov 26, 2026
Merged

Frando merged 5 commits into
mainfrom
deps/simple-dns

Conversation

@Frando

@Frando Frando commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Problem

The lab DNS server uses hickory-proto to parse queries and to write A,
AAAA and TXT answers. The tests use hickory-resolver as a client. Both
are large for what we need. iroh now uses simple-dns and
n0-dns-resolver.

Approach

  • dns_server.rs uses simple-dns. Names in simple-dns compare
    without ASCII case and ignore the trailing dot. Thus the store keys on
    Name directly and no longer needs LowerName.
  • DnsServer::remove took a hickory RecordType. It now takes a new
    patchbay::dns_server::RecordType (A, Aaaa, Txt). The public
    API does not expose a type from the DNS crate.
  • set_txt checks each value when you set the record. A value longer
    than 255 bytes returns an error.
  • The DNS tests use n0_dns_resolver::DnsResolver in place of
    hickory-resolver. A shared lookup_first_v4 helper replaces the
    repeated resolver setup.
  • hickory-resolver turned on the rt-multi-thread feature of tokio,
    and examples/simple.rs needs it. A tokio dev-dependency now turns it
    on, so builds of patchbay alone still work.

Breaking changes

  • DnsServer::remove takes patchbay::dns_server::RecordType instead
    of hickory_proto::rr::RecordType.

Impact

  • No hickory crate remains in Cargo.lock.
  • The server drops a query for a record type that simple-dns does not
    know, and the client times out. Before, the server answered NOERROR or
    NXDOMAIN. The module docs list this limit.
  • New unit tests check handle_query for case, response flags, NOERROR
    and NXDOMAIN. New lab tests read a TXT record over DNS, and cover
    DnsServer::remove and the TXT length limit.

🤖 Generated with Claude Code

@Frando
Frando marked this pull request as ready for review November 23, 2026 13:10
@Frando
Frando changed the base branch from deps/futures-lite to main November 23, 2026 13:13
Frando and others added 2 commits November 26, 2026 09:20
The lab DNS server only parses queries and writes A, AAAA and TXT
answers. `simple-dns` covers this. It is a small crate that only depends on
`bitflags`. Names in `simple-dns` compare without ASCII case and
ignore the trailing dot, so the store no longer needs `LowerName`.

`DnsServer::remove` took a hickory `RecordType`. It now takes a new
`patchbay::dns_server::RecordType` with `A`, `Aaaa` and `Txt` variants,
so the public API no longer exposes a DNS crate type.

`set_txt` now checks each value when the record is set. A value longer
than 255 bytes returns an error.

New unit tests check `handle_query` for case, response flags, NOERROR
and NXDOMAIN. A new lab test reads a TXT record over DNS.

- `DnsServer::remove` takes `patchbay::dns_server::RecordType` instead
  of `hickory_proto::rr::RecordType`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The DNS tests used `hickory-resolver` as a real resolver client inside
device namespaces. iroh now resolves with `n0-dns-resolver`, so the
tests use it too. This removes the last hickory crate from the
workspace.

A shared `lookup_first_v4` helper replaces `first_a` and the repeated
resolver setup. The tests drop the `hickory_` prefix. One test uses
`DnsResolver::system_with_fallback()`, the others read only the system
configuration.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Frando and others added 3 commits November 26, 2026 09:37
The `hickory-resolver` dev-dependency turned on the `rt-multi-thread`
feature of tokio. `examples/simple.rs` uses `#[tokio::main]` and needs
this feature. Without it, builds of `patchbay` alone fail. This includes
the CI step `cargo clippy -p patchbay --no-default-features
--all-targets` and also `cargo test -p patchbay`. A tokio dev-dependency
now turns the feature on.

The `dns-server` feature now uses `dep:simple-dns`. Without `dep:`,
Cargo adds an implicit public feature named `simple-dns`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`set_txt` gets an `# Errors` section for invalid names and for values
longer than 255 bytes.

The module docs said that the server truncates responses over 512
bytes. It does not: it sends the full response and never sets the TC
flag. The docs also list a new limit. The server drops a query that
`simple-dns` cannot parse, for example a query for an unknown record
type. The client then times out.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
`remove_record_by_type` checks that `remove` deletes only the record of
the given type and ignores the case of the name. `txt_value_length_limit`
checks that `set_txt` accepts a 255-byte value and rejects a 256-byte
value.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Frando
Frando merged commit 72070a5 into main Nov 26, 2026
4 checks passed
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