update-01.04

This commit is contained in:
github-actions[bot] 2022-01-04 20:32:06 +08:00
parent 4aded5bb3a
commit 98e3ee56d9
11 changed files with 81 additions and 109 deletions

View File

@ -279,30 +279,35 @@ function clone(org)
return res return res
end end
function get_bin_version_cache(file, cmd)
sys.call("mkdir -p /tmp/etc/passwall_tmp")
if fs.access(file) then
chmod_755(file)
local md5 = sys.exec("echo -n $(md5sum " .. file .. " | awk '{print $1}')")
if fs.access("/tmp/etc/passwall_tmp/" .. md5) then
return sys.exec("echo -n $(cat /tmp/etc/passwall_tmp/%s)" % md5)
else
local version = sys.exec(string.format("echo -n $(%s %s)", file, cmd))
sys.call("echo '" .. version .. "' > " .. "/tmp/etc/passwall_tmp/" .. md5)
return version
end
end
return ""
end
function get_v2ray_path() function get_v2ray_path()
local path = uci_get_type("global_app", "v2ray_file") local path = uci_get_type("global_app", "v2ray_file")
return path return path
end end
function get_v2ray_version(file) function get_v2ray_version(file)
sys.call("mkdir -p /tmp/etc/passwall_tmp")
if file == nil then file = get_v2ray_path() end if file == nil then file = get_v2ray_path() end
chmod_755(file) local cmd = "-version | awk '{print $2}' | sed -n 1P"
if fs.access(file) then
if file == get_v2ray_path() then if file == get_v2ray_path() then
local md5 = sys.exec("echo -n $(md5sum " .. file .. " | awk '{print $1}')") return get_bin_version_cache(file, cmd)
if fs.access("/tmp/etc/passwall_tmp/" .. md5) then
return sys.exec("echo -n $(cat /tmp/etc/passwall_tmp/%s)" % md5)
else else
local version = sys.exec("echo -n $(%s -version | awk '{print $2}' | sed -n 1P)" % file) return sys.exec(string.format("echo -n $(%s %s)", file, cmd))
sys.call("echo '" .. version .. "' > " .. "/tmp/etc/passwall_tmp/" .. md5)
return version
end end
else
return sys.exec("echo -n $(%s -version | awk '{print $2}' | sed -n 1P)" % file)
end
end
return ""
end end
function get_xray_path() function get_xray_path()
@ -311,24 +316,13 @@ function get_xray_path()
end end
function get_xray_version(file) function get_xray_version(file)
sys.call("mkdir -p /tmp/etc/passwall_tmp")
if file == nil then file = get_xray_path() end if file == nil then file = get_xray_path() end
chmod_755(file) local cmd = "-version | awk '{print $2}' | sed -n 1P"
if fs.access(file) then
if file == get_xray_path() then if file == get_xray_path() then
local md5 = sys.exec("echo -n $(md5sum " .. file .. " | awk '{print $1}')") return get_bin_version_cache(file, cmd)
if fs.access("/tmp/etc/passwall_tmp/" .. md5) then
return sys.exec("echo -n $(cat /tmp/etc/passwall_tmp/%s)" % md5)
else else
local version = sys.exec("echo -n $(%s -version | awk '{print $2}' | sed -n 1P)" % file) return sys.exec(string.format("echo -n $(%s %s)", file, cmd))
sys.call("echo '" .. version .. "' > " .. "/tmp/etc/passwall_tmp/" .. md5)
return version
end end
else
return sys.exec("echo -n $(%s -version | awk '{print $2}' | sed -n 1P)" % file)
end
end
return ""
end end
function get_trojan_go_path() function get_trojan_go_path()
@ -337,24 +331,13 @@ function get_trojan_go_path()
end end
function get_trojan_go_version(file) function get_trojan_go_version(file)
sys.call("mkdir -p /tmp/etc/passwall_tmp")
if file == nil then file = get_trojan_go_path() end if file == nil then file = get_trojan_go_path() end
chmod_755(file) local cmd = "-version | awk '{print $2}' | sed -n 1P"
if fs.access(file) then
if file == get_trojan_go_path() then if file == get_trojan_go_path() then
local md5 = sys.exec("echo -n $(md5sum " .. file .. " | awk '{print $1}')") return get_bin_version_cache(file, cmd)
if fs.access("/tmp/etc/passwall_tmp/" .. md5) then
return sys.exec("echo -n $(cat /tmp/etc/passwall_tmp/%s)" % md5)
else else
local version = sys.exec("echo -n $(%s -version | awk '{print $2}' | sed -n 1P)" % file) return sys.exec(string.format("echo -n $(%s %s)", file, cmd))
sys.call("echo '" .. version .. "' > " .. "/tmp/etc/passwall_tmp/" .. md5)
return version
end end
else
return sys.exec("echo -n $(%s -version | awk '{print $2}' | sed -n 1P)" % file)
end
end
return ""
end end
function get_kcptun_path() function get_kcptun_path()
@ -363,24 +346,13 @@ function get_kcptun_path()
end end
function get_kcptun_version(file) function get_kcptun_version(file)
sys.call("mkdir -p /tmp/etc/passwall_tmp")
if file == nil then file = get_kcptun_path() end if file == nil then file = get_kcptun_path() end
chmod_755(file) local cmd = "-v | awk '{print $3}'"
if fs.access(file) then
if file == get_kcptun_path() then if file == get_kcptun_path() then
local md5 = sys.exec("echo -n $(md5sum " .. file .. " | awk '{print $1}')") return get_bin_version_cache(file, cmd)
if fs.access("/tmp/etc/passwall_tmp/" .. md5) then
return sys.exec("echo -n $(cat /tmp/etc/passwall_tmp/%s)" % md5)
else else
local version = sys.exec("echo -n $(%s -v | awk '{print $3}')" % file) return sys.exec(string.format("echo -n $(%s %s)", file, cmd))
sys.call("echo '" .. version .. "' > " .. "/tmp/etc/passwall_tmp/" .. md5)
return version
end end
else
return sys.exec("echo -n $(%s -v | awk '{print $3}')" % file)
end
end
return ""
end end
function get_brook_path() function get_brook_path()
@ -389,24 +361,13 @@ function get_brook_path()
end end
function get_brook_version(file) function get_brook_version(file)
sys.call("mkdir -p /tmp/etc/passwall_tmp")
if file == nil then file = get_brook_path() end if file == nil then file = get_brook_path() end
chmod_755(file) local cmd = "-v | awk '{print $3}'"
if fs.access(file) then
if file == get_brook_path() then if file == get_brook_path() then
local md5 = sys.exec("echo -n $(md5sum " .. file .. " | awk '{print $1}')") return get_bin_version_cache(file, cmd)
if fs.access("/tmp/etc/passwall_tmp/" .. md5) then
return sys.exec("echo -n $(cat /tmp/etc/passwall_tmp/%s)" % md5)
else else
local version = sys.exec("echo -n $(%s -v | awk '{print $3}')" % file) return sys.exec(string.format("echo -n $(%s %s)", file, cmd))
sys.call("echo '" .. version .. "' > " .. "/tmp/etc/passwall_tmp/" .. md5)
return version
end end
else
return sys.exec("echo -n $(%s -v | awk '{print $3}')" % file)
end
end
return ""
end end
function get_hysteria_path() function get_hysteria_path()
@ -415,24 +376,13 @@ function get_hysteria_path()
end end
function get_hysteria_version(file) function get_hysteria_version(file)
sys.call("mkdir -p /tmp/etc/passwall_tmp")
if file == nil then file = get_hysteria_path() end if file == nil then file = get_hysteria_path() end
chmod_755(file) local cmd = "-v | awk '{print $3}'"
if fs.access(file) then
if file == get_hysteria_path() then if file == get_hysteria_path() then
local md5 = sys.exec("echo -n $(md5sum " .. file .. " | awk '{print $1}')") return get_bin_version_cache(file, cmd)
if fs.access("/tmp/etc/passwall_tmp/" .. md5) then
return sys.exec("echo -n $(cat /tmp/etc/passwall_tmp/%s)" % md5)
else else
local version = sys.exec("echo -n $(%s -v | awk '{print $3}')" % file) return sys.exec(string.format("echo -n $(%s %s)", file, cmd))
sys.call("echo '" .. version .. "' > " .. "/tmp/etc/passwall_tmp/" .. md5)
return version
end end
else
return sys.exec("echo -n $(%s -v | awk '{print $3}')" % file)
end
end
return ""
end end
function get_free_space(dir) function get_free_space(dir)

