mirror of
https://github.com/bjc/prosody.git
synced 2025-04-05 14:17:37 +03:00
net.resolvers.basic: Obey use_ipv4/use_ipv6
This commit is contained in:
parent
b37a36b1be
commit
b20f96afc1
1 changed files with 20 additions and 15 deletions
|
@ -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 });
|
||||
end
|
||||
end
|
||||
ready();
|
||||
end, self.hostname, "A", "IN");
|
||||
|
||||
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_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, "AAAA", "IN");
|
||||
ready();
|
||||
end, self.hostname, "A", "IN");
|
||||
end
|
||||
|
||||
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
|
||||
ready();
|
||||
end, self.hostname, "AAAA", "IN");
|
||||
end
|
||||
end
|
||||
|
||||
local function new(hostname, port, conn_type, extra)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue