mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-09-10 18:34:18 +08:00
🎉 Sync 2026-08-16 20:12:56
This commit is contained in:
@@ -8,7 +8,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=26.8.12
|
||||
PKG_RELEASE:=221
|
||||
PKG_RELEASE:=222
|
||||
PKG_PO_VERSION:=$(PKG_VERSION)
|
||||
|
||||
PKG_CONFIG_DEPENDS:= \
|
||||
|
||||
@@ -519,7 +519,7 @@ o.validate = function(self, value, t)
|
||||
local _dns_mode = s.fields["dns_mode"]:formvalue(t)
|
||||
local _tcp_node = s.fields["tcp_node"]:formvalue(t)
|
||||
if _dns_mode and _tcp_node then
|
||||
if (m:get(_tcp_node, "type") or ""):lower() ~= _dns_mode and not _tcp_node:find("Socks_") then
|
||||
if (m:get(_tcp_node, "type") or ""):lower() ~= _dns_mode and not _tcp_node:find("socks_") then
|
||||
return nil, translatef("TCP node must be '%s' type to use FakeDNS.", _dns_mode)
|
||||
end
|
||||
end
|
||||
@@ -527,6 +527,11 @@ o.validate = function(self, value, t)
|
||||
return value
|
||||
end
|
||||
|
||||
o = s:option(Value, "remote_rewrite_ttl", translate("Remote DNS") .. " TTL")
|
||||
o.datatype = "min(1)"
|
||||
o.default = "30"
|
||||
o:depends({dns_mode = "sing-box"})
|
||||
|
||||
o = s:option(ListValue, "chinadns_ng_default_tag", translate("Default DNS"))
|
||||
o.default = "none"
|
||||
o:value("gfw", translate("Remote DNS"))
|
||||
@@ -588,6 +593,7 @@ for k, v in pairs(nodes_table) do
|
||||
|
||||
s.fields["singbox_dns_mode"]:depends({ _tcp_node_bool = "1", tcp_node = v.id })
|
||||
s.fields["_node_sel_shunt"]:depends({ tcp_node = v.id })
|
||||
s.fields["remote_rewrite_ttl"]:depends({ _tcp_node_bool = "1", tcp_node = v.id })
|
||||
end
|
||||
else
|
||||
tcp:value(v.id, v["remark"])
|
||||
|
||||
@@ -480,7 +480,7 @@ o.validate = function(self, value, t)
|
||||
end
|
||||
local _tcp_node = s.fields["tcp_node"]:formvalue(t)
|
||||
if _dns_mode and _tcp_node then
|
||||
if (m:get(_tcp_node, "type") or ""):lower() ~= _dns_mode and not _tcp_node:find("Socks_") then
|
||||
if (m:get(_tcp_node, "type") or ""):lower() ~= _dns_mode and not _tcp_node:find("socks_") then
|
||||
return nil, translatef("TCP node must be '%s' type to use FakeDNS.", _dns_mode)
|
||||
end
|
||||
end
|
||||
@@ -488,6 +488,13 @@ o.validate = function(self, value, t)
|
||||
return value
|
||||
end
|
||||
|
||||
o = s:taboption("DNS", Value, "remote_rewrite_ttl", translate("Remote DNS") .. " TTL")
|
||||
o.datatype = "min(1)"
|
||||
o.default = "30"
|
||||
o:depends({dns_mode = "sing-box", dns_shunt = "dnsmasq"})
|
||||
o:depends({dns_mode = "sing-box", dns_shunt = "chinadns-ng"})
|
||||
o:depends({smartdns_dns_mode = "sing-box", dns_shunt = "smartdns"})
|
||||
|
||||
o = s:taboption("DNS", ListValue, "chinadns_ng_default_tag", translate("Default DNS"))
|
||||
o.default = "none"
|
||||
o:value("gfw", translate("Remote DNS"))
|
||||
@@ -834,6 +841,7 @@ for k, v in pairs(nodes_table) do
|
||||
s.fields["xray_dns_mode"]:depends({ tcp_node = v.id })
|
||||
else
|
||||
s.fields["singbox_dns_mode"]:depends({ tcp_node = v.id })
|
||||
s.fields["remote_rewrite_ttl"]:depends({ tcp_node = v.id })
|
||||
end
|
||||
end
|
||||
else
|
||||
|
||||
@@ -92,7 +92,7 @@ o.write = function(self, section, value)
|
||||
if old ~= value then
|
||||
m:foreach("nodes", function(e)
|
||||
if e["group"] and e["group"]:lower() == old:lower() then
|
||||
self:set(e[".name"], "group", value)
|
||||
self.map:set(e[".name"], "group", value)
|
||||
end
|
||||
if e["protocol"] and (e["protocol"] == "_balancing" or e["protocol"] == "_urltest") and e["node_group"] then
|
||||
local gs = ""
|
||||
@@ -104,7 +104,7 @@ o.write = function(self, section, value)
|
||||
end
|
||||
end
|
||||
gs = api.trim(gs)
|
||||
self:set(e[".name"], "node_group", gs)
|
||||
self.map:set(e[".name"], "node_group", gs)
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
@@ -1087,6 +1087,7 @@ function gen_config(var)
|
||||
local remote_dns_client_ip = var["remote_dns_client_ip"]
|
||||
local remote_dns_query_strategy = var["remote_dns_query_strategy"]
|
||||
local remote_dns_fake = var["remote_dns_fake"]
|
||||
local remote_rewrite_ttl = var["remote_rewrite_ttl"] or "30"
|
||||
local dns_cache = var["dns_cache"]
|
||||
local dns_socks_address = var["dns_socks_address"]
|
||||
local dns_socks_port = var["dns_socks_port"]
|
||||
@@ -2015,7 +2016,7 @@ function gen_config(var)
|
||||
end
|
||||
if value.outboundTag ~= "block" and value.outboundTag ~= "direct" then
|
||||
dns_rule.server = "remote"
|
||||
dns_rule.rewrite_ttl = 30
|
||||
dns_rule.rewrite_ttl = tonumber(remote_rewrite_ttl)
|
||||
if true then
|
||||
local block_rule
|
||||
if remote_strategy == "ipv4_only" then
|
||||
@@ -2063,29 +2064,42 @@ function gen_config(var)
|
||||
end
|
||||
end
|
||||
if default_dns_flag == "remote" then
|
||||
local block_rule
|
||||
local dns_rule_query_type = { "A", "AAAA" }
|
||||
if remote_strategy == "ipv4_only" then
|
||||
block_rule = {
|
||||
query_type = { "AAAA" },
|
||||
action = "predefined",
|
||||
rcode = "NOERROR"
|
||||
}
|
||||
dns_rule_query_type = { "A" }
|
||||
elseif remote_strategy == "ipv6_only" then
|
||||
block_rule = {
|
||||
query_type = { "A" },
|
||||
action = "predefined",
|
||||
rcode = "NOERROR"
|
||||
}
|
||||
dns_rule_query_type = { "AAAA" }
|
||||
end
|
||||
if block_rule then
|
||||
table.insert(dns.rules, block_rule)
|
||||
end
|
||||
if remote_dns_fake then
|
||||
-- When default is not direct and enable fakedns, default DNS use FakeDNS.
|
||||
local fakedns_dns_rule = {
|
||||
query_type = dns_rule_query_type,
|
||||
server = fakedns_tag,
|
||||
disable_cache = true,
|
||||
rewrite_ttl = 30
|
||||
rewrite_ttl = tonumber(remote_rewrite_ttl)
|
||||
}
|
||||
table.insert(dns.rules, fakedns_dns_rule)
|
||||
else
|
||||
local remote_dns_rule = {
|
||||
query_type = dns_rule_query_type,
|
||||
server = "remote",
|
||||
disable_cache = true,
|
||||
}
|
||||
table.insert(dns.rules, remote_dns_rule)
|
||||
end
|
||||
local remote_dns_rule = {
|
||||
server = "remote",
|
||||
disable_cache = true,
|
||||
rewrite_ttl = tonumber(remote_rewrite_ttl)
|
||||
}
|
||||
table.insert(dns.rules, remote_dns_rule)
|
||||
end
|
||||
local dns_in_inbound = {
|
||||
type = "direct",
|
||||
|
||||
@@ -32,6 +32,15 @@ else
|
||||
fi
|
||||
uci commit firewall
|
||||
|
||||
# Migrate server sections from the old `user` section type. New user entries
|
||||
# also use `user`, so only sections with a server `type` option are renamed.
|
||||
for sid in $(uci -q show passwall_server | sed -n 's/^passwall_server\.\([^.=]*\)=user$/\1/p'); do
|
||||
if [ -n "$(uci -q get "passwall_server.${sid}.type")" ]; then
|
||||
uci -q set "passwall_server.${sid}=server"
|
||||
fi
|
||||
done
|
||||
uci -q commit passwall_server
|
||||
|
||||
rm -f /tmp/luci-indexcache /tmp/luci-indexcache.*
|
||||
rm -rf /tmp/luci-modulecache/
|
||||
killall -HUP rpcd 2>/dev/null
|
||||
|
||||
@@ -98,7 +98,7 @@ run_ipt2socks() {
|
||||
|
||||
run_singbox() {
|
||||
local flag type node tcp_redir_port tcp_proxy_way udp_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 direct_dns_port direct_dns_udp_server direct_dns_tcp_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_fakedns remote_dns_query_strategy dns_cache dns_socks_address dns_socks_port
|
||||
local dns_listen_port direct_dns_query_strategy direct_dns_port direct_dns_udp_server direct_dns_tcp_server remote_dns_protocol remote_dns_udp_server remote_dns_tcp_server remote_dns_doh remote_dns_client_ip remote_fakedns remote_dns_query_strategy remote_rewrite_ttl dns_cache dns_socks_address dns_socks_port
|
||||
local loglevel log_file config_file server_host server_port no_run use_proxy_list use_gfw_list chn_list
|
||||
eval_set_val "$@"
|
||||
[ -z "$type" ] && {
|
||||
@@ -179,6 +179,7 @@ run_singbox() {
|
||||
|
||||
[ -n "$remote_dns_client_ip" ] && json_add_string "remote_dns_client_ip" "${remote_dns_client_ip}"
|
||||
[ "$remote_fakedns" = "1" ] && json_add_string "remote_dns_fake" "1"
|
||||
[ -n "$remote_rewrite_ttl" ] && json_add_string "remote_rewrite_ttl" "${remote_rewrite_ttl}"
|
||||
[ -n "$no_run" ] && json_add_string "no_run" "1"
|
||||
local _json_arg="$(json_dump)"
|
||||
lua $UTIL_SINGBOX gen_config "${_json_arg}" > $config_file
|
||||
@@ -763,6 +764,7 @@ run_redir() {
|
||||
resolve_dns_log="${resolve_dns_log} + FakeDNS"
|
||||
USE_FAKEDNS=1
|
||||
}
|
||||
_args="${_args} remote_rewrite_ttl=$(config_t_get global remote_rewrite_ttl)"
|
||||
NEXT_DNS_LISTEN_PORT=$(expr $NEXT_DNS_LISTEN_PORT + 1)
|
||||
}
|
||||
_args="${_args} use_proxy_list=$USE_PROXY_LIST use_gfw_list=$USE_GFW_LIST chn_list=$CHN_LIST"
|
||||
@@ -1274,6 +1276,7 @@ start_dns() {
|
||||
_args="${_args} remote_fakedns=1"
|
||||
USE_FAKEDNS=1
|
||||
}
|
||||
_args="${_args} remote_rewrite_ttl=$(config_t_get global remote_rewrite_ttl)"
|
||||
local _remote_dns_client_ip=$(config_t_get global remote_dns_client_ip)
|
||||
[ -n "${_remote_dns_client_ip}" ] && _args="${_args} remote_dns_client_ip=${_remote_dns_client_ip}"
|
||||
TCP_PROXY_DNS=1
|
||||
@@ -1629,9 +1632,9 @@ acl_app() {
|
||||
dns_mode=$type
|
||||
[ "$type" = "xray" ] && [ "$v2ray_dns_mode" = "http3" ] && v2ray_dns_mode="tcp"
|
||||
}
|
||||
dns_cache_key="${dns_mode}_${remote_dns}_${v2ray_dns_mode:-none}_${remote_dns_client_ip:-0}_${remote_fakedns:-0}"
|
||||
dns_cache_key="${dns_mode}_${remote_dns}_${v2ray_dns_mode:-none}_${remote_dns_client_ip:-0}_${remote_fakedns:-0}_${remote_rewrite_ttl:-30}"
|
||||
([ "$v2ray_dns_mode" = "doh" ] || [ "$v2ray_dns_mode" = "http3" ]) && {
|
||||
dns_cache_key="${dns_mode}_${remote_dns_doh:-https://1.1.1.1/dns-query}_${v2ray_dns_mode:-doh}_${remote_dns_client_ip:-0}_${remote_fakedns:-0}"
|
||||
dns_cache_key="${dns_mode}_${remote_dns_doh:-https://1.1.1.1/dns-query}_${v2ray_dns_mode:-doh}_${remote_dns_client_ip:-0}_${remote_fakedns:-0}_${remote_rewrite_ttl:-30}"
|
||||
}
|
||||
|
||||
if [ "$remote_fakedns" = "1" ] || ([ "$protocol" = "_shunt" ] && [ "$(config_n_get $tcp_node fakedns)" = "1" ]); then
|
||||
@@ -1758,7 +1761,10 @@ acl_app() {
|
||||
_extra_param="${_extra_param} udp_redir_port=$redir_port"
|
||||
}
|
||||
config_file="$TMP_PATH/$config_file"
|
||||
[ "${type}" = "sing-box" ] && type="singbox"
|
||||
[ "${type}" = "sing-box" ] && {
|
||||
type="singbox"
|
||||
_extra_param="${_extra_param} remote_rewrite_ttl=${remote_rewrite_ttl:-30}"
|
||||
}
|
||||
_extra_param="${_extra_param} use_proxy_list=$use_proxy_list use_gfw_list=$use_gfw_list chn_list=$chn_list"
|
||||
run_${type} flag=$tcp_node node=$tcp_node tcp_redir_port=$redir_port ${_extra_param} config_file=$config_file log_file=$log_file loglevel=$loglevel
|
||||
else
|
||||
@@ -1851,7 +1857,7 @@ acl_app() {
|
||||
}
|
||||
unset enabled sid remarks sources interface tcp_no_redir_ports udp_no_redir_ports use_global_config tcp_node udp_node use_direct_list use_proxy_list use_block_list use_gfw_list chn_list tcp_proxy_mode udp_proxy_mode filter_proxy_ipv6 dns_mode remote_dns v2ray_dns_mode remote_dns_doh remote_dns_client_ip
|
||||
unset _ip _mac _iprange _ipset _ip_or_mac source_list tcp_port udp_port config_file _extra_param dns_cache_key log loglevel
|
||||
unset _china_ng_listen _chinadns_local_dns _direct_dns_mode chinadns_ng_default_tag dnsmasq_filter_proxy_ipv6 remote_fakedns force_https_soa use_fakedns
|
||||
unset _china_ng_listen _chinadns_local_dns _direct_dns_mode chinadns_ng_default_tag dnsmasq_filter_proxy_ipv6 remote_fakedns force_https_soa use_fakedns remote_rewrite_ttl
|
||||
done
|
||||
unset socks_port redir_port dns_port dnsmasq_port chinadns_port
|
||||
[ -n "${has_enabled}" ] || {
|
||||
|
||||
Reference in New Issue
Block a user