mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 11:15:54 +03:00
[GH-ISSUE #105] Add a IpAddr conversion to Name for ease of use #54
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#54
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 @mersinvald on GitHub (Mar 18, 2017).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/105
I'm trying to query domain names from IP addresses. Here is how I do it (using 8.8.8.8 nameserver):
Message I get as a result:
So,
answersis empty.Is there my mistake in this query or that's a bug?
@mersinvald commented on GitHub (Mar 18, 2017):
As wikipedia explained me, I need to go deeper. Sorry for inconvenience.
@bluejekyll commented on GitHub (Mar 19, 2017):
I'm planning to start a full resolver soon, where I can handle this more elegantly. But yeah, you need to do the lookup by converting the ip into the proper in-addr format first.
I think I have some tests in the codebase with this as examples.
@mersinvald commented on GitHub (Mar 19, 2017):
So, the way I make name now is wrong?
Could you please explain how to convert IP to a Name?
My queries just fail now, I'm not getting any name servers in Message to run recursive PTR requests
@bluejekyll commented on GitHub (Mar 19, 2017):
So you can take a look at how I'm constructing this in the txt_tests functions: https://github.com/bluejekyll/trust-dns/blob/master/server/tests/txt_tests.rs#L233
I thought I had some query tests, but sadly, I don't (hopefully there is no bug here).
Basically IP addresses are represented in DNS in reverse order. Each name label represents a byte of the IP address, followed by the "zone" of in-addr.arpa. So the IPv4 address "10.0.1.23" is represented in reverse order: "23.1.0.10.in-addr.arpa.". The parser for
Name::parse()will handle this conversion from a string properly. I never added a from ip address to Name function, but given this conversation, it seems like that would be very valuable. The reason it is reversed is that IP's have the most generic byte first, whereas DNS has the most generic name last... it's almost like no-one ever talked with others when deciding this stuff... :)@mersinvald commented on GitHub (Mar 20, 2017):
Thank you!
I finally managed to implement it using futures::loop_fn for recursive queries
@bluejekyll commented on GitHub (Mar 20, 2017):
Awesome! I'm glad you got it to work!
I'll have a patch posted possibly tonight to make ip -> Name a lot easier...