mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #3169] Simplification of the Authority trait #1149
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#1149
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @divergentdave on GitHub (Jul 30, 2025).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/3169
The Authority trait has a lot of methods that serve overlapping purposes. It seems like
Authority::lookup()is mainly used in tests and in specialty methods that look up particular record types in order to fill out the authorities section of authoritative responses. On the other hand,Authority::search()takes in the entire request, not just a query name and query type. I think we could significantly simplify the Authority trait if we refactored server code so that theAuthoritytrait just takes in a request message and produces a response message, not anAuthLookup. This would entail the following changes.Authority::search()seems like a win-win. This would let us remove theAuthLookup::AXFRvariant as well.Authoritymethods to return response messages instead ofLookup, and foldbuild_authoritative_response()andbuild_forwarded_response()into their respective authorities. This will also enable further simplifications and bug fixes by removing the intermediateLookuporAuthLookup.Authority::ns(),Authority::soa(), andAuthority::soa_secure(), which are all used only inbuild_authoritative_response()or AXFR code.Authority::lookup(), and rewrite tests to construct mock requests to pass toAuthority::search().Authority, as appropriate.See also https://github.com/hickory-dns/hickory-dns/pull/3164#discussion_r2243244017
@djc commented on GitHub (Jul 30, 2025):
I think this is a good direction. I'm a little wary of letting the trait methods return a "bigger" value than they do currently because for one thing, conceptually an "authority" should be more like just the storage and less of the surrounding logic -- but maybe that just means we need multiple traits which can be layered.
@divergentdave commented on GitHub (Jul 30, 2025):
Yeah, I think a separate trait for just different authoritative server storage backends would make sense.
@divergentdave commented on GitHub (Aug 5, 2025):
I noticed that the server AXFR implementation is currently limited to a single response message. See #2049 and #351. I tried adding more records to the existing AXFR integration tests, and they eventually produced a response with
TC=1. The changes above will likely make it easier to fix this in the future, by creating separate AXFR and query-response code paths.@divergentdave commented on GitHub (Aug 26, 2025):
The name "Authority" is misleading as well, what do folks think about renaming the trait to "ZoneHandler"?
@djc commented on GitHub (Aug 26, 2025):
Sounds like an improvement to me!
@cpu commented on GitHub (Aug 26, 2025):
I like it too 👍
@bluejekyll commented on GitHub (Aug 30, 2025):
I like all the discussion here. I know I'm late to the conversation. For what it's worth, if it wasn't obvious, the name Authority comes directly from the RFC for the Zone Authority. I really like that you all are figuring out ways to simplify this. I know I ended up with a lot of awkward abstractions to deal with various needs.