💐 Sync 2026-07-18 20:20:11

This commit is contained in:
github-actions[bot] committed 2026-07-18 20:20:11 +08:00
1 parent bc9ac87cd6
commit ccd8763bcd
66 files changed
+14022 -10358

No files matched your search

+92 -75
View File
@@ -213,6 +213,8 @@ change_dnsmasq() {
uci -q set dhcp.@dnsmasq[0].cachesize=0
uci -q set openclash.config.cachesize_dns=1
else
# Remove residual Dnsmasq redirect left
uci -q del_list dhcp.@dnsmasq[0].server="127.0.0.1#$dns_port"
uci -q set openclash.config.redirect_dns=0
uci -q set openclash.config.cachesize_dns=0
fi
@@ -573,7 +575,7 @@ do_run_file()
ln -s "$meta_core_path" /etc/openclash/clash
if [ -n "$OIX_TOKEN" ]; then
if [ -n "$OIX_TOKEN" ] || [ "$core_type" == "Oix" ]; then
core_type="Oix"
elif [ "$smart_enable" -eq 1 ] || [ "$core_type" == "Smart" ]; then
core_type="Smart"
@@ -586,7 +588,7 @@ do_run_file()
chown root:root "$CLASH"
fi
[ ! -f "$CLASH" ] || { [ "$core_type" = "Smart" ] && [ -z "$($CLASH -v | grep 'smart')" ]; } || { [ "$core_type" = "Oix" ] && [ -z "$($CLASH -v | grep 'oix')" ]; } && {
[ ! -f "$CLASH" ] || { [ "$core_type" = "Smart" ] && [ -z "$($CLASH -v | grep 'smart')" ] && [ -z "$($CLASH -v | grep 'oix')" ]; } || { [ "$core_type" = "Oix" ] && [ -z "$($CLASH -v | grep 'oix')" ]; } && {
LOG_TIP "【$core_type】Core is not Detected installed, Ready to Download..."
rm -rf "/tmp/clash_last_version"
/usr/share/openclash/openclash_core.sh "$core_type"
@@ -823,6 +825,7 @@ start_run_core()
procd_set_param env SAFE_PATHS=/usr/share/openclash:/etc/ssl
procd_append_param env CLASH_AGE_SECRET_KEY="$SECRET_KEY"
procd_append_param env OIX_TOKEN="$OIX_TOKEN"
procd_append_param env OIX_PARAMS="$OIX_PARAMS"
procd_set_param command /bin/sh -c "$CLASH -d $CLASH_CONFIG -f \"$CONFIG_FILE\" >> $LOG_FILE 2>&1"
procd_set_param user "root"
procd_set_param group "nogroup"
@@ -925,6 +928,21 @@ ipv6_suffix_to_nft_format()
echo "& ${suffix} == ${addr}"
} 2>/dev/null
fw4_has_dns_hijack_rule()
{
local chain="$1"
local family="$2"
case "$family" in
ipv6)
nft list chain inet fw4 "$chain" 2>/dev/null |grep 'OpenClash DNS Hijack' |grep -Eq 'meta nfproto[[:space:]]+\{?ipv6\}?|meta nfproto[[:space:]]+ipv6|ip6 nexthdr'
;;
*)
nft list chain inet fw4 "$chain" 2>/dev/null |grep 'OpenClash DNS Hijack' |grep -Evq 'meta nfproto[[:space:]]+\{?ipv6\}?|meta nfproto[[:space:]]+ipv6|ip6 nexthdr'
;;
esac
}
firewall_lan_ac_traffic()
{
local src_port sport_rule dscp_rule sport_ipt dscp_ipt src_ip src_ip_v6 proto target target_ enabled family dscp rule output_rule comment
@@ -1153,7 +1171,7 @@ EOF
#common ports
if [ -n "$common_ports" ] && [ "$common_ports" != "0" ]; then
if [ "$common_ports" = "1" ]; then
common_port="21 22 23 53 80 123 143 194 443 465 587 853 993 995 998 2052 2053 2082 2083 2086 2095 2096 5222 5228 5229 5230 8080 8443 8880 8888 8889"
common_port="21 22 23 53 80 123 143 194 443 465 587 853 993 995 998 2052 2053 2082 2083 2086 2095 2096 2197 5222 5223 5228 5229 5230 8080 8443 8880 8888 8889"
else
common_port=$common_ports
fi
@@ -1327,7 +1345,7 @@ if [ -n "$FW4" ]; then
fi
if [ "$enable_redirect_dns" -eq 1 ]; then
if [ -z "$(nft list chain inet fw4 dstnat |grep 'OpenClash DNS Hijack')" ]; then
if ! fw4_has_dns_hijack_rule dstnat ipv4; then
if [ "$lan_ac_mode" != "1" ]; then
ACBLACKDNSFILTER=""
if [ "$lan_ac_mode" = "0" ]; then
@@ -1338,18 +1356,19 @@ if [ -n "$FW4" ]; then
ACBLACKDNSFILTER="$ACBLACKDNSFILTER ether saddr != @lan_ac_black_macs"
fi
fi
nft insert rule inet fw4 dstnat position 0 meta l4proto {tcp,udp} th dport 53 ${ACBLACKDNSFILTER} counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 ${ACBLACKDNSFILTER} counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
else
nft insert rule inet fw4 dstnat position 0 meta l4proto {tcp,udp} th dport 53 ip saddr @lan_ac_white_ips counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
nft insert rule inet fw4 dstnat position 0 meta l4proto {tcp,udp} th dport 53 ether saddr @lan_ac_white_macs counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 ip saddr @lan_ac_white_ips counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
nft insert rule inet fw4 dstnat position 0 meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 ether saddr @lan_ac_white_macs counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
fi
fi
if [ "$router_self_proxy" = 1 ]; then
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }'
nft insert rule inet fw4 nat_output position 0 skgid != 65534 meta l4proto {tcp,udp} th dport 53 ip daddr {127.0.0.1} counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
nft insert rule inet fw4 nat_output position 0 skgid != 65534 meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 ip daddr {127.0.0.1} counter redirect to "$DNSPORT" comment \"OpenClash DNS Hijack\"
fi
elif [ "$enable_redirect_dns" -eq 2 ]; then
nft 'add chain inet fw4 openclash_dns_redirect'
nft 'flush chain inet fw4 openclash_dns_redirect'
if [ "$lan_ac_mode" != "1" ]; then
ACBLACKDNSFILTER=""
if [ "$lan_ac_mode" = "0" ]; then
@@ -1360,15 +1379,15 @@ if [ -n "$FW4" ]; then
ACBLACKDNSFILTER="$ACBLACKDNSFILTER ether saddr != @lan_ac_black_macs"
fi
fi
nft add rule inet fw4 openclash_dns_redirect meta l4proto {tcp,udp} th dport 53 ${ACBLACKDNSFILTER} counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
nft add rule inet fw4 openclash_dns_redirect meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 ${ACBLACKDNSFILTER} counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
else
nft add rule inet fw4 openclash_dns_redirect meta l4proto {tcp,udp} th dport 53 ip saddr @lan_ac_white_ips counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
nft add rule inet fw4 openclash_dns_redirect meta l4proto {tcp,udp} th dport 53 ether saddr @lan_ac_white_macs counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
nft add rule inet fw4 openclash_dns_redirect meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 ip saddr @lan_ac_white_ips counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
nft add rule inet fw4 openclash_dns_redirect meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 ether saddr @lan_ac_white_macs counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
fi
nft 'insert rule inet fw4 dstnat position 0 meta l4proto {tcp,udp} th dport 53 counter jump openclash_dns_redirect'
nft 'insert rule inet fw4 dstnat position 0 meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 counter jump openclash_dns_redirect'
if [ "$router_self_proxy" = 1 ]; then
nft 'add chain inet fw4 nat_output { type nat hook output priority -1; }'
nft insert rule inet fw4 nat_output position 0 meta l4proto {tcp,udp} th dport 53 ip daddr {127.0.0.1} meta skgid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
nft insert rule inet fw4 nat_output position 0 meta nfproto {ipv4} meta l4proto {tcp,udp} th dport 53 ip daddr {127.0.0.1} meta skgid != 65534 counter redirect to "$dns_port" comment \"OpenClash DNS Hijack\"
fi
fi
@@ -1378,17 +1397,17 @@ if [ -n "$FW4" ]; then
nft 'flush chain inet fw4 openclash'
nft 'add rule inet fw4 openclash ip daddr @localnetwork counter return'
nft 'add rule inet fw4 openclash ct direction reply counter return'
nft add rule inet fw4 openclash ip protocol tcp ip daddr { "$fakeip_range" } counter redirect to "$proxy_port"
nft 'add rule inet fw4 openclash ip daddr @wan_ac_black_ips counter return'
nft 'add rule inet fw4 openclash th dport @wan_ac_black_ports counter return'
nft 'add rule inet fw4 openclash ip saddr @lan_ac_black_ips counter return'
nft 'add rule inet fw4 openclash ether saddr @lan_ac_black_macs counter return'
if [ "$lan_ac_mode" = "1" ] && [ -n "$(uci_get_config "lan_ac_white_ips")" ] && [ -n "$(uci_get_config "lan_ac_white_macs")" ]; then
nft 'add rule inet fw4 openclash ether saddr != @lan_ac_white_macs ip saddr != @lan_ac_white_ips counter return'
else
nft 'add rule inet fw4 openclash ether saddr != @lan_ac_white_macs counter return'
nft 'add rule inet fw4 openclash ip saddr != @lan_ac_white_ips counter return'
fi
nft 'add rule inet fw4 openclash ip saddr @lan_ac_black_ips counter return'
nft 'add rule inet fw4 openclash ether saddr @lan_ac_black_macs counter return'
nft add rule inet fw4 openclash ip protocol tcp ip daddr { "$fakeip_range" } counter redirect to "$proxy_port"
nft 'add rule inet fw4 openclash ip daddr @wan_ac_black_ips counter return'
nft 'add rule inet fw4 openclash th dport @wan_ac_black_ports counter return'
if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash th dport != @common_ports counter return'
@@ -1495,6 +1514,11 @@ if [ -n "$FW4" ]; then
nft 'add rule inet fw4 mangle_output meta nfproto {ipv4} ip protocol udp counter jump openclash_mangle_output'
fi
# Accept TPROXY traffic in input chain (needed when zone input policy is REJECT)
if [ -z "$(nft list chain inet fw4 input 2>/dev/null | grep 'OpenClash TPROXY Accept')" ]; then
nft insert rule inet fw4 input position 0 meta mark "$PROXY_FWMARK" accept comment \"OpenClash TPROXY Accept\"
fi
#quic
if [ "$disable_udp_quic" -eq 1 ]; then
if [ "$china_ip_route" = "2" ]; then
@@ -1507,11 +1531,6 @@ if [ -n "$FW4" ]; then
fi
fi
# Accept TPROXY traffic in input chain (needed when zone input policy is REJECT)
if [ -z "$(nft list chain inet fw4 input 2>/dev/null | grep 'OpenClash TPROXY Accept')" ]; then
nft insert rule inet fw4 input position 0 meta mark "$PROXY_FWMARK" accept comment \"OpenClash TPROXY Accept\"
fi
#router self proxy tcp
if [ "$router_self_proxy" = "1" ] || ([ "$enable_redirect_dns" != "2" ] && [ "$en_mode" = "fake-ip" ]); then
nft 'add chain inet fw4 openclash_output'
@@ -1597,6 +1616,14 @@ if [ -n "$FW4" ]; then
nft 'add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} iifname utun counter return'
nft 'add rule inet fw4 openclash_mangle ip daddr @localnetwork counter return'
nft 'add rule inet fw4 openclash_mangle ct direction reply counter return'
if [ "$lan_ac_mode" = "1" ] && [ -n "$(uci_get_config "lan_ac_white_ips")" ] && [ -n "$(uci_get_config "lan_ac_white_macs")" ]; then
nft 'add rule inet fw4 openclash_mangle ether saddr != @lan_ac_white_macs ip saddr != @lan_ac_white_ips counter return'
else
nft 'add rule inet fw4 openclash_mangle ether saddr != @lan_ac_white_macs counter return'
nft 'add rule inet fw4 openclash_mangle ip saddr != @lan_ac_white_ips counter return'
fi
nft 'add rule inet fw4 openclash_mangle ip saddr @lan_ac_black_ips counter return'
nft 'add rule inet fw4 openclash_mangle ether saddr @lan_ac_black_macs counter return'
if [ "$en_mode_tun" -eq 1 ]; then
nft add rule inet fw4 openclash_mangle meta l4proto {tcp,udp} ip daddr { "$fakeip_range" } mark set "$PROXY_FWMARK" counter
else
@@ -1604,14 +1631,6 @@ if [ -n "$FW4" ]; then
fi
nft 'add rule inet fw4 openclash_mangle ip daddr @wan_ac_black_ips counter return'
nft 'add rule inet fw4 openclash_mangle th dport @wan_ac_black_ports counter return'
nft 'add rule inet fw4 openclash_mangle ip saddr @lan_ac_black_ips counter return'
nft 'add rule inet fw4 openclash_mangle ether saddr @lan_ac_black_macs counter return'
if [ "$lan_ac_mode" = "1" ] && [ -n "$(uci_get_config "lan_ac_white_ips")" ] && [ -n "$(uci_get_config "lan_ac_white_macs")" ]; then
nft 'add rule inet fw4 openclash_mangle ether saddr != @lan_ac_white_macs ip saddr != @lan_ac_white_ips counter return'
else
nft 'add rule inet fw4 openclash_mangle ether saddr != @lan_ac_white_macs counter return'
nft 'add rule inet fw4 openclash_mangle ip saddr != @lan_ac_white_ips counter return'
fi
if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash_mangle th dport != @common_ports counter return'
@@ -1649,10 +1668,10 @@ if [ -n "$FW4" ]; then
if [ "$disable_udp_quic" -eq 1 ]; then
if [ "$china_ip_route" = "2" ]; then
nft insert rule inet fw4 input position 0 udp dport 443 ip daddr @china_ip_route counter reject comment \"OpenClash QUIC REJECT\"
nft insert rule inet fw4 forward position 0 udp dport 443 ip daddr @china_ip_route counter reject comment \"OpenClash QUIC REJECT\"
nft insert rule inet fw4 forward position 0 oifname utun udp dport 443 ip daddr @china_ip_route counter reject comment \"OpenClash QUIC REJECT\"
else
nft insert rule inet fw4 input position 0 udp dport 443 ip daddr != @china_ip_route counter reject comment \"OpenClash QUIC REJECT\"
nft insert rule inet fw4 forward position 0 udp dport 443 ip daddr != @china_ip_route counter reject comment \"OpenClash QUIC REJECT\"
nft insert rule inet fw4 forward position 0 oifname utun udp dport 443 ip daddr != @china_ip_route counter reject comment \"OpenClash QUIC REJECT\"
fi
fi
fi
@@ -1689,7 +1708,7 @@ if [ -n "$FW4" ]; then
fi
fi
if [ -z "$(nft list chain inet fw4 dstnat |grep 'OpenClash DNS Hijack')" ]; then
if ! fw4_has_dns_hijack_rule dstnat ipv6; then
if [ "$enable_redirect_dns" -eq 1 ]; then
if [ "$lan_ac_mode" != "1" ]; then
ACBLACKDNSFILTER=""
@@ -1756,19 +1775,19 @@ if [ -n "$FW4" ]; then
#tcp
nft 'add chain inet fw4 openclash_v6'
nft 'flush chain inet fw4 openclash_v6'
nft add rule inet fw4 openclash_v6 ip6 nexthdr {tcp} ip6 daddr { "$fakeip_range6" } counter redirect to "$proxy_port"
nft 'add rule inet fw4 openclash_v6 ip6 daddr @localnetwork6 counter return'
nft 'add rule inet fw4 openclash_v6 ct direction reply counter return'
nft 'add rule inet fw4 openclash_v6 ip6 daddr @wan_ac_black_ipv6s counter return'
nft 'add rule inet fw4 openclash_v6 th dport @wan_ac_black_ports counter return'
nft 'add rule inet fw4 openclash_v6 ip6 saddr @lan_ac_black_ipv6s counter return'
nft 'add rule inet fw4 openclash_v6 ether saddr @lan_ac_black_macs counter return'
if [ "$lan_ac_mode" = "1" ] && [ -n "$(uci_get_config "lan_ac_white_ips")" ] && [ -n "$(uci_get_config "lan_ac_white_macs")" ]; then
nft 'add rule inet fw4 openclash_v6 ether saddr != @lan_ac_white_macs ip6 saddr != @lan_ac_white_ipv6s counter return'
else
nft 'add rule inet fw4 openclash_v6 ether saddr != @lan_ac_white_macs counter return'
nft 'add rule inet fw4 openclash_v6 ip6 saddr != @lan_ac_white_ipv6s counter return'
fi
nft 'add rule inet fw4 openclash_v6 ip6 saddr @lan_ac_black_ipv6s counter return'
nft 'add rule inet fw4 openclash_v6 ether saddr @lan_ac_black_macs counter return'
nft add rule inet fw4 openclash_v6 ip6 nexthdr {tcp} ip6 daddr { "$fakeip_range6" } counter redirect to "$proxy_port"
nft 'add rule inet fw4 openclash_v6 ip6 daddr @wan_ac_black_ipv6s counter return'
nft 'add rule inet fw4 openclash_v6 th dport @wan_ac_black_ports counter return'
if [ "$en_mode" = "redir-host" ]; then
nft 'add rule inet fw4 openclash_v6 th dport != @common_ports counter return'
@@ -1793,6 +1812,14 @@ if [ -n "$FW4" ]; then
nft 'flush chain inet fw4 openclash_mangle_v6'
nft 'add rule inet fw4 openclash_mangle_v6 ip6 daddr @localnetwork6 counter return'
nft 'add rule inet fw4 openclash_mangle_v6 ct direction reply counter return'
if [ "$lan_ac_mode" = "1" ] && [ -n "$(uci_get_config "lan_ac_white_ips")" ] && [ -n "$(uci_get_config "lan_ac_white_macs")" ]; then
nft 'add rule inet fw4 openclash_mangle_v6 ether saddr != @lan_ac_white_macs ip6 saddr != @lan_ac_white_ipv6s counter return'
else
nft 'add rule inet fw4 openclash_mangle_v6 ether saddr != @lan_ac_white_macs counter return'
nft 'add rule inet fw4 openclash_mangle_v6 ip6 saddr != @lan_ac_white_ipv6s counter return'
fi
nft 'add rule inet fw4 openclash_mangle_v6 ip6 saddr @lan_ac_black_ipv6s counter return'
nft 'add rule inet fw4 openclash_mangle_v6 ether saddr @lan_ac_black_macs counter return'
if [ "$ipv6_mode" -ne 1 ] && [ "$ipv6_mode" -ne 3 ]; then
if [ "$ipv6_mode" -eq 0 ]; then
nft add rule inet fw4 openclash_mangle_v6 ip6 nexthdr {tcp} ip6 daddr { "$fakeip_range6" } mark set "$PROXY_FWMARK" tproxy ip6 to :"$tproxy_port" counter accept
@@ -1814,15 +1841,6 @@ if [ -n "$FW4" ]; then
nft 'add rule inet fw4 openclash_mangle_v6 th dport != @common_ports counter return'
fi
nft 'add rule inet fw4 openclash_mangle_v6 ip6 saddr @lan_ac_black_ipv6s counter return'
nft 'add rule inet fw4 openclash_mangle_v6 ether saddr @lan_ac_black_macs counter return'
if [ "$lan_ac_mode" = "1" ] && [ -n "$(uci_get_config "lan_ac_white_ips")" ] && [ -n "$(uci_get_config "lan_ac_white_macs")" ]; then
nft 'add rule inet fw4 openclash_mangle_v6 ether saddr != @lan_ac_white_macs ip6 saddr != @lan_ac_white_ipv6s counter return'
else
nft 'add rule inet fw4 openclash_mangle_v6 ether saddr != @lan_ac_white_macs counter return'
nft 'add rule inet fw4 openclash_mangle_v6 ip6 saddr != @lan_ac_white_ipv6s counter return'
fi
if [ "$china_ip6_route" != "0" ]; then
if [ "$china_ip6_route" = "1" ]; then
rule="ip6 daddr @china_ip6_route"
@@ -1842,29 +1860,17 @@ if [ -n "$FW4" ]; then
#tcp Tproxy && TUN
if [ "$ipv6_mode" -ne 1 ] && [ "$ipv6_mode" -ne 3 ]; then
if [ "$ipv6_mode" -eq 0 ]; then
if [ "$en_mode" = "fake-ip" ]; then
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 nexthdr {tcp} ip6 daddr { "$fakeip_range6" } mark set "$PROXY_FWMARK" tproxy ip6 to :"$tproxy_port" counter accept
fi
nft add rule inet fw4 openclash_mangle_v6 ip6 nexthdr {tcp} mark set "$PROXY_FWMARK" tproxy ip6 to :"$tproxy_port" counter accept comment \"OpenClash TCP Tproxy\"
else
if [ "$en_mode" = "fake-ip" ]; then
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 nexthdr {tcp} ip6 daddr { "$fakeip_range6" } mark set "$PROXY_FWMARK" counter
fi
nft add rule inet fw4 openclash_mangle_v6 ip6 nexthdr {tcp} mark set "$PROXY_FWMARK" counter
fi
fi
#udp
if [ "$ipv6_mode" -eq 2 ] || [ "$ipv6_mode" -eq 3 ]; then
if [ "$en_mode" = "fake-ip" ]; then
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 nexthdr {udp} ip6 daddr { "$fakeip_range6" } mark set "$PROXY_FWMARK" counter
fi
nft add rule inet fw4 openclash_mangle_v6 ip6 nexthdr {udp} mark set "$PROXY_FWMARK" counter
else
if [ "$enable_v6_udp_proxy" -eq 1 ]; then
if [ "$en_mode" = "fake-ip" ]; then
nft insert rule inet fw4 openclash_mangle_v6 position 0 ip6 nexthdr {udp} ip6 daddr { "$fakeip_range6" } mark set "$PROXY_FWMARK" tproxy ip6 to :"$tproxy_port" counter accept
fi
nft add rule inet fw4 openclash_mangle_v6 ip6 nexthdr {udp} mark set "$PROXY_FWMARK" tproxy ip6 to :"$tproxy_port" counter accept comment \"OpenClash UDP Tproxy\"
fi
fi
@@ -2509,10 +2515,10 @@ if [ -z "$FW4" ]; then
if [ "$disable_udp_quic" -eq 1 ]; then
if [ "$china_ip_route" = "2" ]; then
iptables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set --match-set china_ip_route dst -j REJECT
iptables -I FORWARD -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set --match-set china_ip_route dst -j REJECT
iptables -I FORWARD -p udp --dport 443 -o utun -m comment --comment "OpenClash QUIC REJECT" -m set --match-set china_ip_route dst -j REJECT
else
iptables -I INPUT -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip_route dst -j REJECT
iptables -I FORWARD -p udp --dport 443 -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip_route dst -j REJECT
iptables -I FORWARD -p udp --dport 443 -o utun -m comment --comment "OpenClash QUIC REJECT" -m set ! --match-set china_ip_route dst -j REJECT
fi
fi
fi
@@ -3142,6 +3148,8 @@ EOF
LGBM_CUSTOM_URL:string \
LGBM_UPDATE_INTERVAL:int \
MIXED_PORT:int \
OIX_TOKEN:string \
OIX_PARAMS:string \
PROXY_MODE:string \
PROXY_PORT:int \
ROUTER_SELF_PROXY:int_bool \
@@ -3435,12 +3443,16 @@ EOF
if [ -f "/tmp/yaml_openclash_ruby_parts/$OPENCLASH_OVERWRITE_SID" ]; then
ruby_code=$(cat "/tmp/yaml_openclash_ruby_parts/$OPENCLASH_OVERWRITE_SID")
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
Value = YAML.load_file('$CONFIG_FILE')
threads = []
$ruby_code
threads.each(&:join)
File.open('$CONFIG_FILE', 'w') do |f|
YAML.dump(Value, f)
begin
Value = YAML.load_file('$CONFIG_FILE')
threads = []
$ruby_code
threads.each(&:join)
File.open('$CONFIG_FILE', 'w') do |f|
YAML.dump(Value, f)
end
rescue Exception => e
YAML.LOG_ERROR('Set Custom Overwrite Script Failed,【%s】' % [e.message])
end
" >> $LOG_FILE 2>&1
fi
@@ -3480,6 +3492,7 @@ get_config()
CFG_NO_EXT_NAME="${CFG_NAME%.*}"
SECRET_KEY=$(uci_get_age_secret_keys "$CFG_NO_EXT_NAME")
OIX_TOKEN=$(uci_get_config "oix_token")
OIX_PARAMS=$(uci_get_config "oix_params")
enable=$(uci_get_config "enable")
enable_custom_clash_rules=$(uci_get_config "enable_custom_clash_rules")
da_password=$(uci_get_config "dashboard_password")
@@ -3640,12 +3653,16 @@ start_service()
if [ -f "$yaml_file" ]; then
(
ruby -ryaml -rYAML -I "/usr/share/openclash" -E UTF-8 -e "
Value = YAML.load_file('$yaml_file');
threads = []
$ruby_code
threads.each(&:join)
File.open('$yaml_file', 'w') do |f|
YAML.dump(Value, f)
begin
Value = YAML.load_file('$yaml_file');
threads = []
$ruby_code
threads.each(&:join)
File.open('$yaml_file', 'w') do |f|
YAML.dump(Value, f)
end
rescue Exception => e
YAML.LOG_ERROR('Set Custom Overwrite Script Failed,【%s】' % [e.message])
end
" >> $LOG_FILE 2>&1
)
@@ -3840,4 +3857,4 @@ boot()
sleep "$delay_start"
fi
restart
}
}
@@ -1,6 +1,6 @@
#baidu.com
#2400:da00::dbf:0:100
##解决绕过大陆后谷歌商店无法更新
services.googleapis.cn
googleapis.cn
#baidu.com
#2400:da00::dbf:0:100
##解决绕过大陆后谷歌商店无法更新
services.googleapis.cn
googleapis.cn
xn--ngstr-lra8j.com
@@ -1,6 +1,6 @@
#baidu.com
#114.114.114.114
##解决绕过大陆后谷歌商店无法更新
services.googleapis.cn
googleapis.cn
#baidu.com
#114.114.114.114
##解决绕过大陆后谷歌商店无法更新
services.googleapis.cn
googleapis.cn
xn--ngstr-lra8j.com
@@ -1,6 +1,6 @@
#'www.baidu.com': '114.114.114.114'
#'+.internal.crop.com': '10.0.0.1'
#"_vlmcs._tcp.lan": '127.0.0.1:53'
#"geosite:category-games@cn": [https://doh.pub/dns-query, 114.114.114.114, 223.5.5.5]
#"geosite:google": [tls://8.8.4.4, https://1.0.0.1/dns-query]
#'www.baidu.com': '114.114.114.114'
#'+.internal.crop.com': '10.0.0.1'
#"_vlmcs._tcp.lan": '127.0.0.1:53'
#"geosite:category-games@cn": [https://doh.pub/dns-query, 114.114.114.114, 223.5.5.5]
#"geosite:google": [tls://8.8.4.4, https://1.0.0.1/dns-query]
#"geosite:cn": [https://doh.pub/dns-query, 114.114.114.114, 223.5.5.5]
@@ -1,5 +1,5 @@
#'www.yournode.com': '114.114.114.114'
#'+.yournode.com': '10.0.0.1'
#"yournode.com": '127.0.0.1:53'
#"geosite:cn": [https://doh.pub/dns-query, 114.114.114.114, 223.5.5.5]
#'www.yournode.com': '114.114.114.114'
#'+.yournode.com': '10.0.0.1'
#"yournode.com": '127.0.0.1:53'
#"geosite:cn": [https://doh.pub/dns-query, 114.114.114.114, 223.5.5.5]
#"geosite:geolocation-!cn": [https://dns.cloudflare.com/dns-query#skip-cert-verify=true,https://dns.google/dns-query#ecs=1.1.1.1/24&ecs-override=true&skip-cert-verify=true]
@@ -54,7 +54,7 @@
# INTRANET_ALLOWED (仅允许内网访问, 0: 禁用, 1: 启用)
# INTRANET_ALLOWED_WAN_NAME (仅允许内网时 WAN 接口列表名称)
# BYPASS_GATEWAY_COMPATIBLE (旁路网关兼容模式, 0: 禁用, 1: 启用)
# COMMON_PORTS (绕过常用端口的端口列表, 0: 禁用 or "21 22 23 53 80 123 143 194 443 465 587 853 993 995 998 2052 2053 2082 2083 2086 2095 2096 5222 5228 5229 5230 8080 8443 8880 8888 8889")
# COMMON_PORTS (绕过常用端口的端口列表, 0: 禁用 or "21 22 23 53 80 123 143 194 443 465 587 853 993 995 998 2052 2053 2082 2083 2086 2095 2096 2197 5222 5223 5228 5229 5230 8080 8443 8880 8888 8889")
# --- 分流相关 ---
# CHINA_IP_ROUTE (IPv4 绕过 IP 模式, 0: 禁用, 1: 绕过大陆, 2: 回国)