aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mirror-checker.lua
diff options
context:
space:
mode:
authoronefang2019-09-29 12:29:48 +1000
committeronefang2019-09-29 12:29:48 +1000
commitfbd53b3ef35ced9589f77aae34313016412de195 (patch)
tree45017161691898f69a10c7647fcfb0b87ca5f339 /mirror-checker.lua
parentcheckPaths -> checkFiles (diff)
downloadapt-panopticon-fbd53b3ef35ced9589f77aae34313016412de195.zip
apt-panopticon-fbd53b3ef35ced9589f77aae34313016412de195.tar.gz
apt-panopticon-fbd53b3ef35ced9589f77aae34313016412de195.tar.bz2
apt-panopticon-fbd53b3ef35ced9589f77aae34313016412de195.tar.xz
checkRedirects -> checkHost
Diffstat (limited to '')
-rwxr-xr-xmirror-checker.lua16
1 files changed, 8 insertions, 8 deletions
diff --git a/mirror-checker.lua b/mirror-checker.lua
index f443789..81b32db 100755
--- a/mirror-checker.lua
+++ b/mirror-checker.lua
@@ -215,7 +215,7 @@ checkHEAD = function (host, URL, r, retry)
215 local f = io.popen(string.format('if [ ! -f results/%s.check ] ; then touch results/%s.check; echo -n "check"; fi', file:gsub("/", "_"), file:gsub("/", "_") )):read("*a") 215 local f = io.popen(string.format('if [ ! -f results/%s.check ] ; then touch results/%s.check; echo -n "check"; fi', file:gsub("/", "_"), file:gsub("/", "_") )):read("*a")
216 if (nil == f) or ("check" == f) then 216 if (nil == f) or ("check" == f) then
217 I(" Now checking redirected host " .. file) 217 I(" Now checking redirected host " .. file)
218 checkRedirects(host, host, nil, "redir", pl.path) 218 checkHost(host, host, nil, "redir", pl.path)
219 else 219 else
220 D(" Already checking " .. file) 220 D(" Already checking " .. file)
221 end 221 end
@@ -304,7 +304,7 @@ local execute = function (s)
304 os.execute(s) 304 os.execute(s)
305end 305end
306 306
307checkRedirects = function (orig, host, path, ip, file) 307checkHost = function (orig, host, path, ip, file)
308 if nil == host then host = orig end 308 if nil == host then host = orig end
309 if nil == path then path = "" end 309 if nil == path then path = "" end
310 if nil == file then file = "" end 310 if nil == file then file = "" end
@@ -318,7 +318,7 @@ checkRedirects = function (orig, host, path, ip, file)
318 checkFiles(po.host, ip, path) 318 checkFiles(po.host, ip, path)
319 end 319 end
320 else 320 else
321 if orig == host then D("checkRedirects " .. orig .. "" .. file) else D("checkRedirects " .. orig .. " -> " .. host) end 321 if orig == host then D("checkHost " .. orig .. "" .. file) else D("checkHost " .. orig .. " -> " .. host) end
322-- TODO - use checkFiles() here ^^^ on the original domain name, coz that's not getting caught yet. I think. 322-- TODO - use checkFiles() here ^^^ on the original domain name, coz that's not getting caught yet. I think.
323 gatherIPs(ph.host) 323 gatherIPs(ph.host)
324 for k, v in pairs(IP[ph.host]) do 324 for k, v in pairs(IP[ph.host]) do
@@ -328,7 +328,7 @@ checkRedirects = function (orig, host, path, ip, file)
328 elseif v == "AAAA" then 328 elseif v == "AAAA" then
329 if testing("IPv6") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " [" .. k .. "] " .. file .. " &") end 329 if testing("IPv6") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " [" .. k .. "] " .. file .. " &") end
330 elseif v == "CNAME" then 330 elseif v == "CNAME" then
331 checkRedirects(orig, k, path, ip, file) -- Check the original, with the DNS records from the CNAME. Do not check the CNAME, it's just a source of IPs. 331 checkHost(orig, k, path, ip, file) -- Check the original, with the DNS records from the CNAME. Do not check the CNAME, it's just a source of IPs.
332 elseif v == "SRV" then 332 elseif v == "SRV" then
333 print("SVR record found, now what do we do?") 333 print("SVR record found, now what do we do?")
334 end 334 end
@@ -510,7 +510,7 @@ if 0 < #arg then
510 checkExes(downloadLock) 510 checkExes(downloadLock)
511 end 511 end
512 end 512 end
513 checkRedirects(pu.host, pu.host, pu.path, arg[2], arg[3]) 513 checkHost(pu.host, pu.host, pu.path, arg[2], arg[3])
514 logFile:close() 514 logFile:close()
515else 515else
516 if not keep then os.execute("rm -f results/*.log") end 516 if not keep then os.execute("rm -f results/*.log") end
@@ -523,9 +523,9 @@ else
523 mirrors = getMirrors() 523 mirrors = getMirrors()
524--print(dumpTable(mirrors, "", "mirrors")) 524--print(dumpTable(mirrors, "", "mirrors"))
525 mirrors[options.referenceSite.value] = nil 525 mirrors[options.referenceSite.value] = nil
526 checkRedirects(options.referenceSite.value) 526 checkHost(options.referenceSite.value)
527-- forkIP(options.referenceSite.value) 527-- forkIP(options.referenceSite.value)
528 checkRedirects("deb.devuan.org") 528 checkHost("deb.devuan.org")
529-- forkIP("deb.devuan.org") 529-- forkIP("deb.devuan.org")
530 for k, m in pairs(mirrors) do 530 for k, m in pairs(mirrors) do
531 if "/" == m.BaseURL:sub(-1, -1) then 531 if "/" == m.BaseURL:sub(-1, -1) then
@@ -533,7 +533,7 @@ else
533 m.BaseURL = m.BaseURL:sub(1, -2) 533 m.BaseURL = m.BaseURL:sub(1, -2)
534 end 534 end
535 local pu = url.parse("http://" .. m.BaseURL) 535 local pu = url.parse("http://" .. m.BaseURL)
536 checkRedirects(m.BaseURL) 536 checkHost(m.BaseURL)
537-- forkIP(m.BaseURL) 537-- forkIP(m.BaseURL)
538 checkExes("mirror-checker.lua " .. sendArgs) 538 checkExes("mirror-checker.lua " .. sendArgs)
539 if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end 539 if testing("Integrity") or testing("Updated") then checkExes(downloadLock) end