aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2020-01-25 14:03:30 +0000
committerMatthew Wild <mwild1@gmail.com>2020-01-25 14:03:30 +0000
commit0e57190857be0c6d97b17321d62a7b18242b1288 (patch)
tree687a7a04d943b98fc264d1b35d4b699859c3849a /net
parentf507f3bb8b78a112f60aa4c429f488c3543cd10e (diff)
downloadprosody-0e57190857be0c6d97b17321d62a7b18242b1288.tar.gz
prosody-0e57190857be0c6d97b17321d62a7b18242b1288.zip
net.resolvers.basic: Obey use_ipv4/use_ipv6
Diffstat (limited to 'net')
-rw-r--r--net/resolvers/basic.lua33
1 files changed, 19 insertions, 14 deletions
diff --git a/net/resolvers/basic.lua b/net/resolvers/basic.lua
index 41ebda80..7d326c44 100644
--- a/net/resolvers/basic.lua
+++ b/net/resolvers/basic.lua
@@ -42,23 +42,28 @@ function methods:next(cb)
-- Resolve DNS to target list
local dns_resolver = adns.resolver();
- dns_resolver:lookup(function (answer)
- if answer then
- for _, record in ipairs(answer) do
- table.insert(targets, { self.conn_type.."4", record.a, self.port, self.extra });
+
+ if self.connector_options.use_ipv4 ~= false then
+ dns_resolver:lookup(function (answer)
+ if answer then
+ for _, record in ipairs(answer) do
+ table.insert(targets, { self.conn_type.."4", record.a, self.port, self.extra });
+ end
end
- end
- ready();
- end, self.hostname, "A", "IN");
+ ready();
+ end, self.hostname, "A", "IN");
+ end
- dns_resolver:lookup(function (answer)
- if answer then
- for _, record in ipairs(answer) do
- table.insert(targets, { self.conn_type.."6", record.aaaa, self.port, self.extra });
+ if self.connector_options.use_ipv6 ~= false then
+ dns_resolver:lookup(function (answer)
+ if answer then
+ for _, record in ipairs(answer) do
+ table.insert(targets, { self.conn_type.."6", record.aaaa, self.port, self.extra });
+ end
end
- end
- ready();
- end, self.hostname, "AAAA", "IN");
+ ready();
+ end, self.hostname, "AAAA", "IN");
+ end
end
local function new(hostname, port, conn_type, extra)