aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/dns.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/dns.lua b/net/dns.lua
index c0875b5a..f3d80291 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -939,6 +939,9 @@ function resolver:lookupex(handler, qname, qtype, qclass) -- - - - - - - - -
return self:peek(qname, qtype, qclass) or self:query(qname, qtype, qclass);
end
+function resolver:tohostname(ip)
+ return dns.lookup(ip:gsub("(%d+)%.(%d+)%.(%d+)%.(%d+)", "%4.%3.%2.%1.in-addr.arpa."), "PTR");
+end
--print ---------------------------------------------------------------- print
@@ -1014,6 +1017,10 @@ function dns.lookup(...) -- - - - - - - - - - - - - - - - - - - - - lookup
return _resolver:lookup(...);
end
+function dns.tohostname(...)
+ return _resolver:tohostname(...);
+end
+
function dns.purge(...) -- - - - - - - - - - - - - - - - - - - - - - purge
return _resolver:purge(...);
end