Comparison

net/resolvers/basic.lua @ 10624:0725b7b8dc14

net.resolvers.basic: Obey extra.use_ipv4/use_ipv6
author Matthew Wild <mwild1@gmail.com>
date Sat, 25 Jan 2020 14:38:17 +0000
parent 10621:e5ab31845094
child 10626:26fb44b61a17
comparison
equal deleted inserted replaced
10623:f51c88baeb8a 10624:0725b7b8dc14
41 end 41 end
42 42
43 -- Resolve DNS to target list 43 -- Resolve DNS to target list
44 local dns_resolver = adns.resolver(); 44 local dns_resolver = adns.resolver();
45 45
46 if self.connector_options.use_ipv4 ~= false then 46 if not self.extra or self.extra.use_ipv4 ~= false then
47 dns_resolver:lookup(function (answer) 47 dns_resolver:lookup(function (answer)
48 if answer then 48 if answer then
49 for _, record in ipairs(answer) do 49 for _, record in ipairs(answer) do
50 table.insert(targets, { self.conn_type.."4", record.a, self.port, self.extra }); 50 table.insert(targets, { self.conn_type.."4", record.a, self.port, self.extra });
51 end 51 end
52 end 52 end
53 ready(); 53 ready();
54 end, self.hostname, "A", "IN"); 54 end, self.hostname, "A", "IN");
55 end 55 end
56 56
57 if self.connector_options.use_ipv6 ~= false then 57 if not self.extra or self.extra.use_ipv6 ~= false then
58 dns_resolver:lookup(function (answer) 58 dns_resolver:lookup(function (answer)
59 if answer then 59 if answer then
60 for _, record in ipairs(answer) do 60 for _, record in ipairs(answer) do
61 table.insert(targets, { self.conn_type.."6", record.aaaa, self.port, self.extra }); 61 table.insert(targets, { self.conn_type.."6", record.aaaa, self.port, self.extra });
62 end 62 end