luci-app-passwall2: sync upstream

last commit: 5d195582d1
This commit is contained in:
gitea-action 2024-11-14 00:00:26 +08:00
parent 89c0471561
commit 87ad4c435c
8 changed files with 56 additions and 16 deletions

View File

@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-passwall2 PKG_NAME:=luci-app-passwall2
PKG_VERSION:=1.31-1 PKG_VERSION:=24.11.13
PKG_RELEASE:= PKG_RELEASE:=1
PKG_CONFIG_DEPENDS:= \ PKG_CONFIG_DEPENDS:= \
CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \ CONFIG_PACKAGE_$(PKG_NAME)_Iptables_Transparent_Proxy \

View File

@ -408,9 +408,19 @@ if singbox_tags:find("with_ech") then
o:depends({ [option_name("protocol")] = "hysteria" }) o:depends({ [option_name("protocol")] = "hysteria" })
o:depends({ [option_name("protocol")] = "hysteria2" }) o:depends({ [option_name("protocol")] = "hysteria2" })
o = s:option(Value, option_name("ech_config"), translate("ECH Config")) o = s:option(TextValue, option_name("ech_config"), translate("ECH Config"))
o.default = "" o.default = ""
o.rows = 5
o.wrap = "off"
o:depends({ [option_name("ech")] = true }) o:depends({ [option_name("ech")] = true })
o.validate = function(self, value)
value = value:gsub("^%s+", ""):gsub("%s+$","\n"):gsub("\r\n","\n"):gsub("[ \t]*\n[ \t]*", "\n")
value = value:gsub("^%s*\n", "")
if value:sub(-1) == "\n" then
value = value:sub(1, -2)
end
return value
end
o = s:option(Flag, option_name("pq_signature_schemes_enabled"), translate("PQ signature schemes")) o = s:option(Flag, option_name("pq_signature_schemes_enabled"), translate("PQ signature schemes"))
o.default = "0" o.default = "0"

View File

@ -291,9 +291,19 @@ if singbox_tags:find("with_ech") then
o:depends({ [option_name("protocol")] = "tuic" }) o:depends({ [option_name("protocol")] = "tuic" })
o:depends({ [option_name("protocol")] = "hysteria2" }) o:depends({ [option_name("protocol")] = "hysteria2" })
o = s:option(Value, option_name("ech_key"), translate("ECH Key")) o = s:option(TextValue, option_name("ech_key"), translate("ECH Key"))
o.default = "" o.default = ""
o.rows = 5
o.wrap = "off"
o:depends({ [option_name("ech")] = true }) o:depends({ [option_name("ech")] = true })
o.validate = function(self, value)
value = value:gsub("^%s+", ""):gsub("%s+$","\n"):gsub("\r\n","\n"):gsub("[ \t]*\n[ \t]*", "\n")
value = value:gsub("^%s*\n", "")
if value:sub(-1) == "\n" then
value = value:sub(1, -2)
end
return value
end
o = s:option(Flag, option_name("pq_signature_schemes_enabled"), translate("PQ signature schemes")) o = s:option(Flag, option_name("pq_signature_schemes_enabled"), translate("PQ signature schemes"))
o.default = "0" o.default = "0"

View File

@ -694,8 +694,11 @@ local default_file_tree = {
x86_64 = "amd64", x86_64 = "amd64",
x86 = "386", x86 = "386",
aarch64 = "arm64", aarch64 = "arm64",
rockchip = "arm64",
mips = "mips", mips = "mips",
mipsel = "mipsle", mips64 = "mips64",
mipsel = "mipsel",
mips64el = "mips64el",
armv5 = "arm.*5", armv5 = "arm.*5",
armv6 = "arm.*6[^4]*", armv6 = "arm.*6[^4]*",
armv7 = "arm.*7", armv7 = "arm.*7",

View File

@ -33,7 +33,8 @@ _M.singbox = {
default_path = "/usr/bin/sing-box", default_path = "/usr/bin/sing-box",
match_fmt_str = "linux%%-%s", match_fmt_str = "linux%%-%s",
file_tree = { file_tree = {
x86_64 = "amd64" x86_64 = "amd64",
mips64el = "mips64le"
} }
} }
@ -49,7 +50,8 @@ _M.xray = {
x86_64 = "64", x86_64 = "64",
x86 = "32", x86 = "32",
mips = "mips32", mips = "mips32",
mipsel = "mips32le" mipsel = "mips32le",
mips64el = "mips64le"
} }
} }

