mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #2079] Lookup to MessageResponse? #875
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#875
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 @phylake on GitHub (Oct 25, 2023).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2079
Using the resolver I get back a
struct Lookupbut it's unclear how to transform that into aMessageResponsegiven this function signatureThe
Lookuphas a flat[Record]. I know I could filter out the SOAs pretty easily but I'm not sure what to do about the Additionals.Should I be using the client crate instead of the resolver, perhaps? Nothing is standing out on
AsyncClientthat would help me.@djc commented on GitHub (Oct 26, 2023):
What's your use case, why do you want to get a
MessageResponseout of a resolverLookup?@phylake commented on GitHub (Oct 26, 2023):
Really any use case where I need to perform a request on behalf of the client and return it. One is querying different DNS servers depending on the host being requested. Others are modifying the question being asked or the answer being given.
@djc commented on GitHub (Oct 26, 2023):
That doesn't sound like the resolver interface is for you.
@bluejekyll commented on GitHub (Oct 28, 2023):
Yeah, I'm not totally clear what you are trying to do. We do use the resolver internally in the server for "forwarding" requests to upstream resolvers, that has some logic for mapping the lookup result into a Message that you could look at:
github.com/hickory-dns/hickory-dns@b0c0566483/crates/server/src/store/forwarder/authority.rs (L166C1-L173)There's not a lot of logic there, and it only uses the primary record results. It might help to clarify that the Resolver is not a simple DNS client, it collapses CNAME chains and does additional lookups in order to resolve the query to ideally find the best result for the query. If you want a more direct client request, then you should look at the Client crate/library, though that is a more complex and low level interface.
@phylake commented on GitHub (Oct 30, 2023):
That's great I want all of that functionality.
I guess some more context is needed. One concrete example is split horizon DNS. I have a
My
struct MyProjecthas aTokioAsyncResolverI use to resolve the host (request.request_info().query.name()) requested. Conditionally, I alter the host (i.e., the question) being requested and return not the answer to the question asked, but the answer to the question I asked. All of this works great, btw. At this point I don't have anything to put in thesoaoradditionalsof theMessageResponseBuilderbuild functionso the reason for opening this issue was really around correctness. The resolver doesn't give me
soaoradditionalback in theLookup@balboah commented on GitHub (Jun 28, 2024):
I'm also curious on how to retrieve the additionals section from a
Lookupresult?@djc commented on GitHub (Jun 28, 2024):
@balboah what are you trying to achieve? What's the use case?
@balboah commented on GitHub (Jun 28, 2024):
To resolve dns records of all kinds from 3rd party upstream dns servers on behalf of clients, while not using hickory as a server
@djc commented on GitHub (Jun 28, 2024):
Why don't you want to use hickory as a server?
@balboah commented on GitHub (Jun 28, 2024):
Because of other preferences and requirements. Not sure why this matters? 🙂
There's a resolver for resolving queries of all types, I would expect it to also be able to resolve the additional section? Although the clients can probably live without this
@djc commented on GitHub (Jun 28, 2024):
I always like to understand requirements that our users have to take them into account for future plans.
I think the conceptual mismatch here is that a
Lookuppotentially represents a stream of DNS response messages, so that there's not one additionals section to cleanly represent. As such, there is not currently a straightforward way to do this. I think there's some tension here between a desire for interpretation (as alluded to in earlier comments around collapsing CNAME chains and doing extra lookups) from the resolver crate versus acting as a "simple" proxy for which the client crate might be a better fit.