Browse Source

Use the new DNSRR field from mirror_list.txt to do the correct thing.

master
onefang 9 months ago
parent
commit
bf5ee4b513
2 changed files with 37 additions and 22 deletions
  1. +23
    -19
      apt-panopticon-report-email-web.lua
  2. +14
    -3
      apt-panopticon.lua

+ 23
- 19
apt-panopticon-report-email-web.lua View File

@@ -346,28 +346,32 @@ local makeIPlist = function(hosts)
if nil ~= hosts[k].IPs then
for l, w in pairs(hosts[k].IPs) do
if type(w) == "table" then
n[l] = {}
for i, u in pairs(w) do
if (APT.testing("IPv6") and ("AAAA" == u)) or ("A" == u) then
local inRR = ""
local lc = logCount(k, i)
if checkRR then
-- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags.
inRR = "<font color='green'><b>&#x2705;</b></font>"
if nil ~= lc:find("<font color='") then
inRR = "<font color='red'>&#x274c;</font>"
if nil ~= RRbfile then
local f, e = RRbfile:write(i, '\n')
if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end
-- TODO - don't hard code deb.roundr.devuan.org.
-- Don't output the extra DNS-RR entries that are for admin reasons.
if ((APT.options.roundRobin.value == k) and ("deb.roundr.devuan.org" == l)) or (APT.options.roundRobin.value ~= k) then
n[l] = {}
for i, u in pairs(w) do
if (APT.testing("IPv6") and ("AAAA" == u)) or ("A" == u) then
local inRR = ""
local lc = logCount(k, i)
if checkRR then
-- If there where errors, warnings, or timeouts, then it'll have that wrapped in font tags.
inRR = "<font color='green'><b>&#x2705;</b></font>"
if nil ~= lc:find("<font color='") then
inRR = "<font color='red'>&#x274c;</font>"
if nil ~= RRbfile then
local f, e = RRbfile:write(i, '\n')
if f == nil then C("writing DNS-RR_bad.txt file - " .. e) end
end
elseif nil ~= RRgfile then
local f, e = RRgfile:write(i, '\n')
if f == nil then C("writing DNS-RR_good.txt file - " .. e) end
end
elseif nil ~= RRgfile then
local f, e = RRgfile:write(i, '\n')
if f == nil then C("writing DNS-RR_good.txt file - " .. e) end
end
if "yes" ~= hosts[k].DNSRR then inRR = "" end
local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] &nbsp; '
if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end
end
if "yes" ~= hosts[k].DNSRR then inRR = "" end
local log = '[<a href="' .. adr .. k .. '_' .. i .. '">graphs</a>] &nbsp; '
if "" == log then n[l][i] = u else n[l][log .. inRR .. ' ' .. revDNS(hosts, k, i) .. ' ' .. lc] = u end
end
end
else


+ 14
- 3
apt-panopticon.lua View File

@@ -195,6 +195,16 @@ gatherIPs = function (host)
end
until nil == IPs
end

-- If this is the DNS-RR domain name, gather the IPs for the mirrors that mirror_list.txt says should be in it.
if host == APT.options.roundRobin.value then
for k, m in pairs(APT.mirrors) do
if "yes" == m.DNSRR then
gatherIPs(m.FQDN)
IP[host][m.FQDN] = IP[m.FQDN]
end
end
end
return IP[host]
end

@@ -620,7 +630,7 @@ local getMirrors = function ()
W("Mirror " .. host .. " is not active - " .. d, "", "", host)
active = false
m[t] = d
-- TODO - Should do some more input validation on everything.
elseif "Rate" == t then
local time, unit = d:match('(%d+) *(%a+)')
time = tonumber(time)
@@ -643,7 +653,7 @@ local getMirrors = function ()
end
end
if APT.testing("DNSRR") then
mirrors[APT.options.roundRobin.value] = { ["Protocols"] = { ["http"] = true; }; ['Updated'] = 300;
mirrors[APT.options.roundRobin.value] = { ["Protocols"] = { ["http"] = true; }; ['Updated'] = 300; ['DNSRR'] = false;
["FQDN"] = APT.options.roundRobin.value; ["Active"] = 'yes'; ["BaseURL"] = APT.options.roundRobin.value; }
end
local file, e = io.open("results/mirrors.lua", "w+")
@@ -1042,11 +1052,11 @@ if 0 < #arg then

if not APT.logOpen(pu.host, arg[2], arg[3]) then return end
I("Starting tests for " .. arg[1] .. " with these tests - " .. table.concat(APT.options.tests.value, ", "))
APT.mirrors = loadfile("results/mirrors.lua")()
APT.results = APT.padResults(APT.results)
if APT.origin or APT.redir then APT.results["IPs"] = gatherIPs(pu.host) end
if nil ~= arg[2] then I(" &nbsp; Using IP " .. arg[2]); ip = arg[2] end
if nil ~= arg[3] then I(" &nbsp; Using file " .. arg[3]); end
APT.mirrors = loadfile("results/mirrors.lua")()
APT.results = APT.padResults(APT.results)

if APT.origin then
local file = arg[3]


Loading…
Cancel
Save