Open cmorten opened 2 years ago
Looks like trust-dns
support reverse lookup as a dedicated API (REF: https://docs.rs/trust-dns-resolver/latest/trust_dns_resolver/struct.AsyncResolver.html#method.reverse_lookup) but it is just a wrapper around PTR
record lookup which is limited as discussed above (no port to service mapping).
Example implementation in https://github.com/denoland/deno/pull/14634
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.
Feature request to support address to name translation ("reverse DNS"), a.k.a. wrapper around https://man7.org/linux/man-pages/man3/getnameinfo.3.html (e.g. using https://docs.rs/dns-lookup/latest/dns_lookup/#getnameinfo) or equivalent, so that users of Deno can translate an IP and port into a hostname and service.
E.g.
API shape and names just as example - suspect we can devise better alternatives! Answers on a postcard 🙃
This would provide a sibling to the existing
Deno.resolveDns()
API which offers DNS resolution currently.This would increase parity with existing Node APIs:
And is required to support the
dns
anddns/promises
modules in the Deno std library compat layer.Alternatives considered
1) PTR + service lookup
Could use
PTR
records with existingDeno.resolveDns()
but more limited in capability (don’t get the port to service mapping without additional work) and requires the user or any wrapper to handle IPv4 vs IPv6 address construction (incl. hex for IPv6) - overheads / features that could be provided by core if usegetnameinfo
.E.g.
To then get the service information could write a wrapper in TS to either interrogate the services db direct (e.g. parse /etc/services), or spawn execution of
getservbyport
.2) Overload
Deno.resolveDns()
Introduce some faux record type, or just an overloaded interface where ip + port args internally mapped to getnameinfo like behaviour.
Complicates an otherwise stable and clear interface so leaning away from this kind of idea.