diff options
Diffstat (limited to '')
-rw-r--r-- | README.md | 18 | ||||
-rwxr-xr-x | mirror-checker.lua | 16 |
2 files changed, 17 insertions, 17 deletions
@@ -190,19 +190,19 @@ Active mirrors keyed by the FDQN, include the listed Protocols as a sub | |||
190 | table. Write this table to results/mirrors.lua so that the forked tests | 190 | table. Write this table to results/mirrors.lua so that the forked tests |
191 | can read it. | 191 | can read it. |
192 | 192 | ||
193 | Remove the mirror site from the mirrors table, then checkRedirects() it | 193 | Remove the mirror site from the mirrors table, then checkHost() it |
194 | first. | 194 | first. |
195 | 195 | ||
196 | checkRedirects() deb.devuan.org, the DNS RR. | 196 | checkHost() deb.devuan.org, the DNS RR. |
197 | 197 | ||
198 | Loop through the mirrors table, and checkRedirects() each one. | 198 | Loop through the mirrors table, and checkHost() each one. |
199 | 199 | ||
200 | Wait for all forked tests to finish. | 200 | Wait for all forked tests to finish. |
201 | 201 | ||
202 | Delete results/*.check. | 202 | Delete results/*.check. |
203 | 203 | ||
204 | 204 | ||
205 | The checkRedirects() function does this - | 205 | The checkHost() function does this - |
206 | 206 | ||
207 | If there is no second argument, then the host is set to the first | 207 | If there is no second argument, then the host is set to the first |
208 | argument, otherwise the host is the second argument. | 208 | argument, otherwise the host is the second argument. |
@@ -222,7 +222,7 @@ ionice -c3 ./mirror-checker.lua example.com/path x.x.x.x & | |||
222 | 222 | ||
223 | ionice -c3 ./mirror-checker.lua example.com/path [x:x:x:x:x:x] & | 223 | ionice -c3 ./mirror-checker.lua example.com/path [x:x:x:x:x:x] & |
224 | 224 | ||
225 | For each CNAME, it checkRedirects() the host, but with the CNAME as a | 225 | For each CNAME, it checkHost() the host, but with the CNAME as a |
226 | second argument. | 226 | second argument. |
227 | 227 | ||
228 | SRV reconds don't do anything yet, coz I have yet to see one from my test | 228 | SRV reconds don't do anything yet, coz I have yet to see one from my test |
@@ -241,9 +241,9 @@ directory, downloads the reference files using wget. While it should | |||
241 | actually perform the Integrity and Updated tests now, those haven't been | 241 | actually perform the Integrity and Updated tests now, those haven't been |
242 | written yet. Note that currently this downloads 4GB per mirror. | 242 | written yet. Note that currently this downloads 4GB per mirror. |
243 | 243 | ||
244 | Calls checkRedirects() with the host as first and second arguments, and | 244 | Calls checkHost() with the host as first and second arguments, and |
245 | includes the IP this time. The inclusion of the IP causes | 245 | includes the IP this time. The inclusion of the IP causes |
246 | checkRedirects() to call checkFiles(). | 246 | checkHost() to call checkFiles(). |
247 | 247 | ||
248 | 248 | ||
249 | checkFiles() will call checkHEAD() for each of the reference files. | 249 | checkFiles() will call checkHEAD() for each of the reference files. |
@@ -253,7 +253,7 @@ checkHEAD() uses LuaSocket (or LuaSec for HTTPS) to send a HEAD request to | |||
253 | the IP, with a Host header set to the original host name. Redirects will | 253 | the IP, with a Host header set to the original host name. Redirects will |
254 | not be followed by that request. If the request returns a redirect, then | 254 | not be followed by that request. If the request returns a redirect, then |
255 | checkHEAD() is called recursively. If the redirect is to some host we are | 255 | checkHEAD() is called recursively. If the redirect is to some host we are |
256 | not already checking, we call checkRedirects() on it, with an IP of | 256 | not already checking, we call checkHost() on it, with an IP of |
257 | "redir". This causes checkRedirects() to bypass the test that would | 257 | "redir". This causes checkHost() to bypass the test that would |
258 | otherwise call checkFiles(), instead gathering the IPs and fork as usual. | 258 | otherwise call checkFiles(), instead gathering the IPs and fork as usual. |
259 | 259 | ||
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) |
305 | end | 305 | end |
306 | 306 | ||
307 | checkRedirects = function (orig, host, path, ip, file) | 307 | checkHost = 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() |
515 | else | 515 | else |
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 |