View File

@ -5,7 +5,9 @@ local sys = api.sys
local util = api.util local util = api.util
local i18n = api.i18n local i18n = api.i18n
local brook_api = "https://api.github.com/repos/txthinking/brook/releases?per_page=1" local pre_release_url = "https://api.github.com/repos/txthinking/brook/releases?per_page=1"
local release_url = "https://api.github.com/repos/txthinking/brook/releases/latest"
local brook_api = release_url
local app_path = api.get_brook_path() or "" local app_path = api.get_brook_path() or ""
function check_path() function check_path()

View File

@ -201,9 +201,14 @@ function gen_outbound(node, tag, proxy_table)
port = tonumber(node.port), port = tonumber(node.port),
method = node.method or nil, method = node.method or nil,
flow = node.flow or nil, flow = node.flow or nil,
ivCheck = (node.iv_check == "1") and true or false,
password = node.password or "", password = node.password or "",
users = (node.username and node.password) and users = (node.username and node.password) and {
{{user = node.username, pass = node.password}} or nil {
user = node.username,
pass = node.password
}
} or nil
} }
} or nil } or nil
} }
@ -272,7 +277,7 @@ if node_section then
protocol = "dokodemo-door", protocol = "dokodemo-door",
settings = {network = proto, followRedirect = true}, settings = {network = proto, followRedirect = true},
streamSettings = {sockopt = {tproxy = proxy_way}}, streamSettings = {sockopt = {tproxy = proxy_way}},
sniffing = {enabled = true, destOverride = {"http", "tls"}} sniffing = {enabled = true, destOverride = {"http", "tls"}, RouteOnly = true}
}) })
end end

