From 5cf6eeea485122a778674e77f8146566adbe4e31 Mon Sep 17 00:00:00 2001 From: gitea-action Date: Sun, 22 Dec 2024 19:00:18 +0800 Subject: [PATCH] luci-app-passwall2: sync upstream last commit: https://github.com/xiaorouji/openwrt-passwall2/commit/c1c796f860e4ea984abe1ee5988fdc467aa05a1b --- .../luasrc/model/cbi/passwall2/client/acl_config.lua | 3 --- .../luasrc/model/cbi/passwall2/client/global.lua | 3 --- luci-app-passwall2/luasrc/passwall2/util_sing-box.lua | 5 +++++ luci-app-passwall2/luasrc/passwall2/util_xray.lua | 4 ++-- luci-app-passwall2/root/usr/share/passwall2/app.sh | 5 +++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua index 01483c04a..1cf892a5d 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/acl_config.lua @@ -280,7 +280,6 @@ o = s:option(Value, "remote_dns_client_ip", translate("Remote DNS EDNS Client Su o.description = translate("Notify the DNS server when the DNS query is notified, the location of the client (cannot be a private IP address).") .. "
" .. translate("This feature requires the DNS server to support the Edns Client Subnet (RFC7871).") o.datatype = "ipaddr" -o:depends({ __hide = true }) o = s:option(ListValue, "remote_dns_detour", translate("Remote DNS Outbound")) o.default = "remote" @@ -327,8 +326,6 @@ for k, v in pairs(nodes_table) do end end -s.fields["remote_dns_client_ip"]:depends({ _xray_node = "1", remote_dns_protocol = "tcp" }) -s.fields["remote_dns_client_ip"]:depends({ _xray_node = "1", remote_dns_protocol = "doh" }) s.fields["dns_hosts"]:depends({ _xray_node = "1" }) return m diff --git a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua index e499c5388..6db24429a 100644 --- a/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua +++ b/luci-app-passwall2/luasrc/model/cbi/passwall2/client/global.lua @@ -305,7 +305,6 @@ o = s:taboption("DNS", Value, "remote_dns_client_ip", translate("Remote DNS EDNS o.description = translate("Notify the DNS server when the DNS query is notified, the location of the client (cannot be a private IP address).") .. "
" .. translate("This feature requires the DNS server to support the Edns Client Subnet (RFC7871).") o.datatype = "ipaddr" -o:depends({ __hide = true }) o = s:taboption("DNS", ListValue, "remote_dns_detour", translate("Remote DNS Outbound")) o.default = "remote" @@ -352,8 +351,6 @@ o.template = "passwall2/cbi/hidevalue" o.value = "1" o:depends({ __hide = true }) -s.fields["remote_dns_client_ip"]:depends({ _xray_node = "1", remote_dns_protocol = "tcp" }) -s.fields["remote_dns_client_ip"]:depends({ _xray_node = "1", remote_dns_protocol = "doh" }) s.fields["dns_hosts"]:depends({ _xray_node = "1" }) s:tab("log", translate("Log")) diff --git a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua index 2fbdd6880..824bec4ae 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_sing-box.lua @@ -764,6 +764,7 @@ function gen_config(var) local remote_dns_detour = var["-remote_dns_detour"] local remote_dns_query_strategy = var["-remote_dns_query_strategy"] local remote_dns_fake = var["-remote_dns_fake"] + local remote_dns_client_ip = var["-remote_dns_client_ip"] local dns_cache = var["-dns_cache"] local tags = var["-tags"] @@ -1255,6 +1256,7 @@ function gen_config(var) strategy = remote_strategy, address_resolver = "direct", detour = COMMON.default_outbound_tag, + client_subnet = (remote_dns_client_ip and remote_dns_client_ip ~= "") and remote_dns_client_ip or nil, } if remote_dns_detour == "direct" then @@ -1376,6 +1378,7 @@ function gen_config(var) } fakedns_dns_rule.server = fakedns_tag fakedns_dns_rule.disable_cache = true + fakedns_dns_rule.client_subnet = nil table.insert(dns.rules, fakedns_dns_rule) end end @@ -1581,6 +1584,7 @@ function gen_dns_config(var) local remote_dns_doh_ip = var["-remote_dns_doh_ip"] local remote_dns_doh_port = var["-remote_dns_doh_port"] local remote_dns_detour = var["-remote_dns_detour"] + local remote_dns_client_ip = var["-remote_dns_client_ip"] local remote_dns_outbound_socks_address = var["-remote_dns_outbound_socks_address"] local remote_dns_outbound_socks_port = var["-remote_dns_outbound_socks_port"] local dns_cache = var["-dns_cache"] @@ -1667,6 +1671,7 @@ function gen_dns_config(var) address_strategy = "prefer_ipv6", strategy = (dns_query_strategy and dns_query_strategy ~= "UseIP") and "ipv4_only" or "prefer_ipv6", detour = out_tag, + client_subnet = (remote_dns_client_ip and remote_dns_client_ip ~= "") and remote_dns_client_ip or nil, } if direct_dns_udp_server then diff --git a/luci-app-passwall2/luasrc/passwall2/util_xray.lua b/luci-app-passwall2/luasrc/passwall2/util_xray.lua index 981998fa9..5eee2e78a 100644 --- a/luci-app-passwall2/luasrc/passwall2/util_xray.lua +++ b/luci-app-passwall2/luasrc/passwall2/util_xray.lua @@ -1670,7 +1670,6 @@ end function gen_dns_config(var) local dns_listen_port = var["-dns_listen_port"] local dns_out_tag = var["-dns_out_tag"] - local dns_client_ip = var["-dns_client_ip"] local direct_dns_udp_server = var["-direct_dns_udp_server"] local direct_dns_udp_port = var["-direct_dns_udp_port"] local direct_dns_tcp_server = var["-direct_dns_tcp_server"] @@ -1690,6 +1689,7 @@ function gen_dns_config(var) local remote_dns_doh_port = var["-remote_dns_doh_port"] local remote_dns_query_strategy = var["-remote_dns_query_strategy"] local remote_dns_detour = var["-remote_dns_detour"] + local remote_dns_client_ip = var["-remote_dns_client_ip"] local remote_dns_outbound_socks_address = var["-remote_dns_outbound_socks_address"] local remote_dns_outbound_socks_port = var["-remote_dns_outbound_socks_port"] local dns_cache = var["-dns_cache"] @@ -1713,7 +1713,7 @@ function gen_dns_config(var) disableFallback = true, disableFallbackIfMatch = true, servers = {}, - clientIp = (dns_client_ip and dns_client_ip ~= "") and dns_client_ip or nil, + clientIp = (remote_dns_client_ip and remote_dns_client_ip ~= "") and remote_dns_client_ip or nil, } local other_type_dns_proto, other_type_dns_server, other_type_dns_port diff --git a/luci-app-passwall2/root/usr/share/passwall2/app.sh b/luci-app-passwall2/root/usr/share/passwall2/app.sh index c5eae2fb9..e3bb90f81 100755 --- a/luci-app-passwall2/root/usr/share/passwall2/app.sh +++ b/luci-app-passwall2/root/usr/share/passwall2/app.sh @@ -422,7 +422,7 @@ run_xray() { esac [ -n "$remote_dns_detour" ] && DNS_REMOTE_ARGS="${DNS_REMOTE_ARGS} -remote_dns_detour ${remote_dns_detour}" [ -n "$remote_dns_query_strategy" ] && DNS_REMOTE_ARGS="${DNS_REMOTE_ARGS} -remote_dns_query_strategy ${remote_dns_query_strategy}" - [ -n "$remote_dns_client_ip" ] && DNS_REMOTE_ARGS="${DNS_REMOTE_ARGS} -dns_client_ip ${remote_dns_client_ip}" + [ -n "$remote_dns_client_ip" ] && DNS_REMOTE_ARGS="${DNS_REMOTE_ARGS} -remote_dns_client_ip ${remote_dns_client_ip}" [ "$remote_fakedns" = "1" ] && _extra_param="${_extra_param} -remote_dns_fake 1 -remote_dns_fake_strategy ${remote_dns_query_strategy}" local independent_dns @@ -449,7 +449,7 @@ run_xray() { run_singbox() { 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_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 local loglevel log_file config_file local _extra_param="" eval_set_val $@ @@ -536,6 +536,7 @@ run_singbox() { [ -n "$remote_dns_detour" ] && _extra_param="${_extra_param} -remote_dns_detour ${remote_dns_detour}" [ -n "$remote_dns_query_strategy" ] && _extra_param="${_extra_param} -remote_dns_query_strategy ${remote_dns_query_strategy}" + [ -n "$remote_dns_client_ip" ] && _extra_param="${_extra_param} -remote_dns_client_ip ${remote_dns_client_ip}" [ -n "$dns_listen_port" ] && _extra_param="${_extra_param} -dns_listen_port ${dns_listen_port}" [ -n "$dns_cache" ] && _extra_param="${_extra_param} -dns_cache ${dns_cache}"