mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #1613] Make low-level request details available in high-level APIs (like Authority) #711
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#711
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 @moschroe on GitHub (Jan 5, 2022).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1613
Is your feature request related to a problem? Please describe.
I am creating a DNS proxy that intercepts and manipulates traffic according to a configuration (think name/record type whitelist) by implementing a custom
Authority. It should also be able to handle a split horizon configuration (substituting/adding RRs in the context of a distributed system) where answers might depend on the origin of the query.Describe the solution you'd like
In order to decide on legitimacy of the request and required/allowed RRs, the
Authorityneeds to have access to lower level request details. Ideally, it would getRequestInfo, maybesrc: SocketAddrmight be sufficient for a start and the most cumbersome solution would beHeader::id: u16(with the caveat that it is client-controlled and might have collisions!).Describe alternatives you've considered
I currently run a locally patched version of the repo where I threaded
request_info: RequestInfo<'_>through the entireAuthoritytrait but I am unsure whether this is too much of violation of design/separation of concern.In case of the latter, either a special struct with connection details, just for use in client (as in library users) APIs, could be crafted or, at the very least, an internal, unique ID field could be associated with a query that is made available to any API. This would follow the C model of customizable APIs where it is customary to allow a pointer to be associated with an API entity that is then provided to any user callback. With such an ID, a library user could implement a
RequestHandler(aCatalogwrapper) associating a random ID with a query, store any request details in (for example) aDashmapand theAuthorityimplementation could then use this provided "context ID" to correlate a query to this information again.Additional context
Discovered #1441, which might require similar solutions
@bluejekyll commented on GitHub (Jan 6, 2022):
Can you point to the function you'd want changed? I think it would be possible to pass
RequestInfointo https://docs.rs/trust-dns-server/0.21.0-alpha.4/trust_dns_server/authority/trait.Authority.html#tymethod.search instead of just the query for example. That seems like a change that is necessary for other reasons anyway.@moschroe commented on GitHub (Jan 16, 2022):
Sorry for the late reply. Having the
RequestInfoavailable inAuthority::search()would certainly work for my use case. It would avoid changing other structs by just passing it on accordingly.