update 2024-11-19 14:16:57
This commit is contained in:
parent
0ec972c34d
commit
9f78f70798
|
@ -5,8 +5,8 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall2
|
||||
PKG_VERSION:=24.11.18
|
||||
PKG_RELEASE:=2
|
||||
PKG_VERSION:=24.11.19
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \
|
||||
|
|
|
@ -76,6 +76,7 @@ function index()
|
|||
entry({"admin", "services", appname, "update_rules"}, call("update_rules")).leaf = true
|
||||
|
||||
--[[Components update]]
|
||||
entry({"admin", "services", appname, "check_passwall2"}, call("app_check")).leaf = true
|
||||
local coms = require "luci.passwall2.com"
|
||||
local com
|
||||
for com, _ in pairs(coms) do
|
||||
|
@ -403,6 +404,11 @@ function server_clear_log()
|
|||
luci.sys.call("echo '' > /tmp/log/passwall2_server.log")
|
||||
end
|
||||
|
||||
function app_check()
|
||||
local json = api.to_check_self()
|
||||
http_write_json(json)
|
||||
end
|
||||
|
||||
function com_check(comname)
|
||||
local json = api.to_check("", comname)
|
||||
http_write_json(json)
|
||||
|
|
|
@ -100,6 +100,14 @@ if #hysteria2_type > 0 then
|
|||
end
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node."))
|
||||
o.default = ""
|
||||
o:value("", translate("Auto"))
|
||||
o:value("prefer_ipv4", translate("Prefer IPv4"))
|
||||
o:value("prefer_ipv6", translate("Prefer IPv6"))
|
||||
o:value("ipv4_only", translate("IPv4 Only"))
|
||||
o:value("ipv6_only", translate("IPv6 Only"))
|
||||
|
||||
---- Subscribe Delete All
|
||||
o = s:option(Button, "_stop", translate("Delete All Subscribe Node"))
|
||||
o.inputstyle = "remove"
|
||||
|
|
|
@ -121,6 +121,15 @@ if #hysteria2_type > 0 then
|
|||
end
|
||||
end
|
||||
|
||||
o = s:option(ListValue, "domain_strategy", "Sing-box " .. translate("Domain Strategy"), translate("Set the default domain resolution strategy for the sing-box node."))
|
||||
o.default = "global"
|
||||
o:value("global", translate("Use global config"))
|
||||
o:value("", translate("Auto"))
|
||||
o:value("prefer_ipv4", translate("Prefer IPv4"))
|
||||
o:value("prefer_ipv6", translate("Prefer IPv6"))
|
||||
o:value("ipv4_only", translate("IPv4 Only"))
|
||||
o:value("ipv6_only", translate("IPv6 Only"))
|
||||
|
||||
---- Enable auto update subscribe
|
||||
o = s:option(Flag, "auto_update", translate("Enable auto update subscribe"))
|
||||
o.default = 0
|
||||
|
@ -163,11 +172,11 @@ o:depends("week_update", "8")
|
|||
o.rmempty = true
|
||||
|
||||
o = s:option(Value, "user_agent", translate("User-Agent"))
|
||||
o.default = "sing-box/9.9.9"
|
||||
o:value("curl", "Curl Default")
|
||||
o.default = "v2rayN/9.99"
|
||||
o:value("curl", "Curl")
|
||||
o:value("Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0", "Edge for Linux")
|
||||
o:value("Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36 Edg/122.0.0.0", "Edge for Windows")
|
||||
o:value("Passwall2/OpenWrt", "PassWall2")
|
||||
o:value("sing-box/9.9.9", "Xboard(V2board)")
|
||||
o:value("v2rayN/9.99", "V2rayN")
|
||||
|
||||
return m
|
||||
|
|
|
@ -321,7 +321,7 @@ o = s:option(ListValue, option_name("flow"), translate("flow"))
|
|||
o.default = ""
|
||||
o:value("", translate("Disable"))
|
||||
o:value("xtls-rprx-vision")
|
||||
o:depends({ [option_name("protocol")] = "vless" })
|
||||
o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "raw" })
|
||||
|
||||
o = s:option(Flag, option_name("tls"), translate("TLS"))
|
||||
o.default = 0
|
||||
|
|
|
@ -666,11 +666,23 @@ o = s:option(Value, option_name("plugin_opts"), translate("opts"))
|
|||
o:depends({ [option_name("plugin_enabled")] = true })
|
||||
|
||||
o = s:option(ListValue, option_name("domain_strategy"), translate("Domain Strategy"), translate("If is domain name, The requested domain name will be resolved to IP before connect."))
|
||||
o.default = "prefer_ipv6"
|
||||
o:value("prefer_ipv4")
|
||||
o:value("prefer_ipv6")
|
||||
o:value("ipv4_only")
|
||||
o:value("ipv6_only")
|
||||
o.default = ""
|
||||
o:value("", translate("Auto"))
|
||||
o:value("prefer_ipv4", translate("Prefer IPv4"))
|
||||
o:value("prefer_ipv6", translate("Prefer IPv6"))
|
||||
o:value("ipv4_only", translate("IPv4 Only"))
|
||||
o:value("ipv6_only", translate("IPv6 Only"))
|
||||
o:depends({ [option_name("protocol")] = "socks" })
|
||||
o:depends({ [option_name("protocol")] = "http" })
|
||||
o:depends({ [option_name("protocol")] = "shadowsocks" })
|
||||
o:depends({ [option_name("protocol")] = "shadowsocksr" })
|
||||
o:depends({ [option_name("protocol")] = "vmess" })
|
||||
o:depends({ [option_name("protocol")] = "trojan" })
|
||||
o:depends({ [option_name("protocol")] = "wireguard" })
|
||||
o:depends({ [option_name("protocol")] = "hysteria" })
|
||||
o:depends({ [option_name("protocol")] = "vless" })
|
||||
o:depends({ [option_name("protocol")] = "tuic" })
|
||||
o:depends({ [option_name("protocol")] = "hysteria2" })
|
||||
|
||||
o = s:option(ListValue, option_name("to_node"), translate("Landing node"), translate("Only support a layer of proxy."))
|
||||
o.default = ""
|
||||
|
|
|
@ -109,7 +109,7 @@ o = s:option(ListValue, option_name("flow"), translate("flow"))
|
|||
o.default = ""
|
||||
o:value("", translate("Disable"))
|
||||
o:value("xtls-rprx-vision")
|
||||
o:depends({ [option_name("protocol")] = "vless" })
|
||||
o:depends({ [option_name("protocol")] = "vless", [option_name("tls")] = true, [option_name("transport")] = "raw" })
|
||||
|
||||
o = s:option(Flag, option_name("tls"), translate("TLS"))
|
||||
o.default = 0
|
||||
|
@ -197,7 +197,7 @@ o.validate = function(self, value, t)
|
|||
end
|
||||
|
||||
o = s:option(ListValue, option_name("transport"), translate("Transport"))
|
||||
o:value("tcp", "TCP")
|
||||
o:value("raw", "RAW")
|
||||
o:value("mkcp", "mKCP")
|
||||
o:value("ws", "WebSocket")
|
||||
o:value("h2", "HTTP/2")
|
||||
|
@ -205,7 +205,7 @@ o:value("ds", "DomainSocket")
|
|||
o:value("quic", "QUIC")
|
||||
o:value("grpc", "gRPC")
|
||||
o:value("httpupgrade", "HttpUpgrade")
|
||||
o:value("splithttp", "SplitHTTP")
|
||||
o:value("xhttp", "XHTTP")
|
||||
o:depends({ [option_name("protocol")] = "vmess" })
|
||||
o:depends({ [option_name("protocol")] = "vless" })
|
||||
o:depends({ [option_name("protocol")] = "socks" })
|
||||
|
@ -235,12 +235,20 @@ o = s:option(Value, option_name("h2_path"), translate("HTTP/2 Path"))
|
|||
o:depends({ [option_name("transport")] = "h2" })
|
||||
|
||||
-- [[ SplitHTTP部分 ]]--
|
||||
o = s:option(Value, option_name("splithttp_host"), translate("SplitHTTP Host"))
|
||||
o:depends({ [option_name("transport")] = "splithttp" })
|
||||
o = s:option(Value, option_name("xhttp_host"), translate("XHTTP Host"))
|
||||
o:depends({ [option_name("transport")] = "xhttp" })
|
||||
|
||||
o = s:option(Value, option_name("splithttp_path"), translate("SplitHTTP Path"))
|
||||
o = s:option(Value, option_name("xhttp_path"), translate("XHTTP Path"))
|
||||
o.placeholder = "/"
|
||||
o:depends({ [option_name("transport")] = "splithttp" })
|
||||
o:depends({ [option_name("transport")] = "xhttp" })
|
||||
|
||||
o = s:option(Value, option_name("xhttp_maxuploadsize"), translate("maxUploadSize"))
|
||||
o.default = "1000000"
|
||||
o:depends({ [option_name("transport")] = "xhttp" })
|
||||
|
||||
o = s:option(Value, option_name("xhttp_maxconcurrentuploads"), translate("maxConcurrentUploads"))
|
||||
o.default = "10"
|
||||
o:depends({ [option_name("transport")] = "xhttp" })
|
||||
|
||||
o = s:option(Value, option_name("splithttp_maxuploadsize"), translate("maxUploadSize"))
|
||||
o.default = "1000000"
|
||||
|
@ -256,7 +264,7 @@ o:depends({ [option_name("transport")] = "splithttp" })
|
|||
o = s:option(ListValue, option_name("tcp_guise"), translate("Camouflage Type"))
|
||||
o:value("none", "none")
|
||||
o:value("http", "http")
|
||||
o:depends({ [option_name("transport")] = "tcp" })
|
||||
o:depends({ [option_name("transport")] = "raw" })
|
||||
|
||||
-- HTTP域名
|
||||
o = s:option(DynamicList, option_name("tcp_guise_http_host"), translate("HTTP Host"))
|
||||
|
@ -328,8 +336,8 @@ o.default = "0"
|
|||
|
||||
-- [[ Fallback部分 ]]--
|
||||
o = s:option(Flag, option_name("fallback"), translate("Fallback"))
|
||||
o:depends({ [option_name("protocol")] = "vless", [option_name("transport")] = "tcp" })
|
||||
o:depends({ [option_name("protocol")] = "trojan", [option_name("transport")] = "tcp" })
|
||||
o:depends({ [option_name("protocol")] = "vless", [option_name("transport")] = "raw" })
|
||||
o:depends({ [option_name("protocol")] = "trojan", [option_name("transport")] = "raw" })
|
||||
|
||||
--[[
|
||||
o = s:option(Value, option_name("fallback_alpn"), "Fallback alpn")
|
||||
|
|
|
@ -964,6 +964,47 @@ function to_move(app_name,file)
|
|||
return {code = 0}
|
||||
end
|
||||
|
||||
function get_version()
|
||||
local version = sys.exec("opkg list-installed luci-app-passwall2 2>/dev/null | awk '{print $3}'")
|
||||
if not version or #version == 0 then
|
||||
version = sys.exec("apk info luci-app-passwall2 2>/dev/null | awk 'NR == 1 {print $1}' | cut -d'-' -f4-")
|
||||
end
|
||||
return version or ""
|
||||
end
|
||||
|
||||
function to_check_self()
|
||||
local url = "https://raw.githubusercontent.com/xiaorouji/openwrt-passwall2/main/luci-app-passwall2/Makefile"
|
||||
local tmp_file = "/tmp/passwall2_makefile"
|
||||
local return_code, result = curl_logic(url, tmp_file, curl_args)
|
||||
result = return_code == 0
|
||||
if not result then
|
||||
exec("/bin/rm", {"-f", tmp_file})
|
||||
return {
|
||||
code = 1,
|
||||
error = i18n.translatef("Failed")
|
||||
}
|
||||
end
|
||||
local local_version = get_version()
|
||||
local remote_version = sys.exec("echo -n $(grep 'PKG_VERSION' /tmp/passwall2_makefile|awk -F '=' '{print $2}')")
|
||||
.. "-" .. sys.exec("echo -n $(grep 'PKG_RELEASE' /tmp/passwall2_makefile|awk -F '=' '{print $2}')")
|
||||
|
||||
local has_update = compare_versions(local_version, "<", remote_version)
|
||||
if not has_update then
|
||||
return {
|
||||
code = 0,
|
||||
local_version = local_version,
|
||||
remote_version = remote_version
|
||||
}
|
||||
end
|
||||
return {
|
||||
code = 1,
|
||||
has_update = true,
|
||||
local_version = local_version,
|
||||
remote_version = remote_version,
|
||||
error = i18n.translatef("The latest version: %s, currently does not support automatic update, if you need to update, please compile or download the ipk and then manually install.", remote_version)
|
||||
}
|
||||
end
|
||||
|
||||
function cacheFileCompareToLogic(file, str)
|
||||
local result = nil
|
||||
if file and str then
|
||||
|
|
|
@ -264,7 +264,7 @@ function gen_outbound(flag, node, tag, proxy_table)
|
|||
level = 0,
|
||||
security = (node.protocol == "vmess") and node.security or nil,
|
||||
encryption = node.encryption or "none",
|
||||
flow = (node.protocol == "vless" and node.tls == '1' and node.flow) and node.flow or nil
|
||||
flow = (node.protocol == "vless" and node.tls == "1" and node.transport == "raw" and node.flow and node.flow ~= "") and node.flow or nil
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -367,7 +367,7 @@ function gen_config_server(node)
|
|||
for i = 1, #node.uuid do
|
||||
clients[i] = {
|
||||
id = node.uuid[i],
|
||||
flow = ("vless" == node.protocol and "1" == node.tls and node.flow) and node.flow or nil
|
||||
flow = ("vless" == node.protocol and "1" == node.tls and "raw" == node.transport and node.flow and node.flow ~= "") and node.flow or nil
|
||||
}
|
||||
end
|
||||
settings = {
|
||||
|
@ -561,11 +561,11 @@ function gen_config_server(node)
|
|||
path = node.httpupgrade_path or "/",
|
||||
host = node.httpupgrade_host
|
||||
} or nil,
|
||||
splithttpSettings = (node.transport == "splithttp") and {
|
||||
path = node.splithttp_path or "/",
|
||||
host = node.splithttp_host,
|
||||
maxUploadSize = node.splithttp_maxuploadsize,
|
||||
maxConcurrentUploads = node.splithttp_maxconcurrentuploads
|
||||
xhttpSettings = (node.transport == "xhttp") and {
|
||||
path = node.xhttp_path or "/",
|
||||
host = node.xhttp_host,
|
||||
maxUploadSize = node.xhttp_maxuploadsize,
|
||||
maxConcurrentUploads = node.xhttp_maxconcurrentuploads
|
||||
} or nil,
|
||||
sockopt = {
|
||||
acceptProxyProtocol = (node.acceptProxyProtocol and node.acceptProxyProtocol == "1") and true or false
|
||||
|
|
|
@ -177,6 +177,18 @@ local version = {}
|
|||
//]]>
|
||||
</script>
|
||||
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title">Passwall2 <%:Version%></label>
|
||||
<div class="cbi-value-field">
|
||||
<div class="cbi-value-description">
|
||||
<span>【 <%=api.get_version()%> 】</span>
|
||||
<input class="btn cbi-button cbi-button-apply" type="button" id="passwall2-check_btn"
|
||||
onclick="onBtnClick(this,'passwall2');" value="<%:Check update%>" />
|
||||
<span id="passwall2-check_btn-detail"></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%for k, v in pairs(com) do
|
||||
version[k] = api.get_app_version(k)%>
|
||||
<div class="cbi-value">
|
||||
|
|
|
@ -210,7 +210,7 @@ local api = require "luci.passwall2.api"
|
|||
v_transport = "http";
|
||||
params += opt.query("host", dom_prefix + "h2_host");
|
||||
params += opt.query("path", dom_prefix + "h2_path");
|
||||
} else if (v_transport === "tcp") {
|
||||
} else if (v_transport === "raw" || v_transport === "tcp") {
|
||||
params += opt.query("headerType", dom_prefix + "tcp_guise");
|
||||
params += opt.query("host", dom_prefix + "tcp_guise_http_host");
|
||||
params += opt.query("path", dom_prefix + "tcp_guise_http_path");
|
||||
|
@ -300,7 +300,7 @@ local api = require "luci.passwall2.api"
|
|||
} else if (v_transport === "h2") {
|
||||
info.host = opt.get(dom_prefix + "h2_host").value;
|
||||
info.path = opt.get(dom_prefix + "h2_path").value;
|
||||
} else if (v_transport === "tcp") {
|
||||
} else if (v_transport === "raw" || v_transport === "tcp") {
|
||||
info.type = opt.get(dom_prefix + "tcp_guise").value;
|
||||
if (info.type === "http") {
|
||||
info.host = opt.get(dom_prefix + "tcp_guise_http_host").value;
|
||||
|
@ -349,7 +349,7 @@ local api = require "luci.passwall2.api"
|
|||
v_transport = "http";
|
||||
params += opt.query("host", dom_prefix + "h2_host");
|
||||
params += opt.query("path", dom_prefix + "h2_path");
|
||||
} else if (v_transport === "tcp") {
|
||||
} else if (v_transport === "raw" || v_transport === "tcp") {
|
||||
params += opt.query("headerType", dom_prefix + "tcp_guise");
|
||||
params += opt.query("host", dom_prefix + "tcp_guise_http_host");
|
||||
params += opt.query("path", dom_prefix + "tcp_guise_http_path");
|
||||
|
@ -364,12 +364,7 @@ local api = require "luci.passwall2.api"
|
|||
params += opt.query("path", dom_prefix + "grpc_serviceName");
|
||||
params += opt.query("serviceName", dom_prefix + "grpc_serviceName");
|
||||
params += opt.query("mode", dom_prefix + "grpc_mode");
|
||||
} else if (v_transport === "splithttp") {
|
||||
v_transport = "splithttp";
|
||||
params += opt.query("host", dom_prefix + "splithttp_host");
|
||||
params += opt.query("path", dom_prefix + "splithttp_path");
|
||||
} else if (v_transport === "xhttp") {
|
||||
v_transport = "xhttp";
|
||||
params += opt.query("host", dom_prefix + "xhttp_host");
|
||||
params += opt.query("path", dom_prefix + "xhttp_path");
|
||||
}
|
||||
|
@ -423,7 +418,7 @@ local api = require "luci.passwall2.api"
|
|||
v_transport = "http";
|
||||
params += opt.query("host", dom_prefix + "h2_host");
|
||||
params += opt.query("path", dom_prefix + "h2_path");
|
||||
} else if (v_transport === "tcp") {
|
||||
} else if (v_transport === "raw" || v_transport === "tcp") {
|
||||
params += opt.query("headerType", dom_prefix + "tcp_guise");
|
||||
params += opt.query("host", dom_prefix + "tcp_guise_http_host");
|
||||
params += opt.query("path", dom_prefix + "tcp_guise_http_path");
|
||||
|
@ -800,7 +795,7 @@ local api = require "luci.passwall2.api"
|
|||
if (queryParam.type === "h2" || queryParam.type === "http")
|
||||
queryParam.type = "h2"
|
||||
opt.set(dom_prefix + 'transport', queryParam.type);
|
||||
if (queryParam.type === "tcp") {
|
||||
if (queryParam.type === "raw" || queryParam.type === "tcp") {
|
||||
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
|
||||
if (queryParam.headerType && queryParam.headerType != "none") {
|
||||
opt.set(dom_prefix + 'tcp_guise_http_host', queryParam.host || "");
|
||||
|
@ -909,7 +904,7 @@ local api = require "luci.passwall2.api"
|
|||
if (queryParam.type === "h2" || queryParam.type === "http")
|
||||
queryParam.type = "h2"
|
||||
opt.set(dom_prefix + 'transport', queryParam.type);
|
||||
if (queryParam.type === "tcp") {
|
||||
if (queryParam.type === "raw" || queryParam.type === "tcp") {
|
||||
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
|
||||
if (queryParam.headerType && queryParam.headerType != "none") {
|
||||
opt.set(dom_prefix + 'tcp_guise_http_host', queryParam.host || "");
|
||||
|
@ -989,7 +984,7 @@ local api = require "luci.passwall2.api"
|
|||
if (ssm.net === "kcp" || ssm.net === "mkcp")
|
||||
ssm.net = "mkcp"
|
||||
opt.set(dom_prefix + 'transport', ssm.net);
|
||||
if (ssm.net === "tcp") {
|
||||
if (ssm.net === "raw") {
|
||||
opt.set(dom_prefix + 'tcp_guise', (ssm.host && ssm.path) ? "http" : "none");
|
||||
if (ssm.host && ssm.path) {
|
||||
opt.set(dom_prefix + 'tcp_guise_http_host', ssm.host);
|
||||
|
@ -1097,7 +1092,7 @@ local api = require "luci.passwall2.api"
|
|||
if (queryParam.type === "h2" || queryParam.type === "http")
|
||||
queryParam.type = "h2"
|
||||
opt.set(dom_prefix + 'transport', queryParam.type);
|
||||
if (queryParam.type === "tcp") {
|
||||
if (queryParam.type === "raw" || queryParam.type === "tcp") {
|
||||
opt.set(dom_prefix + 'tcp_guise', queryParam.headerType || "none");
|
||||
if (queryParam.headerType && queryParam.headerType != "none") {
|
||||
opt.set(dom_prefix + 'tcp_guise_http_host', queryParam.host || "");
|
||||
|
@ -1136,10 +1131,7 @@ local api = require "luci.passwall2.api"
|
|||
} else if (queryParam.type === "grpc") {
|
||||
opt.set(dom_prefix + 'grpc_serviceName', (queryParam.serviceName || queryParam.path) || "");
|
||||
opt.set(dom_prefix + 'grpc_mode', queryParam.mode);
|
||||
} else if (queryParam.type === "splithttp") {
|
||||
opt.set(dom_prefix + 'splithttp_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'splithttp_path', queryParam.path || "");
|
||||
} else if (queryParam.type === "xhttp") {
|
||||
} else if (queryParam.type === "xhttp" || queryParam.type === "splithttp") {
|
||||
opt.set(dom_prefix + 'xhttp_host', queryParam.host || "");
|
||||
opt.set(dom_prefix + 'xhttp_path', queryParam.path || "");
|
||||
}
|
||||
|
|
|
@ -760,6 +760,9 @@ msgstr "检查更新"
|
|||
msgid "Force update"
|
||||
msgstr "强制更新"
|
||||
|
||||
msgid "The latest version: %s, currently does not support automatic update, if you need to update, please compile or download the ipk and then manually install."
|
||||
msgstr "最新版本:%s,目前暂不支持自动更新,如需更新,请自行编译或下载ipk然后手动安装。"
|
||||
|
||||
msgid "Enable custom URL"
|
||||
msgstr "启用自定义规则地址"
|
||||
|
||||
|
@ -1566,3 +1569,18 @@ msgstr "落地节点"
|
|||
|
||||
msgid "Only support a layer of proxy."
|
||||
msgstr "仅支持一层代理。"
|
||||
|
||||
msgid "Set the default domain resolution strategy for the sing-box node."
|
||||
msgstr "为 sing-box 节点设置默认的域名解析策略。"
|
||||
|
||||
msgid "Prefer IPv4"
|
||||
msgstr "IPv4 优先"
|
||||
|
||||
msgid "Prefer IPv6"
|
||||
msgstr "IPv6 优先"
|
||||
|
||||
msgid "IPv4 Only"
|
||||
msgstr "仅 IPv4"
|
||||
|
||||
msgid "IPv6 Only"
|
||||
msgstr "仅 IPv6"
|
||||
|
|
|
@ -33,6 +33,8 @@ local trojan_type_default = uci:get(appname, "@global_subscribe[0]", "trojan_typ
|
|||
local vmess_type_default = uci:get(appname, "@global_subscribe[0]", "vmess_type") or "xray"
|
||||
local vless_type_default = uci:get(appname, "@global_subscribe[0]", "vless_type") or "xray"
|
||||
local hysteria2_type_default = uci:get(appname, "@global_subscribe[0]", "hysteria2_type") or "hysteria2"
|
||||
local domain_strategy_default = uci:get(appname, "@global_subscribe[0]", "domain_strategy") or ""
|
||||
local domain_strategy_node = ""
|
||||
-- 判断是否过滤节点关键字
|
||||
local filter_keyword_mode_default = uci:get(appname, "@global_subscribe[0]", "filter_keyword_mode") or "0"
|
||||
local filter_keyword_discard_list_default = uci:get(appname, "@global_subscribe[0]", "filter_discard_list") or {}
|
||||
|
@ -454,7 +456,7 @@ local function processData(szType, content, add_mode, add_from)
|
|||
result.h2_host = info.host
|
||||
result.h2_path = info.path
|
||||
end
|
||||
if info.net == 'tcp' then
|
||||
if info.net == 'raw' or info.net == 'tcp' then
|
||||
if info.type and info.type ~= "http" then
|
||||
info.type = "none"
|
||||
end
|
||||
|
@ -480,9 +482,9 @@ local function processData(szType, content, add_mode, add_from)
|
|||
if info.net == 'grpc' then
|
||||
result.grpc_serviceName = info.path
|
||||
end
|
||||
if info.net == 'splithttp' then
|
||||
result.splithttp_host = info.host
|
||||
result.splithttp_path = info.path
|
||||
if info.net == 'xhttp' or info.net == 'splithttp' then
|
||||
result.xhttp_host = info.host
|
||||
result.xhttp_path = info.path
|
||||
end
|
||||
if not info.security then result.security = "auto" end
|
||||
if info.tls == "tls" or info.tls == "1" then
|
||||
|
@ -493,7 +495,7 @@ local function processData(szType, content, add_mode, add_from)
|
|||
result.tls = "0"
|
||||
end
|
||||
|
||||
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "splithttp") then
|
||||
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
|
||||
log("跳过节点:" .. result.remarks ..",因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式,需更换Xray。")
|
||||
return nil
|
||||
end
|
||||
|
@ -653,7 +655,7 @@ local function processData(szType, content, add_mode, add_from)
|
|||
result.h2_path = params.path
|
||||
end
|
||||
end
|
||||
if params.type == 'tcp' then
|
||||
if params.type == 'raw' or params.type == 'tcp' then
|
||||
result.tcp_guise = params.headerType or "none"
|
||||
result.tcp_guise_http_host = params.host
|
||||
result.tcp_guise_http_path = params.path
|
||||
|
@ -800,7 +802,7 @@ local function processData(szType, content, add_mode, add_from)
|
|||
result.h2_path = params.path
|
||||
end
|
||||
end
|
||||
if params.type == 'tcp' then
|
||||
if params.type == 'raw' or params.type == 'tcp' then
|
||||
result.tcp_guise = params.headerType or "none"
|
||||
result.tcp_guise_http_host = params.host
|
||||
result.tcp_guise_http_path = params.path
|
||||
|
@ -826,16 +828,16 @@ local function processData(szType, content, add_mode, add_from)
|
|||
if params.serviceName then result.grpc_serviceName = params.serviceName end
|
||||
result.grpc_mode = params.mode
|
||||
end
|
||||
if params.type == 'splithttp' then
|
||||
result.splithttp_host = params.host
|
||||
result.splithttp_path = params.path
|
||||
if info.net == 'xhttp' or info.net == 'splithttp' then
|
||||
result.xhttp_host = params.host
|
||||
result.xhttp_path = params.path
|
||||
end
|
||||
|
||||
result.encryption = params.encryption or "none"
|
||||
|
||||
result.flow = params.flow or nil
|
||||
|
||||
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "splithttp") then
|
||||
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
|
||||
log("跳过节点:" .. result.remarks ..",因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式,需更换Xray。")
|
||||
return nil
|
||||
end
|
||||
|
@ -932,7 +934,7 @@ local function processData(szType, content, add_mode, add_from)
|
|||
result.h2_path = params.path
|
||||
end
|
||||
end
|
||||
if params.type == 'tcp' then
|
||||
if params.type == 'raw' or params.type == 'tcp' then
|
||||
result.tcp_guise = params.headerType or "none"
|
||||
result.tcp_guise_http_host = params.host
|
||||
result.tcp_guise_http_path = params.path
|
||||
|
@ -957,9 +959,9 @@ local function processData(szType, content, add_mode, add_from)
|
|||
if params.serviceName then result.grpc_serviceName = params.serviceName end
|
||||
result.grpc_mode = params.mode
|
||||
end
|
||||
if params.type == 'splithttp' then
|
||||
result.splithttp_host = params.host
|
||||
result.splithttp_path = params.path
|
||||
if info.net == 'xhttp' or info.net == 'splithttp' then
|
||||
result.xhttp_host = params.host
|
||||
result.xhttp_path = params.path
|
||||
end
|
||||
|
||||
result.encryption = params.encryption or "none"
|
||||
|
@ -983,7 +985,7 @@ local function processData(szType, content, add_mode, add_from)
|
|||
result.port = port
|
||||
result.tls_allowInsecure = allowInsecure_default and "1" or "0"
|
||||
|
||||
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "splithttp") then
|
||||
if result.type == "sing-box" and (result.transport == "mkcp" or result.transport == "xhttp" or result.transport == "raw" or result.transport == "splithttp") then
|
||||
log("跳过节点:" .. result.remarks ..",因Sing-Box不支持" .. szType .. "协议的" .. result.transport .. "传输方式,需更换Xray。")
|
||||
return nil
|
||||
end
|
||||
|
@ -1351,6 +1353,10 @@ local function update_node(manual)
|
|||
local cfgid = uci:section(appname, "nodes", api.gen_short_uuid())
|
||||
for kkk, vvv in pairs(vv) do
|
||||
uci:set(appname, cfgid, kkk, vvv)
|
||||
-- sing-box 域名解析策略
|
||||
if kkk == "type" and vvv == "sing-box" then
|
||||
uci:set(appname, cfgid, "domain_strategy", domain_strategy_node)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1544,6 +1550,12 @@ local execute = function()
|
|||
if hysteria2_type ~= "global" then
|
||||
hysteria2_type_default = hysteria2_type
|
||||
end
|
||||
local domain_strategy = value.domain_strategy or "global"
|
||||
if domain_strategy ~= "global" then
|
||||
domain_strategy_node = domain_strategy
|
||||
else
|
||||
domain_strategy_node = domain_strategy_default
|
||||
end
|
||||
local ua = value.user_agent
|
||||
log('正在订阅:【' .. remark .. '】' .. url)
|
||||
local raw = curl(url, "/tmp/" .. cfgid, ua)
|
||||
|
|
|
@ -10,15 +10,40 @@ local icount = 0
|
|||
local args = arg[1]
|
||||
local uci = luci.model.uci.cursor()
|
||||
|
||||
-- 以下设置更新数据库至 DNSMASQ 路径
|
||||
-- 获取 DEFAULT_DNSMASQ_CFGID
|
||||
-- 以下设置更新数据库至 DNSMASQ 配置路径
|
||||
-- 获取 DNSMasq 配置 ID
|
||||
local DEFAULT_DNSMASQ_CFGID = uci:get_first("dhcp", "dnsmasq", ".name")
|
||||
|
||||
if not DEFAULT_DNSMASQ_CFGID then
|
||||
error("未找到默认的 DNSMasq 配置 ID")
|
||||
end
|
||||
|
||||
-- 查找包含 conf-dir 选项的 dnsmasq.conf 文件路径
|
||||
local DNSMASQ_CONF_PATH = string.format("grep -l '^conf-dir=' /tmp/etc/dnsmasq.conf.%s*", DEFAULT_DNSMASQ_CFGID):gsub("%s+", "") -- 去除空白字符
|
||||
-- 获取 DNSMASQ_CONF_DIR
|
||||
local DNSMASQ_CONF_DIR = string.format("grep '^conf-dir=' %s | cut -d'=' -f2 | head -n 1", DNSMASQ_CONF_PATH):gsub("%s+", "") -- 去除空白字符
|
||||
-- 设置 TMP_DNSMASQ_PATH 路径
|
||||
local TMP_DNSMASQ_PATH = DNSMASQ_CONF_DIR .. "/dnsmasq-ssrplus.d"
|
||||
local DNSMASQ_CONF_PATH_CMD = string.format("grep -l '^conf-dir=' /tmp/etc/dnsmasq.conf.%s*", DEFAULT_DNSMASQ_CFGID)
|
||||
local DNSMASQ_CONF_PATH = io.popen(DNSMASQ_CONF_PATH_CMD):read("*l")
|
||||
|
||||
if not DNSMASQ_CONF_PATH or DNSMASQ_CONF_PATH:match("^%s*$") then
|
||||
error("无法找到包含 conf-dir 选项的 dnsmasq.conf 文件路径")
|
||||
end
|
||||
|
||||
DNSMASQ_CONF_PATH = DNSMASQ_CONF_PATH:gsub("%s+", "") -- 去除空白字符
|
||||
|
||||
-- 获取 DNSMASQ 配置路径
|
||||
local DNSMASQ_CONF_DIR_CMD = string.format("grep '^conf-dir=' %s | cut -d'=' -f2 | head -n 1", DNSMASQ_CONF_PATH)
|
||||
local DNSMASQ_CONF_DIR = io.popen(DNSMASQ_CONF_DIR_CMD):read("*l")
|
||||
|
||||
if not DNSMASQ_CONF_DIR or DNSMASQ_CONF_DIR:match("^%s*$") then
|
||||
error("无法提取 conf-dir 配置,请检查 dnsmasq.conf 文件内容")
|
||||
end
|
||||
|
||||
DNSMASQ_CONF_DIR = DNSMASQ_CONF_DIR:gsub("%s+", "") -- 去除空白字符
|
||||
|
||||
-- 设置 dnsmasq-ssrplus.d 目录路径,并去除路径末尾的斜杠
|
||||
local TMP_DNSMASQ_PATH = DNSMASQ_CONF_DIR:match("^(.-)/?$") .. "/dnsmasq-ssrplus.d"
|
||||
|
||||
if not TMP_DNSMASQ_PATH or TMP_DNSMASQ_PATH:match("^%s*$") then
|
||||
error("无法找到包含 dnsmasq 选项的 dnsmasq-ssrplus.d 目录路径")
|
||||
end
|
||||
|
||||
local TMP_PATH = "/var/etc/ssrplus"
|
||||
-- match comments/title/whitelist/ip address/excluded_domain
|
||||
|
|
Loading…
Reference in New Issue