aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rwxr-xr-xapt-panopticon-report-DNS.lua52
1 files changed, 29 insertions, 23 deletions
diff --git a/apt-panopticon-report-DNS.lua b/apt-panopticon-report-DNS.lua
index b26bde5..178659b 100755
--- a/apt-panopticon-report-DNS.lua
+++ b/apt-panopticon-report-DNS.lua
@@ -54,33 +54,36 @@ end
54-- Use this to dump a table to a string. 54-- Use this to dump a table to a string.
55dumpTable = function (table, space, name) 55dumpTable = function (table, space, name)
56 local r = "" 56 local r = ""
57 if "" == space then r = r .. space .. name .. " =\n" else r = r .. space .. "[" .. name .. "] =\n" end 57-- if "" == space then r = r .. space .. name .. " =\n" else r = r .. space .. "[" .. name .. "] =\n" end
58 r = r .. space .. "{\n" 58 if "" == space then r = r .. space .. name .. " \n" else r = r .. space .. name .. "\n" end
59-- r = r .. space .. "{\n"
59 r = r .. dumpTableSub(table, space .. " ") 60 r = r .. dumpTableSub(table, space .. " ")
60 if "" == space then r = r .. space .. "}\n" else r = r .. space .. "},\n" end 61-- if "" == space then r = r .. space .. "}\n" else r = r .. space .. "},\n" end
62 if "" == space then r = r .. space .. "\n" end
61 return r 63 return r
62end 64end
63dumpTableSub = function (table, space) 65dumpTableSub = function (table, space)
64 local r = "" 66 local r = ""
65-- for k, v in pairs(table) do 67-- for k, v in pairs(table) do
66 for k, v in orderedPairs(table) do 68 for k, v in orderedPairs(table) do
67 if type(k) == "string" then k = '"' .. k .. '"' end 69-- if type(k) == "string" then k = '"' .. k .. '"' end
68 if type(v) == "table" then 70 if type(v) == "table" then
69 r = r .. dumpTable(v, space, k) 71 r = r .. dumpTable(v, space, k)
70 elseif type(v) == "string" then 72-- elseif type(v) == "string" then
71 r = r .. space .. "[" .. k .. "] = '" .. v .. "';\n" 73-- r = r .. space .. "[" .. k .. "] = '" .. v .. "';\n"
72 elseif type(v) == "function" then 74-- elseif type(v) == "function" then
73 r = r .. space .. "[" .. k .. "] = function ();\n" 75-- r = r .. space .. "[" .. k .. "] = function ();\n"
74 elseif type(v) == "userdata" then 76-- elseif type(v) == "userdata" then
75 r = r .. space .. "userdata " .. "[" .. k .. "];\n" 77-- r = r .. space .. "userdata " .. "[" .. k .. "];\n"
76 elseif type(v) == "boolean" then 78-- elseif type(v) == "boolean" then
77 if (v) then 79-- if (v) then
78 r = r .. space .. "[" .. k .. "] = true;\n" 80-- r = r .. space .. "[" .. k .. "] = true;\n"
79 else 81-- else
80 r = r .. space .. "[" .. k .. "] = false;\n" 82-- r = r .. space .. "[" .. k .. "] = false;\n"
81 end 83-- end
82 else 84 else
83 r = r .. space .. "[" .. k .. "] = " .. v .. ";\n" 85-- r = r .. space .. "[" .. k .. "] = " .. v .. ";\n"
86 r = r .. space .. k .. "\n"
84 end 87 end
85 end 88 end
86 return r 89 return r
@@ -121,9 +124,8 @@ local W = function(s, p, t, h) log(1, "WARNING ", s, p, t, h) end
121local E = function(s, p, t, h) log(0, "ERROR ", s, p, t, h) end 124local E = function(s, p, t, h) log(0, "ERROR ", s, p, t, h) end
122local C = function(s) log(-1, "CRITICAL", s) end 125local C = function(s) log(-1, "CRITICAL", s) end
123 126
124local mirrors = {} 127local mirrors = loadfile("results/mirrors.lua")()
125 128local m = {}
126mirrors = loadfile("results/mirrors.lua")()
127 129
128for k, v in pairs(mirrors) do 130for k, v in pairs(mirrors) do
129 mirrors[k].Protocols = nil 131 mirrors[k].Protocols = nil
@@ -133,12 +135,16 @@ for k, v in pairs(mirrors) do
133 mirrors[k].BaseURL = nil 135 mirrors[k].BaseURL = nil
134 mirrors[k].Country = nil 136 mirrors[k].Country = nil
135 mirrors[k].Bandwidth = nil 137 mirrors[k].Bandwidth = nil
138 m["\n" .. k .. " DNS entries"] = mirrors[k].IPs
136end 139end
137 140
138 141
139local file, e = io.open("results/REPORT-DNS.txt", "w+") 142local file, e = io.open("results/Report-DNS.txt", "w+")
140if nil == file then C("opening mirrors file - " .. e) else 143if nil == file then C("opening mirrors file - " .. e) else
141 file:write(dumpTable(mirrors, "", "DNS report")) 144 file:write("This DNS report lists each mirror, and the DNS entries for that mirror. \n" ..
145 "If a mirror has a CNAME, that CNAME is listed along with that CNAMEs DNS entries.\n" ..
146 "deb.devuan.org is the DNS round robin, which points to the mirrors that are part of the DNS-RR.\n" ..
147 "pkgmaster.devuan.org is the master mirror, all the others sync to it.\n")
148 file:write(dumpTable(m, "", ""))
142 file:close() 149 file:close()
143end 150end
144