View File

@ -6,6 +6,7 @@ local jsonc = api.jsonc
local appname = api.appname local appname = api.appname
local fs = api.fs local fs = api.fs
local CACHE_PATH = api.CACHE_PATH local CACHE_PATH = api.CACHE_PATH
local split = api.split
local new_port local new_port
@ -97,7 +98,7 @@ function gen_outbound(flag, node, tag, proxy_table)
--max_version = "1.3", --max_version = "1.3",
ech = { ech = {
enabled = (node.ech == "1") and true or false, enabled = (node.ech == "1") and true or false,
config = (node.ech_config and node.ech_config:gsub("\\n","\n")) and node.ech_config:gsub("\\n","\n") or nil, config = node.ech_config and split(node.ech_config:gsub("\\n", "\n"), "\n") or {},
pq_signature_schemes_enabled = node.pq_signature_schemes_enabled and true or false, pq_signature_schemes_enabled = node.pq_signature_schemes_enabled and true or false,
dynamic_record_sizing_disabled = node.dynamic_record_sizing_disabled and true or false dynamic_record_sizing_disabled = node.dynamic_record_sizing_disabled and true or false
}, },
@ -307,7 +308,7 @@ function gen_outbound(flag, node, tag, proxy_table)
} or nil, } or nil,
ech = { ech = {
enabled = (node.ech == "1") and true or false, enabled = (node.ech == "1") and true or false,
config = (node.ech_config and node.ech_config:gsub("\\n","\n")) and node.ech_config:gsub("\\n","\n") or nil, config = node.ech_config and split(node.ech_config:gsub("\\n", "\n"), "\n") or {},
pq_signature_schemes_enabled = node.pq_signature_schemes_enabled and true or false, pq_signature_schemes_enabled = node.pq_signature_schemes_enabled and true or false,
dynamic_record_sizing_disabled = node.dynamic_record_sizing_disabled and true or false dynamic_record_sizing_disabled = node.dynamic_record_sizing_disabled and true or false
} }
@ -341,7 +342,7 @@ function gen_outbound(flag, node, tag, proxy_table)
} or nil, } or nil,
ech = { ech = {
enabled = (node.ech == "1") and true or false, enabled = (node.ech == "1") and true or false,
config = (node.ech_config and node.ech_config:gsub("\\n","\n")) and node.ech_config:gsub("\\n","\n") or nil, config = node.ech_config and split(node.ech_config:gsub("\\n", "\n"), "\n") or {},
pq_signature_schemes_enabled = node.pq_signature_schemes_enabled and true or false, pq_signature_schemes_enabled = node.pq_signature_schemes_enabled and true or false,
dynamic_record_sizing_disabled = node.dynamic_record_sizing_disabled and true or false dynamic_record_sizing_disabled = node.dynamic_record_sizing_disabled and true or false
} }
@ -364,7 +365,7 @@ function gen_outbound(flag, node, tag, proxy_table)
insecure = (node.tls_allowInsecure == "1") and true or false, insecure = (node.tls_allowInsecure == "1") and true or false,
ech = { ech = {
enabled = (node.ech == "1") and true or false, enabled = (node.ech == "1") and true or false,
config = (node.ech_config and node.ech_config:gsub("\\n","\n")) and node.ech_config:gsub("\\n","\n") or nil, config = node.ech_config and split(node.ech_config:gsub("\\n", "\n"), "\n") or {},
pq_signature_schemes_enabled = node.pq_signature_schemes_enabled and true or false, pq_signature_schemes_enabled = node.pq_signature_schemes_enabled and true or false,
dynamic_record_sizing_disabled = node.dynamic_record_sizing_disabled and true or false dynamic_record_sizing_disabled = node.dynamic_record_sizing_disabled and true or false
} }
@ -412,7 +413,7 @@ function gen_config_server(node)
if node.tls == "1" and node.ech == "1" then if node.tls == "1" and node.ech == "1" then
tls.ech = { tls.ech = {
enabled = true, enabled = true,
key = (node.ech_key and node.ech_key:gsub("\\n","\n")) and node.ech_key:gsub("\\n","\n") or nil, key = node.ech_key and split(node.ech_key:gsub("\\n", "\n"), "\n") or {},
pq_signature_schemes_enabled = (node.pq_signature_schemes_enabled == "1") and true or false, pq_signature_schemes_enabled = (node.pq_signature_schemes_enabled == "1") and true or false,
dynamic_record_sizing_disabled = (node.dynamic_record_sizing_disabled == "1") and true or false, dynamic_record_sizing_disabled = (node.dynamic_record_sizing_disabled == "1") and true or false,
} }