View File

@ -5,7 +5,9 @@ local sys = api.sys
local util = api.util local util = api.util
local i18n = api.i18n local i18n = api.i18n
local kcptun_api = "https://api.github.com/repos/xtaci/kcptun/releases?per_page=1" local pre_release_url = "https://api.github.com/repos/xtaci/kcptun/releases?per_page=1"
local release_url = "https://api.github.com/repos/xtaci/kcptun/releases/latest"
local kcptun_api = release_url
local app_path = api.get_kcptun_path() or "" local app_path = api.get_kcptun_path() or ""
function check_path() function check_path()

View File

@ -5,7 +5,9 @@ local sys = api.sys
local util = api.util local util = api.util
local i18n = api.i18n local i18n = api.i18n
local trojan_go_api = "https://api.github.com/repos/p4gefau1t/trojan-go/releases?per_page=1" local pre_release_url = "https://api.github.com/repos/p4gefau1t/trojan-go/releases?per_page=1"
local release_url = "https://api.github.com/repos/p4gefau1t/trojan-go/releases/latest"
local trojan_go_api = release_url
local app_path = api.get_trojan_go_path() or "" local app_path = api.get_trojan_go_path() or ""
function check_path() function check_path()

View File

@ -5,8 +5,9 @@ local sys = api.sys
local util = api.util local util = api.util
local i18n = api.i18n local i18n = api.i18n
local v2ray_api = "https://api.github.com/repos/v2fly/v2ray-core/releases?per_page=1" local pre_release_url = "https://api.github.com/repos/v2fly/v2ray-core/releases?per_page=1"
local is_armv7 = false local release_url = "https://api.github.com/repos/v2fly/v2ray-core/releases/latest"
local v2ray_api = release_url
local app_path = api.get_v2ray_path() or "" local app_path = api.get_v2ray_path() or ""
function check_path() function check_path()

View File

@ -5,8 +5,9 @@ local sys = api.sys
local util = api.util local util = api.util
local i18n = api.i18n local i18n = api.i18n
local xray_api = "https://api.github.com/repos/XTLS/Xray-core/releases?per_page=1" local pre_release_url = "https://api.github.com/repos/XTLS/Xray-core/releases?per_page=1"
local is_armv7 = false local release_url = "https://api.github.com/repos/XTLS/Xray-core/releases/latest"
local xray_api = release_url
local app_path = api.get_xray_path() or "" local app_path = api.get_xray_path() or ""
function check_path() function check_path()

View File

@ -420,6 +420,10 @@ function x_ss_encrypt_method.write(self, section, value)
m:set(section, "method", value) m:set(section, "method", value)
end end
iv_check = s:option(Flag, "iv_check", translate("IV Check"))
iv_check:depends({ type = "V2ray", protocol = "shadowsocks" })
iv_check:depends({ type = "Xray", protocol = "shadowsocks" })
ssr_protocol = s:option(Value, "ssr_protocol", translate("Protocol")) ssr_protocol = s:option(Value, "ssr_protocol", translate("Protocol"))
for a, t in ipairs(ssr_protocol_list) do ssr_protocol:value(t) end for a, t in ipairs(ssr_protocol_list) do ssr_protocol:value(t) end
ssr_protocol:depends("type", "SSR") ssr_protocol:depends("type", "SSR")

View File

@ -49,6 +49,7 @@ function gen_config(user)
settings = { settings = {
method = user.method, method = user.method,
password = user.password, password = user.password,
ivCheck = ("1" == user.iv_check) and true or false,
network = user.ss_network or "TCP,UDP" network = user.ss_network or "TCP,UDP"
} }
elseif user.protocol == "trojan" then elseif user.protocol == "trojan" then

View File

@ -243,6 +243,10 @@ function x_ss_encrypt_method.write(self, section, value)
m:set(section, "method", value) m:set(section, "method", value)
end end
iv_check = s:option(Flag, "iv_check", translate("IV Check"))
iv_check:depends({ type = "V2ray", protocol = "shadowsocks" })
iv_check:depends({ type = "Xray", protocol = "shadowsocks" })
ss_network = s:option(ListValue, "ss_network", translate("Transport")) ss_network = s:option(ListValue, "ss_network", translate("Transport"))
ss_network.default = "tcp,udp" ss_network.default = "tcp,udp"
ss_network:value("tcp", "TCP") ss_network:value("tcp", "TCP")

View File

@ -1033,6 +1033,9 @@ msgstr "HAProxy不能和KCP一起使用"
msgid "Password" msgid "Password"
msgstr "密码" msgstr "密码"
msgid "IV Check"
msgstr "IV 检查"
msgid "Connection Timeout" msgid "Connection Timeout"
msgstr "连接超时时间" msgstr "连接超时时间"
@ -1051,9 +1054,6 @@ msgstr "插件"
msgid "opts" msgid "opts"
msgstr "插件选项" msgstr "插件选项"
msgid "Xray is currently directly compatible with V2ray and used."
msgstr "Xray 目前可直接兼容 V2ray 并使用。"
msgid "Protocol" msgid "Protocol"
msgstr "协议名称" msgstr "协议名称"