aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xmirror-checker.lua22
1 files changed, 13 insertions, 9 deletions
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
133local E = function(s) log(0, "ERROR ", s) end 133local E = function(s) log(0, "ERROR ", s) end
134local C = function(s) log(-1, "CRITICAL", s) end 134local C = function(s) log(-1, "CRITICAL", s) end
135 135
136local testing = function(t)
137local mirrors = {} 136local mirrors = {}
138 137
138local testing = function(t, host)
139 for i, v in pairs(options.tests.value) do 139 for i, v in pairs(options.tests.value) do
140 if t == v then return true end 140 if t == v then
141 local h = mirrors[host]
142 if nil == h then return true end
143 if true == h["Protocols"][t] then return true else D("Skipping " .. t .. " checks for " .. host) end
144 end
141 end 145 end
142 return false 146 return false
143end 147end
@@ -262,20 +266,20 @@ local checkPaths = function (host, ip, path, file)
262 if nil ~= file then 266 if nil ~= file then
263 if "redirect" == ip then ip = host end 267 if "redirect" == ip then ip = host end
264 I(" Checking IP for file " .. host .. " -> " .. ip .. " " .. path .. " " .. file) 268 I(" Checking IP for file " .. host .. " -> " .. ip .. " " .. path .. " " .. file)
265 if testing("http") then checkURL(host, "http://" .. ip .. path .. "/" .. file) end 269 if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/" .. file) end
266 if testing("https") then checkURL(host, "https://" .. ip .. path .. "/" .. file) end 270 if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/" .. file) end
267 else 271 else
268 I(" Checking IP " .. host .. " -> " .. ip .. " " .. path) 272 I(" Checking IP " .. host .. " -> " .. ip .. " " .. path)
269 for i, s in pairs(referenceDebs) do 273 for i, s in pairs(referenceDevs) do
270 if testing("http") then checkURL(host, "http://" .. ip .. path .. "/" .. s) end 274 if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/" .. s) end
271 if testing("https") then checkURL(host, "https://" .. ip .. path .. "/" .. s) end 275 if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/" .. s) end
272 end 276 end
273 277
274 for i, s in pairs(releases) do 278 for i, s in pairs(releases) do
275 for j, k in pairs(releaseFiles) do 279 for j, k in pairs(releaseFiles) do
276 if repoExists(s .. k) then 280 if repoExists(s .. k) then
277 if testing("http") then checkURL(host, "http://" .. ip .. path .. "/merged/dists/" .. s .. k) end 281 if testing("http", host) then checkURL(host, "http://" .. ip .. path .. "/merged/dists/" .. s .. k) end
278 if testing("https") then checkURL(host, "https://" .. ip .. path .. "/merged/dists/" .. s .. k) end 282 if testing("https", host) then checkURL(host, "https://" .. ip .. path .. "/merged/dists/" .. s .. k) end
279 end 283 end
280 end 284 end
281 end 285 end