View File

@ -14,7 +14,8 @@ TMP_ACL_PATH=$TMP_PATH/acl
TMP_IFACE_PATH=$TMP_PATH/iface TMP_IFACE_PATH=$TMP_PATH/iface
TMP_PATH2=/tmp/etc/${CONFIG}_tmp TMP_PATH2=/tmp/etc/${CONFIG}_tmp
DNSMASQ_PATH=/etc/dnsmasq.d DNSMASQ_PATH=/etc/dnsmasq.d
TMP_DNSMASQ_PATH=/tmp/dnsmasq.d/passwall2 DNSMASQ_CONF_DIR=/tmp/dnsmasq.d
TMP_DNSMASQ_PATH=${DNSMASQ_CONF_DIR}/${CONFIG}
LOG_FILE=/tmp/log/$CONFIG.log LOG_FILE=/tmp/log/$CONFIG.log
APP_PATH=/usr/share/$CONFIG APP_PATH=/usr/share/$CONFIG
RULES_PATH=/usr/share/${CONFIG}/rules RULES_PATH=/usr/share/${CONFIG}/rules
@ -284,6 +285,17 @@ lua_api() {
echo $(lua -e "local api = require 'luci.passwall2.api' print(api.${func})") echo $(lua -e "local api = require 'luci.passwall2.api' print(api.${func})")
} }
get_dnsmasq_conf_dir() {
local dnsmasq_conf_path=$(grep -l "^conf-dir=" /tmp/etc/dnsmasq.conf.${DEFAULT_DNSMASQ_CFGID})
[ -n "$dnsmasq_conf_path" ] && {
local dnsmasq_conf_dir=$(grep '^conf-dir=' "$dnsmasq_conf_path" | cut -d'=' -f2 | head -n 1)
[ -n "$dnsmasq_conf_dir" ] && {
DNSMASQ_CONF_DIR=${dnsmasq_conf_dir%*/}
TMP_DNSMASQ_PATH=${DNSMASQ_CONF_DIR}/${CONFIG}
}
}
}
run_xray() { run_xray() {
local flag node redir_port socks_address socks_port socks_username socks_password http_address http_port http_username http_password local flag node redir_port socks_address socks_port socks_username socks_password http_address http_port http_username http_password
local dns_listen_port direct_dns_query_strategy remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_dns_detour remote_fakedns remote_dns_query_strategy dns_cache write_ipset_direct local dns_listen_port direct_dns_query_strategy remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_dns_detour remote_fakedns remote_dns_query_strategy dns_cache write_ipset_direct
@ -688,7 +700,7 @@ run_global() {
echolog ${msg} echolog ${msg}
source $APP_PATH/helper_dnsmasq.sh stretch source $APP_PATH/helper_dnsmasq.sh stretch
source $APP_PATH/helper_dnsmasq.sh add TMP_DNSMASQ_PATH=$TMP_DNSMASQ_PATH DNSMASQ_CONF_FILE=/tmp/dnsmasq.d/dnsmasq-passwall2.conf DEFAULT_DNS=$AUTO_DNS LOCAL_DNS=$LOCAL_DNS TUN_DNS=$TUN_DNS NFTFLAG=${nftflag:-0} source $APP_PATH/helper_dnsmasq.sh add TMP_DNSMASQ_PATH=$TMP_DNSMASQ_PATH DNSMASQ_CONF_FILE=${DNSMASQ_CONF_DIR}/dnsmasq-${CONFIG}.conf DEFAULT_DNS=$AUTO_DNS LOCAL_DNS=$LOCAL_DNS TUN_DNS=$TUN_DNS NFTFLAG=${nftflag:-0}
V2RAY_CONFIG=$TMP_ACL_PATH/default/global.json V2RAY_CONFIG=$TMP_ACL_PATH/default/global.json
V2RAY_LOG=$TMP_ACL_PATH/default/global.log V2RAY_LOG=$TMP_ACL_PATH/default/global.log
@ -1178,6 +1190,8 @@ PROXY_IPV6=$(config_t_get global_forwarding ipv6_tproxy 0)
XRAY_BIN=$(first_type $(config_t_get global_app xray_file) xray) XRAY_BIN=$(first_type $(config_t_get global_app xray_file) xray)
SINGBOX_BIN=$(first_type $(config_t_get global_app singbox_file) sing-box) SINGBOX_BIN=$(first_type $(config_t_get global_app singbox_file) sing-box)
get_dnsmasq_conf_dir
export V2RAY_LOCATION_ASSET=$(config_t_get global_rules v2ray_location_asset "/usr/share/v2ray/") export V2RAY_LOCATION_ASSET=$(config_t_get global_rules v2ray_location_asset "/usr/share/v2ray/")
export XRAY_LOCATION_ASSET=$V2RAY_LOCATION_ASSET export XRAY_LOCATION_ASSET=$V2RAY_LOCATION_ASSET
mkdir -p /tmp/etc $TMP_PATH $TMP_BIN_PATH $TMP_SCRIPT_FUNC_PATH $TMP_ID_PATH $TMP_ROUTE_PATH $TMP_ACL_PATH $TMP_IFACE_PATH $TMP_PATH2 mkdir -p /tmp/etc $TMP_PATH $TMP_BIN_PATH $TMP_SCRIPT_FUNC_PATH $TMP_ID_PATH $TMP_ROUTE_PATH $TMP_ACL_PATH $TMP_IFACE_PATH $TMP_PATH2

View File

@ -90,7 +90,7 @@ add() {
eval_set_val $@ eval_set_val $@
_LOG_FILE=$LOG_FILE _LOG_FILE=$LOG_FILE
[ -n "$NO_LOGIC_LOG" ] && LOG_FILE="/dev/null" [ -n "$NO_LOGIC_LOG" ] && LOG_FILE="/dev/null"
mkdir -p "${TMP_DNSMASQ_PATH}" "${DNSMASQ_PATH}" "/tmp/dnsmasq.d" mkdir -p "${TMP_DNSMASQ_PATH}" "${DNSMASQ_PATH}" "${DNSMASQ_CONF_DIR}"
local set_type="ipset" local set_type="ipset"
[ "${NFTFLAG}" = "1" ] && { [ "${NFTFLAG}" = "1" ] && {
@ -119,7 +119,7 @@ add() {
} }
del() { del() {
rm -rf /tmp/dnsmasq.d/dnsmasq-$CONFIG.conf rm -rf $DNSMASQ_CONF_DIR/dnsmasq-$CONFIG.conf
rm -rf $DNSMASQ_PATH/dnsmasq-$CONFIG.conf rm -rf $DNSMASQ_PATH/dnsmasq-$CONFIG.conf
rm -rf $TMP_DNSMASQ_PATH rm -rf $TMP_DNSMASQ_PATH
} }