aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--apt-panopticommon.lua38
-rwxr-xr-xapt-panopticon-report-RRD.lua6
-rwxr-xr-xapt-panopticon-report-email-web.lua201
-rwxr-xr-xapt-panopticon.lua103
4 files changed, 292 insertions, 56 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua
index e73e69e..37b43e4 100644
--- a/apt-panopticommon.lua
+++ b/apt-panopticommon.lua
@@ -53,7 +53,7 @@ APT.options =
53 "DNSRR", 53 "DNSRR",
54 "Protocol", 54 "Protocol",
55 "URLSanity", 55 "URLSanity",
56 "Integrity", 56-- "Integrity",
57 "Updated", 57 "Updated",
58 }, 58 },
59 }, 59 },
@@ -411,6 +411,7 @@ local E = APT.E
411local C = APT.C 411local C = APT.C
412 412
413 413
414APT.debians = {}
414APT.mirrors = {} 415APT.mirrors = {}
415 416
416APT.testing = function(t, host) 417APT.testing = function(t, host)
@@ -498,6 +499,7 @@ APT.padResults = function(results)
498 if nil == tests.Integrity then tests.Integrity = {errors = c; warnings = c; timeouts = c} end 499 if nil == tests.Integrity then tests.Integrity = {errors = c; warnings = c; timeouts = c} end
499 if nil == tests.Protocol then tests.Protocol = {errors = c; warnings = c; timeouts = c} end 500 if nil == tests.Protocol then tests.Protocol = {errors = c; warnings = c; timeouts = c} end
500 if nil == tests.Updated then tests.Updated = {errors = c; warnings = c; timeouts = c} end 501 if nil == tests.Updated then tests.Updated = {errors = c; warnings = c; timeouts = c} end
502 if nil == tests.redirects then tests.redirects = {} end
501 if nil == tests.URLSanity then tests.URLSanity = {errors = c; warnings = c; timeouts = c} end 503 if nil == tests.URLSanity then tests.URLSanity = {errors = c; warnings = c; timeouts = c} end
502 results[v] = tests 504 results[v] = tests
503 end 505 end
@@ -517,23 +519,25 @@ APT.collate = function(l, host, ip, results)
517 if ("speed" == k) and (nil ~= results.speed) then 519 if ("speed" == k) and (nil ~= results.speed) then
518 if v.min < results.speed.min then results.speed.min = v.min end 520 if v.min < results.speed.min then results.speed.min = v.min end
519 if v.max > results.speed.max then results.speed.max = v.max end 521 if v.max > results.speed.max then results.speed.max = v.max end
520 else 522 elseif 'IPs' ~= k then
521 for i, u in pairs(v) do 523 for i, u in pairs(v) do
522 if "table" == type(u) then 524 if 'redirects' ~= i then
523 for h, t in pairs(u) do 525 if "table" == type(u) then
526 for h, t in pairs(u) do
527 local a = results[k]
528 if nil == a then results[k] = {i = {}}; a = results[k] end
529 a = a[i]
530 if nil == a then results[k][i] = {h = {}}; a = results[k][i] end
531 a = a[h]
532 if nil == a then a = 0 end
533 results[k][i][h] = a + t
534 end
535 else
524 local a = results[k] 536 local a = results[k]
525 if nil == a then results[k] = {i = {}}; a = results[k] end 537 if nil == a then a = 0; results[k] = {} else a = a[i] end
526 a = a[i]
527 if nil == a then results[k][i] = {h = {}}; a = results[k][i] end
528 a = a[h]
529 if nil == a then a = 0 end 538 if nil == a then a = 0 end
530 results[k][i][h] = a + t 539 results[k][i] = a + u
531 end 540 end
532 else
533 local a = results[k]
534 if nil == a then a = 0; results[k] = {} else a = a[i] end
535 if nil == a then a = 0 end
536 results[k][i] = a + u
537 end 541 end
538 end 542 end
539 end 543 end
@@ -546,14 +550,14 @@ APT.collate = function(l, host, ip, results)
546 end 550 end
547 return results 551 return results
548end 552end
549APT.collateAll = function(l, host, func) 553APT.collateAll = function(hosts, l, host, func)
550 results = {} 554 results = {}
551 local f = l .. "/" .. host .. ".lua" 555 local f = l .. "/" .. host .. ".lua"
552 if APT.checkFile(f) then 556 if APT.checkFile(f) then
553 results = loadfile(f)() 557 results = loadfile(f)()
554 results = APT.padResults(results) 558 results = APT.padResults(results)
555 if nil ~= func then func(results) end 559 if nil ~= func then func(results) end
556 local v = APT.mirrors[host] 560 local v = hosts[host]
557 if nil ~= v then 561 if nil ~= v then
558 local IPs = results.IPs 562 local IPs = results.IPs
559 if nil == IPs then W('No IPs for ' .. host .. ' in ' .. l) else 563 if nil == IPs then W('No IPs for ' .. host .. ' in ' .. l) else
@@ -662,7 +666,7 @@ APT.updateRRD = function(results, host, ip)
662end 666end
663 667
664APT.doRRD = function(l, k, v, o) 668APT.doRRD = function(l, k, v, o)
665 APT.collateAll(l, k, 669 APT.collateAll(APT.mirrors, l, k,
666 function(results, ip) 670 function(results, ip)
667 APT.createRRD(k, ip, o) 671 APT.createRRD(k, ip, o)
668 APT.updateRRD(results, k, ip) 672 APT.updateRRD(results, k, ip)
diff --git a/apt-panopticon-report-RRD.lua b/apt-panopticon-report-RRD.lua
index e703659..6a4a032 100755
--- a/apt-panopticon-report-RRD.lua
+++ b/apt-panopticon-report-RRD.lua
@@ -15,3 +15,9 @@ APT.html = false
15for k, v in APT.orderedPairs(APT.mirrors) do 15for k, v in APT.orderedPairs(APT.mirrors) do
16 APT.doRRD('results', k, v) 16 APT.doRRD('results', k, v)
17end 17end
18
19APT.debians = loadfile("results/debians.lua")()
20APT.html = false
21for k, v in APT.orderedPairs(APT.debians) do
22 APT.doRRD('results', k, v)
23end
diff --git a/apt-panopticon-report-email-web.lua b/apt-panopticon-report-email-web.lua
index 9faf476..23608d3 100755
--- a/apt-panopticon-report-email-web.lua
+++ b/apt-panopticon-report-email-web.lua
@@ -12,11 +12,12 @@ local arg, sendArgs = APT.parseArgs({...})
12 12
13local results = {} 13local results = {}
14APT.mirrors = loadfile("results/mirrors.lua")() 14APT.mirrors = loadfile("results/mirrors.lua")()
15APT.debians = loadfile("results/debians.lua")()
15 16
16local revDNS = function(dom, IP) 17local revDNS = function(hosts, dom, IP)
17 if "deb.devuan.org" ~= dom then 18 if "deb.devuan.org" ~= dom then
18 if nil ~= APT.mirrors["deb.devuan.org"] then 19 if nil ~= hosts["deb.devuan.org"] then
19 if nil ~= APT.mirrors["deb.devuan.org"].IPs["deb.roundr.devuan.org"][IP] then 20 if nil ~= hosts["deb.devuan.org"].IPs["deb.roundr.devuan.org"][IP] then
20 if APT.html then 21 if APT.html then
21 return "<font color='purple'><b>DNS-RR</b></font>" 22 return "<font color='purple'><b>DNS-RR</b></font>"
22 else 23 else
@@ -25,7 +26,7 @@ local revDNS = function(dom, IP)
25 end 26 end
26 end 27 end
27 else 28 else
28 for k, v in pairs(APT.mirrors) do 29 for k, v in pairs(hosts) do
29 if "deb.devuan.org" ~= k then 30 if "deb.devuan.org" ~= k then
30 local IPs = v.IPs 31 local IPs = v.IPs
31 for i, u in pairs(IPs) do 32 for i, u in pairs(IPs) do
@@ -44,12 +45,12 @@ local revDNS = function(dom, IP)
44end 45end
45 46
46local faulty = "" 47local faulty = ""
47local status = function(host, results, typ) 48local status = function(hosts, host, results, typ)
48 local result = "" 49 local result = ""
49 local e = 0 50 local e = 0
50 local w = 0 51 local w = 0
51 local t = 0 52 local t = 0
52 local s = nil ~= APT.mirrors[host].Protocols[typ] 53 local s = nil ~= hosts[host].Protocols[typ]
53 local to = results.timeout 54 local to = results.timeout
54 if not APT.search(APT.protocols, typ) then s = true end 55 if not APT.search(APT.protocols, typ) then s = true end
55 if nil ~= results[typ] then 56 if nil ~= results[typ] then
@@ -57,7 +58,7 @@ local status = function(host, results, typ)
57 w = results[typ].warnings 58 w = results[typ].warnings
58 t = results[typ].timeouts 59 t = results[typ].timeouts
59 for k, v in pairs(results[typ]) do 60 for k, v in pairs(results[typ]) do
60 if "table" == type(v) then 61 if ("table" == type(v)) and ('redirects' ~= k) then
61 if 0 <= v.errors then e = e + v.errors else to = true end 62 if 0 <= v.errors then e = e + v.errors else to = true end
62 if 0 <= v.warnings then w = w + v.warnings else to = true end 63 if 0 <= v.warnings then w = w + v.warnings else to = true end
63 if 0 <= v.timeouts then t = t + v.timeouts else to = true end 64 if 0 <= v.timeouts then t = t + v.timeouts else to = true end
@@ -139,31 +140,49 @@ local logCount = function(domain, ip)
139 local nm = "LOG_" .. domain 140 local nm = "LOG_" .. domain
140 local log = "" 141 local log = ""
141 local extra = "" 142 local extra = ""
143 local errors = 0
144 local warnings = 0
145 local timeouts = 0
142 if nil ~= ip then nm = nm .. "_" .. ip end 146 if nil ~= ip then nm = nm .. "_" .. ip end
143 nm = nm .. ".html" 147 nm = nm .. ".html"
144 local rfile, e = io.open("results/" .. nm, "r") 148 local rfile, e = io.open("results/" .. nm, "r")
145 if nil ~= rfile then 149 if nil ~= rfile then
146 local errors = 0
147 local warnings = 0
148 local timeouts = 0
149 for l in rfile:lines() do 150 for l in rfile:lines() do
150 if nil ~= l:match("><b>ERROR ") then errors = errors + 1 end 151 if nil ~= l:match("><b>ERROR ") then errors = errors + 1 end
151 if nil ~= l:match("><b>WARNING ") then warnings = warnings + 1 end 152 if nil ~= l:match("><b>WARNING ") then warnings = warnings + 1 end
152 if nil ~= l:match("><b>TIMEOUT ") then timeouts = timeouts + 1 end 153 if nil ~= l:match("><b>TIMEOUT ") then timeouts = timeouts + 1 end
153 end 154 end
154 rfile:close() 155 rfile:close()
155 if APT.html then 156 end
156 if nil == ip then 157 if APT.html then
157 log = "<a href='" .. nm .. "'>" .. domain .. "</a>" 158 if nil == ip then
158 else 159 log = "<a href='" .. nm .. "'>" .. domain .. "</a>"
159 log = "<a href='" .. nm .. "'>" .. ip .. "</a>" 160 else
160 end 161 log = "<a href='" .. nm .. "'>" .. ip .. "</a>"
161 end 162 end
162 log = log .. APT.plurals(errors, warnings, timeouts)
163 end 163 end
164 log = log .. APT.plurals(errors, warnings, timeouts)
164 return log 165 return log
165end 166end
166 167
168local redirs = function(hosts, host)
169 local results = APT.collateAll(hosts, 'results', host)
170 local rdr = {}
171 local redirs = ''
172 for p, pt in pairs(APT.protocols) do
173 if 0 ~= #(results[pt].redirects) then
174 table.sort(results[pt].redirects)
175 for r, rd in pairs(results[pt].redirects) do
176 rdr[rd] = rd
177 end
178 end
179 end
180 for r, rd in pairs(rdr) do
181 redirs = redirs .. ', &nbsp ' .. rd
182 end
183 if '' ~= redirs then redirs = '<br>\n &nbsp; &nbsp; (Redirects some packages to - ' .. redirs:sub(3) .. ')' end
184 return redirs
185end
167 186
168APT.html = false 187APT.html = false
169local email, e = io.open("results/Report-email.txt", "w+") 188local email, e = io.open("results/Report-email.txt", "w+")
@@ -183,16 +202,16 @@ if nil == email then C("opening mirrors file - " .. e) else
183 "[skip] means that the test hasn't been written yet.\n\n") 202 "[skip] means that the test hasn't been written yet.\n\n")
184 for k, v in APT.orderedPairs(APT.mirrors) do 203 for k, v in APT.orderedPairs(APT.mirrors) do
185 email:write(k .. "....\n") 204 email:write(k .. "....\n")
186 local results = APT.collateAll('results', k) 205 local results = APT.collateAll(APT.mirrors, 'results', k)
187 local ftp = "[skip]" 206 local ftp = "[skip]"
188 local http = status(k, results, "http") 207 local http = status(APT.mirrors, k, results, "http")
189 local https = status(k, results, "https") 208 local https = status(APT.mirrors, k, results, "https")
190 local rsync = "[skip]" 209 local rsync = "[skip]"
191 local dns = "" 210 local dns = ""
192 local protocol = status(k, results, "Protocol") 211 local protocol = status(APT.mirrors, k, results, "Protocol")
193 local sanity = status(k, results, "URLSanity") 212 local sanity = status(APT.mirrors, k, results, "URLSanity")
194 local integrity = status(k, results, "Integrity") 213 local integrity = status(APT.mirrors, k, results, "Integrity")
195 local updated = status(k, results, "Updated") 214 local updated = status(APT.mirrors, k, results, "Updated")
196 215
197 -- DNS-RR test. 216 -- DNS-RR test.
198 if ("deb.devuan.org" ~= k) and (nil ~= APT.mirrors["deb.devuan.org"]) then 217 if ("deb.devuan.org" ~= k) and (nil ~= APT.mirrors["deb.devuan.org"]) then
@@ -347,7 +366,7 @@ if nil == web then C("opening mirrors file - " .. e) else
347 "<th>Protocol</th><th>URL sanity</th><th>Integrity</th><th>Updated</th><th colspan='2'>Speed range</th></tr>\n" 366 "<th>Protocol</th><th>URL sanity</th><th>Integrity</th><th>Updated</th><th colspan='2'>Speed range</th></tr>\n"
348 ) 367 )
349 for k, v in APT.orderedPairs(APT.mirrors) do 368 for k, v in APT.orderedPairs(APT.mirrors) do
350 local results = APT.collateAll('results', k) 369 local results = APT.collateAll(APT.mirrors, 'results', k)
351 local active = "" 370 local active = ""
352 if "yes" == v.Active then 371 if "yes" == v.Active then
353 web:write(" <tr><th>" .. k .. "</th> ") 372 web:write(" <tr><th>" .. k .. "</th> ")
@@ -356,14 +375,14 @@ if nil == web then C("opening mirrors file - " .. e) else
356 web:write(" <tr style='background-color:dimgrey'><th>" .. k .. "</th> ") 375 web:write(" <tr style='background-color:dimgrey'><th>" .. k .. "</th> ")
357 end 376 end
358 local ftp = "[<font color='grey'><b>skip</b></font>]" 377 local ftp = "[<font color='grey'><b>skip</b></font>]"
359 local http = status(k, results, "http") 378 local http = status(APT.mirrors, k, results, "http")
360 local https = status(k, results, "https") 379 local https = status(APT.mirrors, k, results, "https")
361 local rsync = "[<font color='grey'><b>skip</b></font>]" 380 local rsync = "[<font color='grey'><b>skip</b></font>]"
362 local dns = "" 381 local dns = ""
363 local protocol = status(k, results, "Protocol") 382 local protocol = status(APT.mirrors, k, results, "Protocol")
364 local sanity = status(k, results, "URLSanity") 383 local sanity = status(APT.mirrors, k, results, "URLSanity")
365 local integrity = status(k, results, "Integrity") 384 local integrity = status(APT.mirrors, k, results, "Integrity")
366 local updated = status(k, results, "Updated") 385 local updated = status(APT.mirrors, k, results, "Updated")
367 local rate = v.Rate 386 local rate = v.Rate
368 if nil ~= rate then updated = updated .. ' ' .. rate end 387 if nil ~= rate then updated = updated .. ' ' .. rate end
369 local min = tonumber(results.speed.min) 388 local min = tonumber(results.speed.min)
@@ -434,14 +453,14 @@ if nil == web then C("opening mirrors file - " .. e) else
434 n[l] = {} 453 n[l] = {}
435 for i, u in pairs(w) do 454 for i, u in pairs(w) do
436 local log = logCount(k, i) 455 local log = logCount(k, i)
437 if "" == log then n[l][i] = u else n[l][log .. " " .. revDNS(k, i)] = u end 456 if "" == log then n[l][i] = u else n[l][log .. " " .. revDNS(APT.mirrors, k, i)] = u end
438 end 457 end
439 else 458 else
440 local log = logCount(k, l) 459 local log = logCount(k, l)
441 if "" == log then n[l] = w else n[log .. " " .. revDNS(k, l)] = w end 460 if "" == log then n[l] = w else n[log .. " " .. revDNS(APT.mirrors, k, l)] = w end
442 end 461 end
443 end 462 end
444 m[log .. " DNS entries -"] = n 463 m[log .. " DNS entries -" .. redirs(APT.mirrors, k)] = n
445 end 464 end
446 web:write( "<p>This lists each mirror, and the DNS entries for that mirror. &nbsp; " .. 465 web:write( "<p>This lists each mirror, and the DNS entries for that mirror. &nbsp; " ..
447 "The links point to the testing log files for " .. logCount("apt-panopticon") .. " for each domain name / IP combination that was tested. &nbsp; " .. 466 "The links point to the testing log files for " .. logCount("apt-panopticon") .. " for each domain name / IP combination that was tested. &nbsp; " ..
@@ -453,8 +472,118 @@ if nil == web then C("opening mirrors file - " .. e) else
453 ) 472 )
454 web:write(APT.dumpTableHTML(m, "", "")) 473 web:write(APT.dumpTableHTML(m, "", ""))
455 web:write( "\n<br>\n<br>\n<h2>==== graphs: ====</h2>\n" .. 474 web:write( "\n<br>\n<br>\n<h2>==== graphs: ====</h2>\n" ..
456 "<img src='speed.png'>\n<br>\n<p><a href='../apt-panopticon_cgp/'>More graphs.</a> with greater detail.</p><hr>\n\n" .. 475 "<img src='speed.png'>\n<br>\n<p><a href='../apt-panopticon_cgp/'>More graphs.</a> with greater detail.</p><hr>\n\n")
457 "<p>The <a href='Report-email.txt'>email report</a>. &nbsp; " .. 476
477 results = {}
478 m = {}
479 faulty = ""
480 web:write( "<hr>\n<h2>==== Debian mirror status ====</h2>\n" ..
481 "<p>NOTE - This is not fully probing the Debian mirrors, we just collect some data from any redirects to other servers. &nbsp; " ..
482 "So this isn't a full set of tests.</p>\n" ..
483 "<p><font style='background-color:red; color:black'>EXPERIMENTAL CODE - this is even more experimental than the rest.</font></p>\n" ..
484 "<table>\n<tr><th></th><th>FTP</th><th>HTTP</th><th>HTTPS</th><th>RSYNC</th><th>DNS round robin</th>" ..
485 "<th>Protocol</th><th>URL sanity</th><th>Integrity</th><th>Updated</th><th colspan='2'>Speed range</th></tr>\n")
486 for k, v in APT.orderedPairs(APT.debians) do
487 local results = APT.collateAll(APT.debians, 'results', k)
488 local active = ""
489 if "yes" == v.Active then
490 web:write(" <tr><th>" .. k .. "</th> ")
491 else
492 if nil == v.Active then active = 'nil' else active = v.Active end
493 web:write(" <tr style='background-color:dimgrey'><th>" .. k .. "</th> ")
494 end
495 local ftp = "[<font color='grey'><b>skip</b></font>]"
496 local http = status(APT.debians, k, results, "http")
497 local https = status(APT.debians, k, results, "https")
498 local rsync = "[<font color='grey'><b>skip</b></font>]"
499 local dns = ""
500 local protocol = status(APT.debians, k, results, "Protocol")
501 local sanity = status(APT.debians, k, results, "URLSanity")
502 local integrity = status(APT.debians, k, results, "Integrity")
503 local updated = status(APT.debians, k, results, "Updated")
504 local rate = v.Rate
505 if nil ~= rate then updated = updated .. ' ' .. rate end
506 local min = tonumber(results.speed.min)
507 local max = tonumber(results.speed.max)
508 local spd = ''
509
510 -- DNS-RR test.
511 if ("deb.devuan.org" ~= k) and (nil ~= APT.debians["deb.devuan.org"]) then
512 for l, w in pairs(APT.debians[k].IPs) do
513 if type(w) == "table" then
514 for i, u in pairs(w) do
515 if nil ~= APT.debians["deb.devuan.org"].IPs["deb.roundr.devuan.org"][i] then
516 local log = logCount("deb.devuan.org", i)
517 if "" ~= log then
518 if "" == dns then dns = " " else dns = dns .. " &nbsp; " end
519 dns = dns .. logCount("deb.devuan.org", i)
520 else
521 if "" == dns then dns = " " else dns = dns .. " &nbsp; " end
522 dns = dns .. "<font color='maroon'><b>" .. i .. "</b></font>"
523 end
524 end
525 end
526 else
527 if nil ~= APT.debians["deb.devuan.org"].IPs["deb.roundr.devuan.org"][l] then
528 local log = logCount("deb.devuan.org", l)
529 if "" ~= log then
530 if "" == dns then dns = " " else dns = dns .. " &nbsp; " end
531 dns = dns .. log
532 else
533 if "" == dns then dns = " " else dns = dns .. " &nbsp; " end
534 dns = dns .. "<font color='maroon'><b>" .. l .. "</b></font>"
535 end
536 end
537 end
538 end
539 if "" == dns then dns = "[<font color='grey'><b>no</b></font>]" end
540
541 if 0 == max then
542 spd = '<td></td><td></td>'
543 else
544 spd = string.format('<td align="right">%d -></td><td align="right">%d</td>', min, max)
545 end
546 end
547
548 web:write("<td>" .. ftp .. "&nbsp;</td><td>" .. http .. "&nbsp;</td><td>" .. https .. "&nbsp;</td><td>" .. rsync .. "&nbsp;</td><td>" .. dns ..
549 "&nbsp;</td><td>" .. protocol .. "&nbsp;</td><td>" .. sanity ..
550 "&nbsp;</td><td>" .. integrity .. "&nbsp;</td><td>" .. updated .. "&nbsp;</td>" .. spd .. "</tr>\n")
551 if "" ~= active then
552 web:write("<tr><td style='background-color:dimgrey'>" .. active .. "</td></tr>\n")
553 end
554 end
555 web:write( "</table>\n<br>\n\n")
556
557 web:write( "<br>\n<br>\n<h2>==== Debian DNS and logs: ====</h2>\n")
558
559 for k, v in pairs(APT.debians) do
560 local log = k
561 local n = {}
562 log = logCount(k)
563 APT.debians[k].Protocols = nil
564 APT.debians[k].FQDN = nil
565 APT.debians[k].Active = nil
566 APT.debians[k].Rate = nil
567 APT.debians[k].BaseURL = nil
568 APT.debians[k].Country = nil
569 APT.debians[k].Bandwidth = nil
570 for l, w in pairs(APT.debians[k].IPs) do
571 if type(w) == "table" then
572 n[l] = {}
573 for i, u in pairs(w) do
574 local log = logCount(k, i)
575 if "" == log then n[l][i] = u else n[l][log .. " " .. revDNS(APT.debians, k, i)] = u end
576 end
577 else
578 local log = logCount(k, l)
579 if "" == log then n[l] = w else n[log .. " " .. revDNS(APT.debians, k, l)] = w end
580 end
581 end
582 m[log .. " DNS entries -" .. redirs(APT.mirrors, k)] = n
583 end
584 web:write(APT.dumpTableHTML(m, "", ""))
585
586 web:write( "<hr>\n<hr>\n<p>The <a href='Report-email.txt'>email report</a>. &nbsp; " ..
458 "All <a href='../results'>the logs and other output</a>. &nbsp; " .. 587 "All <a href='../results'>the logs and other output</a>. &nbsp; " ..
459 "You can get the <a href='https://sledjhamr.org/cgit/apt-panopticon/about/'>source code here</a>.</p>\n") 588 "You can get the <a href='https://sledjhamr.org/cgit/apt-panopticon/about/'>source code here</a>.</p>\n")
460 local status, whn = APT.execute('TZ="GMT" ls -l1 --time-style="+%s" results/stamp | cut -d " " -f 6-6') 589 local status, whn = APT.execute('TZ="GMT" ls -l1 --time-style="+%s" results/stamp | cut -d " " -f 6-6')
diff --git a/apt-panopticon.lua b/apt-panopticon.lua
index 13adead..b2827b4 100755
--- a/apt-panopticon.lua
+++ b/apt-panopticon.lua
@@ -376,6 +376,8 @@ checkHEAD = function (host, URL, r, retry, sanity)
376 local extraArgs = sendArgs .. ' -o -r ' 376 local extraArgs = sendArgs .. ' -o -r '
377 if 'https' == pu.scheme then extraArgs = extraArgs .. ' --tests=-http' end 377 if 'https' == pu.scheme then extraArgs = extraArgs .. ' --tests=-http' end
378 if 'http' == pu.scheme then extraArgs = extraArgs .. ' --tests=-https' end 378 if 'http' == pu.scheme then extraArgs = extraArgs .. ' --tests=-https' end
379 local pth = path:match('^(.*/pool/).*$')
380 if nil ~= pth then table.insert(APT.results[PU.scheme].redirects, pu.host .. "/" .. pth) else E('Odd redirect path ' .. path) end
379 I(" Now checking redirected host " .. u) 381 I(" Now checking redirected host " .. u)
380 APT.fork("ionice -c3 nice -n 19 " .. downloadLock .. "REDIR-" .. check .. ".log.txt" .. " ./apt-panopticon.lua " .. extraArgs .. ' ' .. pu.host .. "/" .. path .. " " .. file) 382 APT.fork("ionice -c3 nice -n 19 " .. downloadLock .. "REDIR-" .. check .. ".log.txt" .. " ./apt-panopticon.lua " .. extraArgs .. ' ' .. pu.host .. "/" .. path .. " " .. file)
381 D('logging to ' .. APT.logName(pu.host, nil, file)[2]) 383 D('logging to ' .. APT.logName(pu.host, nil, file)[2])
@@ -422,12 +424,10 @@ local checkFiles = function (host, ip, path, file)
422 end 424 end
423 end 425 end
424 end 426 end
425
426 for i, s in pairs(referenceDebs) do 427 for i, s in pairs(referenceDebs) do
427 if checkTimeouts(host, "http", ip .. path .. "/" .. s) then return end 428 if checkTimeouts(host, "http", ip .. path .. "/" .. s) then return end
428 if checkTimeouts(host, "https", ip .. path .. "/" .. s) then return end 429 if checkTimeouts(host, "https", ip .. path .. "/" .. s) then return end
429 end 430 end
430
431 for i, s in pairs(referenceDevs) do 431 for i, s in pairs(referenceDevs) do
432 if checkTimeouts(host, "http", ip .. path .. "/" .. s) then return end 432 if checkTimeouts(host, "http", ip .. path .. "/" .. s) then return end
433 if checkTimeouts(host, "https", ip .. path .. "/" .. s) then return end 433 if checkTimeouts(host, "https", ip .. path .. "/" .. s) then return end
@@ -994,7 +994,7 @@ if 0 < #arg then
994 rfile:close() 994 rfile:close()
995 end 995 end
996 996
997 if APT.origin and APT.options.referenceSite.value ~= pu.host then 997 if APT.origin and (not APT.redir) and (APT.options.referenceSite.value ~= pu.host) then
998os.execute('sleep 1') -- Wait for things to start up before checking for them. 998os.execute('sleep 1') -- Wait for things to start up before checking for them.
999 while 0 < APT.checkExes(downloadLock .. "Release-" .. pu.host .. ".log.txt") do os.execute("sleep 10") end 999 while 0 < APT.checkExes(downloadLock .. "Release-" .. pu.host .. ".log.txt") do os.execute("sleep 10") end
1000 while 0 < APT.checkExes(downloadLock .. "Packages-" .. pu.host .. ".log.txt") do os.execute("sleep 10") end 1000 while 0 < APT.checkExes(downloadLock .. "Packages-" .. pu.host .. ".log.txt") do os.execute("sleep 10") end
@@ -1038,6 +1038,103 @@ else
1038os.execute('sleep 1') -- Wait for things to start up before checking for them. 1038os.execute('sleep 1') -- Wait for things to start up before checking for them.
1039 while 1 <= APT.checkExes("apt-panopticon.lua " .. sendArgs) do os.execute("sleep 10") end 1039 while 1 <= APT.checkExes("apt-panopticon.lua " .. sendArgs) do os.execute("sleep 10") end
1040 1040
1041 local APT_args = APT.args
1042 local APT_logFile = APT.logFile
1043 local debians = {}
1044 local srvs = io.popen('ls -1 results/*.lua')
1045 for l in srvs:lines() do
1046 local hst = l:sub(9, -5)
1047 if (l:find('_') == nil) and (nil == APT.mirrors[hst]) then
1048 local ips = loadfile(l)().IPs
1049 if nil ~= ips then
1050 debians[hst] = {Country = '', FDQN = hst, Active = 'yes', Rate = '', BaseURL = hst, Protocols = {http = true, https = true}, Bandwidth = '', IPs = ips}
1051 local baseFiles = {}
1052 local IPfiles = {}
1053 for i, a in pairs(ips) do
1054 IPfiles[i] = {}
1055 if type(a) == 'table' then
1056 for j, b in pairs(a) do
1057 IPfiles[i][j] = {}
1058 end
1059 else
1060 end
1061 end
1062 local files = io.popen('ls -1 results/LOG_' .. hst .. '_*.html')
1063 for ll in files:lines() do
1064 local dn = false
1065 for i, a in pairs(ips) do
1066 if type(a) == 'table' then
1067 for j, b in pairs(a) do
1068 if nil ~= ll:match('(results/LOG_' .. hst .. '_' .. j .. '_.*)') then
1069 table.insert(IPfiles[i][j], ll)
1070 dn = true
1071 end
1072 end
1073 else
1074 if nil ~= ll:match('(results/LOG_' .. hst .. '_' .. i .. '_.*)') then
1075 table.insert(IPfiles[i], ll)
1076 dn = true
1077 end
1078 end
1079 end
1080 if not dn then table.insert(baseFiles, ll) end
1081 end
1082
1083 APT.logOpen(hst)
1084 APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n')
1085 for i, f in pairs(baseFiles) do
1086 f = f:sub(9, -1)
1087 APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. f .. '">' .. f .. '</a></h2>\n')
1088 for l in io.lines('results/' .. f) do
1089 if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end
1090 end
1091 end
1092 APT.logPost()
1093 APT.args = APT_args
1094 APT.logFile = APT_logFile
1095
1096 for ip, a in pairs(IPfiles) do
1097 if nil == a[1] then
1098 for i, f in pairs(a) do
1099 if not APT.logOpen(hst, i) then print('PROBLEM OPENING LOG FILE ' .. hst .. ' ' .. i) end
1100 APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n')
1101 for j, g in pairs(f) do
1102 g = g:sub(9, -1)
1103 APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. g .. '">' .. g .. '</a></h2>\n')
1104 for l in io.lines('results/' .. g) do
1105 if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end
1106 end
1107 end
1108 APT.logPost()
1109 APT.args = APT_args
1110 APT.logFile = APT_logFile
1111 end
1112 else
1113 if not APT.logOpen(hst, ip) then print('PROBLEM OPENING LOG FILE ' .. hst .. ' ' .. ip) end
1114 APT.logFile:write('<h1>Note log lines will be out of order, this is a bunch of other log files combined.</h1>\n')
1115 for i, f in pairs(a) do
1116 f = f:sub(9, -1)
1117 APT.logFile:write('<hr>\n<hr>\n<h2><a href="' .. f .. '">' .. f .. '</a></h2>\n')
1118 for l in io.lines('results/' .. f) do
1119 if l:match('^' .. os.date('%a %b %d ') .. '.*$') then APT.logFile:write(l .. '\n') end
1120 end
1121 end
1122 APT.logPost()
1123 APT.args = APT_args
1124 APT.logFile = APT_logFile
1125 end
1126 end
1127
1128 end
1129 end
1130 end
1131 local file, e = io.open("results/debians.lua", "w+")
1132 if nil == file then C("opening debians file - " .. e) else
1133 file:write(APT.dumpTable(debians, "", "debians") .. "\nreturn debians\n")
1134 file:close()
1135 end
1136
1137
1041 for k, v in pairs(APT.mirrors) do 1138 for k, v in pairs(APT.mirrors) do
1042 local f = 'results/' .. k .. '.lua' 1139 local f = 'results/' .. k .. '.lua'
1043 if APT.checkFile(f) then 1140 if APT.checkFile(f) then