ilya-epifanov / akka-dns

Asynchronous DNS resolver for Akka
Apache License 2.0
26 stars 14 forks source link

How to do reverse lookup? #6

Open domdorn opened 7 years ago

domdorn commented 7 years ago

Hi!

How can I do a reverse lookup (so ip => hostname) with this? Doing a lookup on the IP just returns the same IP back to me.

Thanks, Dominik

domdorn commented 7 years ago

Ok, after doing a little research, it looks like I'd need to request a PTR record of something like ip.split(".").reverse.mkstring(".") + ".in-addr.arpa" .. however, it looks like there is no support for PTR records yet.. is there a supposed way on getting this to work? I thought about adding the PTRRecord to https://github.com/ilya-epifanov/akka-dns/blob/master/src/main/scala/ru/smslv/akka/dns/raw/ResourceRecord.scala then adjusting https://github.com/ilya-epifanov/akka-dns/blob/master/src/main/scala/ru/smslv/akka/dns/raw/ResourceRecord.scala#L120 to also handle the PTRRecord

domdorn commented 7 years ago

I got basic DNS Reverse Lookups (IP -> Address) working, however the code is still full of println()s and not 100% stable.

Would be great if you could get a quick look at it and tell me if the approach in general is ok (meaning, that I added a additional Option[Seq[PTRRecord]]) to CurrentRequest. Also we should talk about what happens when there is no valid result for a lookup, e.g. when there is no reverse-address specified for an ip or if the hostname requested does not exist / resolve.