From 1e8c9eb05017fe95ee1c96496a71940b99edd7f3 Mon Sep 17 00:00:00 2001 From: onefang Date: Sat, 7 Sep 2019 01:26:44 +1000 Subject: Parse more of mirror_list.txt Don't bother checking mirrors where Active is not yes. Split up the protocols, so we can check later which ones are supported. --- mirror-checker.lua | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) (limited to 'mirror-checker.lua') diff --git a/mirror-checker.lua b/mirror-checker.lua index 96cc099..9dd93bb 100755 --- a/mirror-checker.lua +++ b/mirror-checker.lua @@ -335,22 +335,36 @@ local getMirrors = function () local mirrors = {} local host = "" local m = {} + local active = true local URL = "https://" .. options.referenceSite.value .. "/mirror_list.txt" I("getting mirrors.") local p, c, h = http.request(URL) if nil == p then E(c .. " fetching " .. URL) else for l in p:gmatch("\n*([^\n]+)\n*") do local t, d = l:match("(%a*):%s*(.*)") + d = string.lower(d) if "FQDN" == t then if "" ~= host then - mirrors[host] = m + if active then mirrors[host] = m end m = {} + active = true end host = d + m[t] = d + elseif "Protocols" == t then + local prot = {} + for w in d:gmatch("(%w+)") do + prot[w] = true; + end + m[t] = prot + elseif "Active" == t and nil == d:find("yes", 1, true) then + W("Mirror " .. host .. " is not active - " .. d) + active = false + else + m[t] = d end - m[t] = d end - if "" ~= host then + if "" ~= host and active then mirrors[host] = m end end -- cgit v1.1