mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-03 20:03:56 +08:00
🍓 Sync 2026-10-01 00:51:52
This commit is contained in:
1 parent
57dc97412f
commit
d45a1cb4ad
60 files changed
+2630
-1193
No files matched your search
@@ -149,3 +149,29 @@ hp_restore_known_good_uci() {
|
||||
[ "$saved" = "1" ] && uci commit homeproxy-pro </dev/null || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# hp_file_digest <file>
|
||||
# Digest of <file>, or nothing when it is missing or empty. The reload path
|
||||
# uses it to tell "the generator produced the same bytes as what is running"
|
||||
# from "something actually changed".
|
||||
hp_file_digest() {
|
||||
[ -s "$1" ] || return 1
|
||||
|
||||
md5sum "$1" 2>"/dev/null" | awk '{ print $1 }'
|
||||
}
|
||||
|
||||
# hp_config_changed <live> <digest-before>
|
||||
# 0 when <live> differs from <digest-before> (or does not exist), 1 when the
|
||||
# two are byte-identical. An empty <digest-before> means there was nothing
|
||||
# running to compare against, which counts as a change.
|
||||
hp_config_changed() {
|
||||
local live="$1"
|
||||
local before="$2"
|
||||
local now
|
||||
|
||||
now="$(hp_file_digest "$live")" || return 0
|
||||
|
||||
[ -n "$before" ] && [ "$now" = "$before" ] && return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -115,7 +115,19 @@ hp_dnsmasq_render_snippets() {
|
||||
hp_dnsmasq_has_nftset || nftset_ok=0
|
||||
|
||||
case "$routing_mode" in
|
||||
"bypass_mainland_china"|"custom"|"global")
|
||||
"bypass_mainland_china"|"custom"|"global"|"proxy_mainland_china")
|
||||
# Every one of these hands all queries to sing-box, which is the only
|
||||
# DNS front end the mode needs.
|
||||
#
|
||||
# proxy_mainland_china used to be the exception: it expanded
|
||||
# china_list.txt (111353 domains in the bundled list) into one
|
||||
# `server=` line each, so that only those domains reached sing-box.
|
||||
# Measured on a real device (ImmortalWrt 25.12.2, x86-64, dnsmasq
|
||||
# 2.93) that costs about 25 MB of RSS - 1.0 MB empty, 27.2 MB with
|
||||
# the list - while the outcome is the same: this mode's dns.final is
|
||||
# default-dns (the WAN resolver), so a mainland domain resolves
|
||||
# through the ISP either way. The split that actually matters is
|
||||
# decided on the route side, by geoip-cn/china-ip.
|
||||
cat <<-EOF > "$stage/redirect-dns.conf" || return 1
|
||||
no-poll
|
||||
no-resolv
|
||||
@@ -135,12 +147,6 @@ hp_dnsmasq_render_snippets() {
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
"proxy_mainland_china")
|
||||
if [ -s "$hp_dir/resources/china_list.txt" ]; then
|
||||
sed -r -e "s/(.*)/server=\/\1\/127.0.0.1#$dns_port/g" \
|
||||
"$hp_dir/resources/china_list.txt" > "$stage/china_list.conf" || return 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "$routing_mode" != "custom" ] && [ -s "$hp_dir/resources/proxy_list.txt" ]; then
|
||||
|
||||
Reference in new issue
Block a user