diff options
Diffstat (limited to 'apt-panopticon.lua')
| -rwxr-xr-x | apt-panopticon.lua | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index f154086..b91d47c 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
| @@ -195,6 +195,16 @@ gatherIPs = function (host) | |||
| 195 | end | 195 | end |
| 196 | until nil == IPs | 196 | until nil == IPs |
| 197 | end | 197 | end |
| 198 | |||
| 199 | -- If this is the DNS-RR domain name, gather the IPs for the mirrors that mirror_list.txt says should be in it. | ||
| 200 | if host == APT.options.roundRobin.value then | ||
| 201 | for k, m in pairs(APT.mirrors) do | ||
| 202 | if "yes" == m.DNSRR then | ||
| 203 | gatherIPs(m.FQDN) | ||
| 204 | IP[host][m.FQDN] = IP[m.FQDN] | ||
| 205 | end | ||
| 206 | end | ||
| 207 | end | ||
| 198 | return IP[host] | 208 | return IP[host] |
| 199 | end | 209 | end |
| 200 | 210 | ||
| @@ -620,7 +630,7 @@ local getMirrors = function () | |||
| 620 | W("Mirror " .. host .. " is not active - " .. d, "", "", host) | 630 | W("Mirror " .. host .. " is not active - " .. d, "", "", host) |
| 621 | active = false | 631 | active = false |
| 622 | m[t] = d | 632 | m[t] = d |
| 623 | -- TODO - Should do some input validation on BaseURL, and everything else. | 633 | -- TODO - Should do some more input validation on everything. |
| 624 | elseif "Rate" == t then | 634 | elseif "Rate" == t then |
| 625 | local time, unit = d:match('(%d+) *(%a+)') | 635 | local time, unit = d:match('(%d+) *(%a+)') |
| 626 | time = tonumber(time) | 636 | time = tonumber(time) |
| @@ -643,7 +653,7 @@ local getMirrors = function () | |||
| 643 | end | 653 | end |
| 644 | end | 654 | end |
| 645 | if APT.testing("DNSRR") then | 655 | if APT.testing("DNSRR") then |
| 646 | mirrors[APT.options.roundRobin.value] = { ["Protocols"] = { ["http"] = true; }; ['Updated'] = 300; | 656 | mirrors[APT.options.roundRobin.value] = { ["Protocols"] = { ["http"] = true; }; ['Updated'] = 300; ['DNSRR'] = false; |
| 647 | ["FQDN"] = APT.options.roundRobin.value; ["Active"] = 'yes'; ["BaseURL"] = APT.options.roundRobin.value; } | 657 | ["FQDN"] = APT.options.roundRobin.value; ["Active"] = 'yes'; ["BaseURL"] = APT.options.roundRobin.value; } |
| 648 | end | 658 | end |
| 649 | local file, e = io.open("results/mirrors.lua", "w+") | 659 | local file, e = io.open("results/mirrors.lua", "w+") |
| @@ -1042,11 +1052,11 @@ if 0 < #arg then | |||
| 1042 | 1052 | ||
| 1043 | if not APT.logOpen(pu.host, arg[2], arg[3]) then return end | 1053 | if not APT.logOpen(pu.host, arg[2], arg[3]) then return end |
| 1044 | I("Starting tests for " .. arg[1] .. " with these tests - " .. table.concat(APT.options.tests.value, ", ")) | 1054 | I("Starting tests for " .. arg[1] .. " with these tests - " .. table.concat(APT.options.tests.value, ", ")) |
| 1055 | APT.mirrors = loadfile("results/mirrors.lua")() | ||
| 1056 | APT.results = APT.padResults(APT.results) | ||
| 1045 | if APT.origin or APT.redir then APT.results["IPs"] = gatherIPs(pu.host) end | 1057 | if APT.origin or APT.redir then APT.results["IPs"] = gatherIPs(pu.host) end |
| 1046 | if nil ~= arg[2] then I(" Using IP " .. arg[2]); ip = arg[2] end | 1058 | if nil ~= arg[2] then I(" Using IP " .. arg[2]); ip = arg[2] end |
| 1047 | if nil ~= arg[3] then I(" Using file " .. arg[3]); end | 1059 | if nil ~= arg[3] then I(" Using file " .. arg[3]); end |
| 1048 | APT.mirrors = loadfile("results/mirrors.lua")() | ||
| 1049 | APT.results = APT.padResults(APT.results) | ||
| 1050 | 1060 | ||
| 1051 | if APT.origin then | 1061 | if APT.origin then |
| 1052 | local file = arg[3] | 1062 | local file = arg[3] |
