diff options
Diffstat (limited to '')
-rw-r--r-- | apt-panopticommon.lua | 8 | ||||
-rwxr-xr-x | apt-panopticon.lua | 8 |
2 files changed, 13 insertions, 3 deletions
diff --git a/apt-panopticommon.lua b/apt-panopticommon.lua index e40ec0a..7664297 100644 --- a/apt-panopticommon.lua +++ b/apt-panopticommon.lua | |||
@@ -23,6 +23,7 @@ APT.verbosity = -1 | |||
23 | APT.origin = false | 23 | APT.origin = false |
24 | APT.redir = false | 24 | APT.redir = false |
25 | APT.keep = false | 25 | APT.keep = false |
26 | APT.IPv46 = '' | ||
26 | 27 | ||
27 | APT.options = | 28 | APT.options = |
28 | { | 29 | { |
@@ -119,6 +120,10 @@ APT.parseArgs = function(args) | |||
119 | APT.args = args | 120 | APT.args = args |
120 | local arg = {} | 121 | local arg = {} |
121 | local sendArgs = "" | 122 | local sendArgs = "" |
123 | -- A special test to disable IPv6 tests if IPv6 isn't available. | ||
124 | if 1 == APT.exe('ip -6 addr | grep inet6 | grep " global"'):Do().status then | ||
125 | table.insert(args, '--tests=-IPv6') | ||
126 | end | ||
122 | if 0 ~= #(args) then | 127 | if 0 ~= #(args) then |
123 | local option = "" | 128 | local option = "" |
124 | for i, a in pairs(args) do | 129 | for i, a in pairs(args) do |
@@ -132,6 +137,9 @@ APT.parseArgs = function(args) | |||
132 | elseif "-q" == a then | 137 | elseif "-q" == a then |
133 | APT.verbosity = -1 | 138 | APT.verbosity = -1 |
134 | sendArgs = sendArgs .. a .. " " | 139 | sendArgs = sendArgs .. a .. " " |
140 | elseif ("-4" == a) or ("-6" == a) then | ||
141 | APT.IPv46 = a | ||
142 | sendArgs = sendArgs .. a .. " " | ||
135 | elseif "-k" == a then | 143 | elseif "-k" == a then |
136 | APT.keep = true | 144 | APT.keep = true |
137 | sendArgs = sendArgs .. a .. " " | 145 | sendArgs = sendArgs .. a .. " " |
diff --git a/apt-panopticon.lua b/apt-panopticon.lua index aa089b1..057fc40 100755 --- a/apt-panopticon.lua +++ b/apt-panopticon.lua | |||
@@ -265,6 +265,7 @@ checkHEAD = function (host, URL, r, retry, sanity) | |||
265 | -header "" - add extra headers. | 265 | -header "" - add extra headers. |
266 | -L - DO follow redirects. | 266 | -L - DO follow redirects. |
267 | --max-redirs n - set maximum redirects, default is 50, -1 = unlimited. | 267 | --max-redirs n - set maximum redirects, default is 50, -1 = unlimited. |
268 | -4 or -6 - Only use IPv4 or IPv6 | ||
268 | --retry n - maximum retries, default is 0, no retries. | 269 | --retry n - maximum retries, default is 0, no retries. |
269 | -o file - write to file instead of stdout. | 270 | -o file - write to file instead of stdout. |
270 | --path-as-is - https://curl.haxx.se/libcurl/c/CURLOPT_PATH_AS_IS.html might be useful for URLSanity. | 271 | --path-as-is - https://curl.haxx.se/libcurl/c/CURLOPT_PATH_AS_IS.html might be useful for URLSanity. |
@@ -274,7 +275,7 @@ checkHEAD = function (host, URL, r, retry, sanity) | |||
274 | -D file - write the received headers to a file. This includes the status code and string. | 275 | -D file - write the received headers to a file. This includes the status code and string. |
275 | ]] | 276 | ]] |
276 | local status = APT.exe( | 277 | local status = APT.exe( |
277 | 'curl -I --retry 0 -s --path-as-is --connect-timeout ' .. APT.options.timeout.value .. ' --max-redirs 0 ' .. | 278 | 'curl -I --retry 0 -s --path-as-is --connect-timeout ' .. APT.options.timeout.value .. ' --max-redirs 0 ' .. APT.IPv46 .. ' ' .. |
278 | IP .. ' ' .. '-o /dev/null -D results/"HEADERS_' .. fname .. '" ' .. | 279 | IP .. ' ' .. '-o /dev/null -D results/"HEADERS_' .. fname .. '" ' .. |
279 | hdr .. ' -w "#%{http_code} %{ssl_verify_result} %{url_effective}\\n" ' .. PU.scheme .. '://' .. host .. PU.path .. ' >>results/"STATUS_' .. fname .. '"' | 280 | hdr .. ' -w "#%{http_code} %{ssl_verify_result} %{url_effective}\\n" ' .. PU.scheme .. '://' .. host .. PU.path .. ' >>results/"STATUS_' .. fname .. '"' |
280 | ):Nice():log():Do().status | 281 | ):Nice():log():Do().status |
@@ -519,6 +520,7 @@ local download = "curl" .. | |||
519 | " --create-dirs -f -L" .. | 520 | " --create-dirs -f -L" .. |
520 | " --fail-early" .. | 521 | " --fail-early" .. |
521 | " --max-time " .. APT.options.maxtime.value .. | 522 | " --max-time " .. APT.options.maxtime.value .. |
523 | APT.IPv46 .. ' ' .. | ||
522 | " --retry " .. APT.options.retries.value .. | 524 | " --retry " .. APT.options.retries.value .. |
523 | " -R -v -z 'results/stamp.old' --stderr results/" | 525 | " -R -v -z 'results/stamp.old' --stderr results/" |
524 | local downloads = function(host, URL, meta, release, list) | 526 | local downloads = function(host, URL, meta, release, list) |
@@ -1025,9 +1027,9 @@ if 0 < #arg then | |||
1025 | APT.allpairs(ips, | 1027 | APT.allpairs(ips, |
1026 | function(k, v) | 1028 | function(k, v) |
1027 | if v == "A" then | 1029 | if v == "A" then |
1028 | if APT.testing("IPv4") then APT.exe("./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k .. " " .. file):Nice():log():fork() end | 1030 | if APT.testing("IPv4") then APT.exe('./apt-panopticon.lua ' .. sendArgs .. ' -4 ' .. pu.host .. path .. ' ' .. k .. ' ' .. file):Nice():log():fork() end |
1029 | elseif v == "AAAA" then | 1031 | elseif v == "AAAA" then |
1030 | if APT.testing("IPv6") then APT.exe("./apt-panopticon.lua " .. sendArgs .. " " .. pu.host .. path .. " " .. k .. " " .. file):Nice():log():fork() end | 1032 | if APT.testing("IPv6") then APT.exe('./apt-panopticon.lua ' .. sendArgs .. ' -6 ' .. APT.IPv46 .. ' ' .. pu.host .. path .. ' ' .. k .. ' ' .. file):Nice():log():fork() end |
1031 | end | 1033 | end |
1032 | D('logging to ' .. APT.logName(pu.host, k, file)[2]) | 1034 | D('logging to ' .. APT.logName(pu.host, k, file)[2]) |
1033 | end | 1035 | end |