aboutsummaryrefslogtreecommitdiffstats
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
commitb20f96afc1ea09e70fb7ffa04757940096e989bc (patch)
tree687a7a04d943b98fc264d1b35d4b699859c3849a
parentb37a36b1be0a8a91e851bcffe1f3e84c9f0f6151 (diff)
downloadprosody-b20f96afc1ea09e70fb7ffa04757940096e989bc.tar.gz
prosody-b20f96afc1ea09e70fb7ffa04757940096e989bc.zip
net.resolvers.basic: Obey use_ipv4/use_ipv6
-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)