aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--README.md5
-rwxr-xr-xmirror-checker.lua39
2 files changed, 30 insertions, 14 deletions
diff --git a/README.md b/README.md
index 77c642d..8839e63 100644
--- a/README.md
+++ b/README.md
@@ -191,8 +191,9 @@ Open results/mirror-checker-lua.log for message logging.
191 191
192Download mirror_list.txt from the reference site. Build a table of 192Download mirror_list.txt from the reference site. Build a table of
193Active mirrors keyed by the FDQN, include the listed Protocols as a sub 193Active mirrors keyed by the FDQN, include the listed Protocols as a sub
194table. Write this table to results/mirrors.lua so that the forked tests 194table. Add the round robin domain name. Resolve all the IPs and add
195can read it. 195them to this table. Write this table to results/mirrors.lua so that the
196forked tests can read it.
196 197
197Remove the mirror site from the mirrors table, then checkHost() it 198Remove the mirror site from the mirrors table, then checkHost() it
198first. 199first.
diff --git a/mirror-checker.lua b/mirror-checker.lua
index f4b5142..6580190 100755
--- a/mirror-checker.lua
+++ b/mirror-checker.lua
@@ -182,7 +182,7 @@ local repoExists = function (r)
182end 182end
183 183
184local IP = {} 184local IP = {}
185local gatherIPs = function (host) 185gatherIPs = function (host)
186 if nil == IP[host] then 186 if nil == IP[host] then
187 local IPs 187 local IPs
188 local dig = io.popen('dig +keepopen +noall +nottlid +answer ' .. host .. ' A ' .. host .. ' AAAA ' .. host .. ' CNAME ' .. host .. ' SRV | sort -r | uniq') 188 local dig = io.popen('dig +keepopen +noall +nottlid +answer ' .. host .. ' A ' .. host .. ' AAAA ' .. host .. ' CNAME ' .. host .. ' SRV | sort -r | uniq')
@@ -193,6 +193,13 @@ local gatherIPs = function (host)
193 if "." == v:sub(-1, -1) then v = v:sub(1, -2) end 193 if "." == v:sub(-1, -1) then v = v:sub(1, -2) end
194 if nil == IP[k] then IP[k] = {} end 194 if nil == IP[k] then IP[k] = {} end
195 IP[k][v] = t 195 IP[k][v] = t
196 D(" DNS record " .. host .. " == " .. k .. " type " .. t .. " -> " .. v)
197 if t == "CNAME" then
198 gatherIPs(v)
199 IP[k][v] = IP[v]
200 elseif v == "SRV" then
201 print("SVR record found, now what do we do?")
202 end
196 end 203 end
197 end 204 end
198 until nil == IPs 205 until nil == IPs
@@ -349,17 +356,23 @@ checkHost = function (orig, host, path, ip, file)
349 D("checkHost " .. orig .. "" .. file) 356 D("checkHost " .. orig .. "" .. file)
350 if testing("IPv4") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " -o " .. orig .. path .. " " .. file .." &") end 357 if testing("IPv4") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " -o " .. orig .. path .. " " .. file .." &") end
351 else D("checkHost " .. orig .. " -> " .. host) end 358 else D("checkHost " .. orig .. " -> " .. host) end
352 gatherIPs(ph.host) 359 local h = mirrors[ph.host]
353 for k, v in pairs(IP[ph.host]) do 360 if nil == h then return end
354 D(" DNS record " .. v .. " " .. ph.host .. " -> " .. k) 361 for k, v in pairs(h.IPs) do
355 if v == "A" then 362 if "table" == type(v) then
356 if testing("IPv4") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " " .. k .. " " .. file .." &") end 363 for k1, v1 in pairs(v) do
357 elseif v == "AAAA" then 364 if v1 == "A" then
358 if testing("IPv6") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " [" .. k .. "] " .. file .. " &") end 365 if testing("IPv4") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " " .. k1 .. " " .. file .." &") end
359 elseif v == "CNAME" then 366 elseif v1 == "AAAA" then
360 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. 367 if testing("IPv6") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " [" .. k1 .. "] " .. file .. " &") end
361 elseif v == "SRV" then 368 end
362 print("SVR record found, now what do we do?") 369 end
370 else
371 if v == "A" then
372 if testing("IPv4") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " " .. k .. " " .. file .." &") end
373 elseif v == "AAAA" then
374 if testing("IPv6") then execute("ionice -c3 ./mirror-checker.lua " .. sendArgs .. " " .. orig .. path .. " [" .. k .. "] " .. file .. " &") end
375 end
363 end 376 end
364 end 377 end
365 end 378 end
@@ -410,6 +423,8 @@ local getMirrors = function ()
410 end 423 end
411 host = d 424 host = d
412 m[t] = d 425 m[t] = d
426 gatherIPs(host)
427 m["IPs"] = IP[host]
413 elseif "Protocols" == t then 428 elseif "Protocols" == t then
414 local prot = {} 429 local prot = {}
415 for w in d:gmatch("(%w+)") do 430 for w in d:gmatch("(%w+)") do