From 0c8e9bf6dc96e6970aac00af9546293d23916bc0 Mon Sep 17 00:00:00 2001 From: onefang Date: Sat, 7 Sep 2019 01:34:25 +1000 Subject: Use the saved mirrors list and the split packages lists. --- mirror-checker.lua | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'mirror-checker.lua') diff --git a/mirror-checker.lua b/mirror-checker.lua index 6d74e59..d141f8e 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua @@ -133,11 +133,15 @@ local W = function(s) log(1, "WARNING ", s) end local E = function(s) log(0, "ERROR ", s) end local C = function(s) log(-1, "CRITICAL", s) end -local testing = function(t) local mirrors = {} +local testing = function(t, host) for i, v in pairs(options.tests.value) do - if t == v then return true end + if t == v then + local h = mirrors[host] + if nil == h then return true end + if true == h["Protocols"][t] then return true else D("Skipping " .. t .. " checks for " .. host) end + end end return false end @@ -262,20 +266,20 @@ local checkPaths = function (host, ip, path, file) if nil ~= file then if "redirect" == ip then ip = host end I(" Checking IP for file " .. host .. " -> " .. ip .. " " .. path .. " " .. file) - if testing("http") then checkURL(host, "http://" .. ip .. path .. "/" .. file) end - if testing("https") then checkURL(host, "https://" .. ip .. path .. "/" .. file) end + if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/" .. file) end + if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/" .. file) end else I(" Checking IP " .. host .. " -> " .. ip .. " " .. path) - for i, s in pairs(referenceDebs) do - if testing("http") then checkURL(host, "http://" .. ip .. path .. "/" .. s) end - if testing("https") then checkURL(host, "https://" .. ip .. path .. "/" .. s) end + for i, s in pairs(referenceDevs) do + if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/" .. s) end + if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/" .. s) end end for i, s in pairs(releases) do for j, k in pairs(releaseFiles) do if repoExists(s .. k) then - if testing("http") then checkURL(host, "http://" .. ip .. path .. "/merged/dists/" .. s .. k) end - if testing("https") then checkURL(host, "https://" .. ip .. path .. "/merged/dists/" .. s .. k) end + if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/merged/dists/" .. s .. k) end + if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/merged/dists/" .. s .. k) end end end end -- cgit v1.1