diff options
author | onefang | 2020-07-17 05:30:44 +1000 |
---|---|---|
committer | onefang | 2020-07-17 05:30:44 +1000 |
commit | bf5ee4b51368d8ea4746958236a1d2449b3ae57d (patch) | |
tree | 64def0dba2fcf18748336d161d2d9116a6705b2f | |
parent | Typo-- (diff) | |
download | apt-panopticon-bf5ee4b51368d8ea4746958236a1d2449b3ae57d.zip apt-panopticon-bf5ee4b51368d8ea4746958236a1d2449b3ae57d.tar.gz apt-panopticon-bf5ee4b51368d8ea4746958236a1d2449b3ae57d.tar.bz2 apt-panopticon-bf5ee4b51368d8ea4746958236a1d2449b3ae57d.tar.xz |
Use the new DNSRR field from mirror_list.txt to do the correct thing.
-rwxr-xr-x | apt-panopticon-report-email-web.lua | 42 | ||||
-rwxr-xr-x | apt-panopticon.lua | 18 |
2 files changed, 37 insertions, 23 deletions
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua index b8b487e..a9852c1 100755 --- a/apt-panopticon-report-email-web.lua +++ b/apt-panopticon-report-email-web.lua | |||
@@ -346,28 +346,32 @@ local makeIPlist = function(hosts) | |||
346 | if nil ~= hosts[k].IPs then | 346 | if nil ~= hosts[k].IPs then |
347 | for l, w in pairs(hosts[k].IPs) do | 347 | for l, w in pairs(hosts[k].IPs) do |
348 | if type(w) == "table" then | 348 | if type(w) == "table" then |
349 | n[l] = {} | 349 | -- TODO - don't hard code deb.roundr.devuan.org. |
350 | for i, u in pairs(w) do | 350 | -- Don't output the extra DNS-RR entries that are for admin reasons. |
351 | if (APT.testing("IPv6") and ("AAAA" == u)) or ("A" == u) then | 351 | if ((APT.options.roundRobin.value == k) and ("deb.roundr.devuan.org" == l)) or (APT.options.roundRobin.value ~= k) then |
352 | local inRR = "" | 352 | n[l] = {} |
353 | local lc = logCount(k, i) | 353 | for i, u in pairs(w) do |
354 | if checkRR then | 354 | if (APT.testing("IPv6") and ("AAAA" == u)) or ("A" == u) then |
355 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. | 355 | local inRR = "" |
356 | inRR = "<font color='green'><b>✅</b></font>" | 356 | local lc = logCount(k, i) |
357 | if nil ~= lc:find("<font color='") then | 357 | if checkRR then |
358 | inRR = "<font color='red'>❌</font>" | 358 | -- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags. |
359 | if nil ~= RRbfile then | 359 | inRR = "<font color='green'><b>✅</b></font>" |
360 | local f, e = RRbfile:write(i, '\n') | 360 | if nil ~= lc:find("<font color='") then |
361 | if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end | 361 | inRR = "<font color='red'>❌</font>" |
362 | if nil ~= RRbfile then | ||
363 | local f, e = RRbfile:write(i, '\n') | ||
364 | if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end | ||
365 | end | ||
366 | elseif nil ~= RRgfile then | ||
367 | local f, e = RRgfile:write(i, '\n') | ||
368 | if f == nil then C("writing DNS-RR_good.txt file - " .. e) end | ||
362 | end | 369 | end |
363 | elseif nil ~= RRgfile then | ||
364 | local f, e = RRgfile:write(i, '\n') | ||
365 | if f == nil then C("writing DNS-RR_good.txt file - " .. e) end | ||
366 | end | 370 | end |
371 | if "yes" ~= hosts[k].DNSRR then inRR = "" end | ||
372 | local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] ' | ||
373 | if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end | ||
367 | end | 374 | end |
368 | if "yes" ~= hosts[k].DNSRR then inRR = "" end | ||
369 | local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] ' | ||
370 | if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end | ||
371 | end | 375 | end |
372 | end | 376 | end |
373 | else | 377 | else |
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] |