aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/resolvers/basic.lua11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua
index 792e6d32..c2fd9260 100644
--- a/net/resolvers/basic.lua
+++ b/net/resolvers/basic.lua
@@ -1,4 +1,5 @@
local adns = require "net.adns";
+local inet_pton = require "util.net".pton;
local methods = {};
local resolver_mt = { __index = methods };
@@ -25,6 +26,16 @@ function methods:next(cb)
self:next(cb);
end
+ local is_ip = inet_pton(self.hostname);
+ if is_ip then
+ if #is_ip == 16 then
+ cb(self.conn_type.."6", self.hostname, self.port, self.extra);
+ elseif #is_ip == 4 then
+ cb(self.conn_type, self.hostname, self.port, self.extra);
+ end
+ return;
+ end
+
-- Resolve DNS to target list
local dns_resolver = adns.resolver();
dns_resolver:lookup(function (answer)