mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #599] How to determine the Query that resolves? #244
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#244
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 @olix0r on GitHub (Nov 2, 2018).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/599
What's the best way to perform proper search-based resolution such that it's possible to know the query that produces a result?
For example, suppose we're resolving an ambiguous name like
foo.barwith an /etc/resolv.conf includingsearch a.b c.d e.fIs there a lookup-like call that produces a result that indicates which of the following names was resolved:
foo.bar.a.b.,foo.bar.c.d.,foo.bar.e.f., orfoo.bar.?Another way to phrase this question: if I wanted to implement
dig(1)with trust-dns-resolver, how would I implement something that could take an input like foo.bar and output something like:@bluejekyll commented on GitHub (Nov 2, 2018):
This is a great question which I haven't pondered before. But it's a perfectly reasonable thing to want. Currently the Query is constructed based on the search path, and/or happy eyeballs ipv4/ipv6. So there are definitely a few options for the query that's sent.
As of now, this isn't returned, but it wouldn't be hard to add
Queryto the*Lookup*result types. At that point you'd have access to theQuerythat was constructed for the request and delivered the record. I think at that point you'd have what you're asking for.@olix0r commented on GitHub (Nov 2, 2018):
@bluejekyll thanks for the quick response. I can take a crack at a PR for this if you'd like.
One question about the implementation: how sensitive are you to breaking API compatibility in the
Lookup::new_*APIs?github.com/bluejekyll/trust-dns@75bc87ddd9/crates/resolver/src/lookup.rs (L37-L58)If we add a required
QuerytoLookup, then we'll also need to change thenew_*fns to take a Query, which is breaking. Alternatively, we could make it anOption<Query>and make it supported with a new set of constructors. This would be a little unfortunate, because we'll always set a Query (within trustdns at least), and so users will likely have tolookup.query().expect("query must be set").All that said, this library is still an 0.N version; and it seems atypical for users to instantiate
Lookupinstances directly, so a breaking change probably isn't so disruptive.Thoughts?
@bluejekyll commented on GitHub (Nov 2, 2018):
For the lookups, I’m not concerned about API breakage. In fact, we could possibly make the
newFn private to the crate, except that I’m pretty sure there are some mocked tests where they’re being used.I would be surprised if anyone outside the trust-dns crates are relying on these constructors at all, though even if they are, it would be good for them to do this as well.
To be clear, I think a strong ownership of the Query is right, and make it non-optional. If you make the change, That would be greatly appreciated!
@olix0r commented on GitHub (Nov 2, 2018):
@bluejekyll great, thanks. In linkerd2-proxy, we tend to do something like
so that we can have private constructors but still expose public constructors to tests.
@bluejekyll commented on GitHub (Nov 2, 2018):
Oh. Duh, that’s a great option! We used to do something similar in Java, this is so much more elegant. Not sure why that pattern hasn’t struck me before. Thanks for sharing!