mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #345] DNS Client for querying only the cache #453
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#453
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 @insanitybit on GitHub (Feb 16, 2018).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/345
Would it be possible with this library to query only the local DNS cache? I'd like really fine grained control over when I make the network query vs just the cache - this is for forensic purposes.
Is that currently supported with this library, and if not, could it be?
@bluejekyll commented on GitHub (Feb 16, 2018):
You might be interested in the Client: https://docs.rs/trust-dns/0.13.0/trust_dns/client/struct.SyncClient.html
That's the synchronous version (possibly easier to get started with), examples are here: https://docs.rs/trust-dns/0.13.0/trust_dns/index.html
With that you can easily specify specifically what host you want to connect to and manually construct the request to just the cache. If the cache respects the option, https://docs.rs/trust-dns/0.13.0/trust_dns/op/struct.Message.html#method.set_recursion_desired, you can set that to false and then the cache may only respond with what is in cache.
btw, the Client will not do any resolution, it just send a message and the you receive a message, so if there is a CNAME in the response, that will not be resolved for you. The Resolver (which will do this) does not currently have easy to use hooks to manipulate the Message options, etc, that you might need.
@bluejekyll commented on GitHub (Feb 16, 2018):
Hm, reviewing your question in a little more detail. Are you running a local DNS cache that is queryable on the localhost? What I described would work with such a setup. I haven't tried this, but for example, the mDNSResponder on macOS I think can be queried via localhost:5353. Though, I've never tried!
@insanitybit commented on GitHub (Feb 16, 2018):
I'd be running on pretty standard Windows/ OSX systems primarily. I didn't know that you could just query the local mDNSResponder, that's very useful to know. I had previously assumed I'd do something equivalent to "DNS_QUERY_CACHE_ONLY" on Windows[0].
https://msdn.microsoft.com/en-us/library/cc982162%28v=VS.85%29.aspx
@bluejekyll commented on GitHub (Feb 16, 2018):
That links to system API methods. Just to be clear, this library performs network DNS queries, it does not rely on the Host OS services for any DNS queries...
@insanitybit commented on GitHub (Feb 16, 2018):
I think I can use it for this based on the mDNSResponder tip. That's sufficient for me. Thanks!