mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-11-05 18:44:06 +08:00
update 2026-09-12 22:51:39
This commit is contained in:
1 parent
7497dff620
commit
aff13cf0c6
37 files changed
+2830
-1321
No files matched your search
@@ -608,6 +608,7 @@ prepare_clash_runtime_config() {
|
||||
local dns_mode
|
||||
local client_policy_stats
|
||||
local client_rules
|
||||
local enable_fake_ip
|
||||
|
||||
cache_file="$(get_clash_cache_file "$sid")"
|
||||
workdir="$(get_clash_workdir "$sid")"
|
||||
@@ -623,6 +624,7 @@ prepare_clash_runtime_config() {
|
||||
dns_mode="$(uci_get_by_type global pdnsd_enable 0)"
|
||||
client_policy_stats=""
|
||||
client_rules=0
|
||||
enable_fake_ip="$(uci_get_by_type server_subscribe enable_fake_ip "")"
|
||||
|
||||
[ -s "$cache_file" ] || return 1
|
||||
|
||||
@@ -640,15 +642,33 @@ prepare_clash_runtime_config() {
|
||||
routing-mark: $CLASH_OUTBOUND_MARK
|
||||
profile:
|
||||
store-selected: true
|
||||
store-fake-ip: true
|
||||
tun:
|
||||
enable: false
|
||||
dns:
|
||||
enable: $( [ "$dns_mode" = "7" ] && echo "true" || echo "false" )
|
||||
enhanced-mode: redir-host
|
||||
listen: 127.0.0.1:$dns_port
|
||||
ipv6: $( [ "$dns_ipv4_only" = "1" ] && echo "false" || echo "true" )
|
||||
EOF
|
||||
|
||||
# 根据 dns_mode 添加不同的 dns 配置
|
||||
if [ "$dns_mode" = "7" ]; then
|
||||
# 根据 enable_fake_ip 决定 enhanced-mode
|
||||
if [ "$enable_fake_ip" = "1" ]; then
|
||||
ENHANCED_MODE="fake-ip"
|
||||
else
|
||||
ENHANCED_MODE="redir-host"
|
||||
fi
|
||||
cat >> "$overlay_file" <<-EOF
|
||||
dns:
|
||||
enable: true
|
||||
enhanced-mode: $ENHANCED_MODE
|
||||
listen: 127.0.0.1:$dns_port
|
||||
ipv6: $( [ "$dns_ipv4_only" = "1" ] && echo "false" || echo "true" )
|
||||
EOF
|
||||
else
|
||||
cat >> "$overlay_file" <<-EOF
|
||||
dns:
|
||||
enable: false
|
||||
EOF
|
||||
fi
|
||||
|
||||
if [ -n "$socks_port" ] && [ "$socks_port" != "0" ]; then
|
||||
echo "socks-port: $socks_port" >>"$overlay_file"
|
||||
fi
|
||||
@@ -1230,14 +1250,24 @@ start_dns() {
|
||||
ssrplus_dns="$(uci_get_by_type global pdnsd_enable 0)"
|
||||
global_server_type="$(uci_get_by_name "$GLOBAL_SERVER" type)"
|
||||
builtin_dns_enabled=0
|
||||
dnsserver="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
|
||||
|
||||
if [ "$ssrplus_dns" = "5" ]; then
|
||||
ssrplus_dns="$(force_dns2tcp_fallback "旧版 DNSPROXY 模式已移除")" || return 1
|
||||
uci_set_by_type global pdnsd_enable "$ssrplus_dns"
|
||||
elif [ "$ssrplus_dns" = "6" ]; then
|
||||
dnsserver="$(uci_get_by_type global chinadns_ng_tunnel_forward 8.8.4.4:53)"
|
||||
fi
|
||||
case "$ssrplus_dns" in
|
||||
1)
|
||||
dnsserver="$(uci_get_by_type global dns2tcp_tunnel_forward 8.8.4.4:53)"
|
||||
;;
|
||||
6)
|
||||
dnsserver="$(uci_get_by_type global chinadns_ng_tunnel_forward 8.8.4.4:53)"
|
||||
;;
|
||||
7)
|
||||
dnsserver="$(uci_get_by_type global tunnel_forward 8.8.4.4:53)"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
run_mode="$(normalize_run_mode)"
|
||||
|
||||
if [ "$ssrplus_dns" = "4" ] && ! is_finded "mosdns"; then
|
||||
@@ -1503,15 +1533,15 @@ generate_xray_config() {
|
||||
{
|
||||
"log": {
|
||||
"loglevel": "warning"
|
||||
},
|
||||
"inbounds": [$inbound_json],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"settings": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"inbounds": [$inbound_json],
|
||||
"outbounds": [
|
||||
{
|
||||
"protocol": "freedom",
|
||||
"settings": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
return 0
|
||||
}
|
||||
@@ -2887,12 +2917,18 @@ start_rules() {
|
||||
local ac_ips
|
||||
local custom_ports
|
||||
local proxyport
|
||||
local enable_fake_ip
|
||||
|
||||
server=$(get_host_ip "$GLOBAL_SERVER")
|
||||
local_port=$(get_default_node_local_port)
|
||||
lan_ac_ips=$(uci_get_by_type access_control lan_ac_ips)
|
||||
lan_ac_mode=$(uci_get_by_type access_control lan_ac_mode)
|
||||
|
||||
enable_fake_ip=$(uci_get_by_type server_subscribe enable_fake_ip "")
|
||||
if [ -z "$enable_fake_ip" ]; then
|
||||
enable_fake_ip="0"
|
||||
fi
|
||||
|
||||
if [ "$kcp_enable_flag" = "0" ] && [ "$redir_udp" = "1" ]; then
|
||||
udp_server=$(get_host_ip "$UDP_RELAY_SERVER")
|
||||
udp_local_port=$tmp_udp_port
|
||||
@@ -2937,26 +2973,27 @@ start_rules() {
|
||||
fi
|
||||
elif [ "$USE_TABLES" = "iptables" ]; then
|
||||
ARG_A=""
|
||||
fi
|
||||
/usr/share/shadowsocksr/gfw2ipset.sh
|
||||
/usr/bin/ssr-rules \
|
||||
-s "$server" \
|
||||
-l "$local_port" \
|
||||
-S "$udp_server" \
|
||||
-L "$udp_local_port" \
|
||||
-a "$ac_ips" \
|
||||
-i "/etc/ssrplus/china_ssr.txt" \
|
||||
-b "$(uci_get_by_type access_control wan_bp_ips)" \
|
||||
-w "$(uci_get_by_type access_control wan_fw_ips)" \
|
||||
-B "$(uci_get_by_type access_control lan_bp_ips)" \
|
||||
-p "$(uci_get_by_type access_control lan_fp_ips)" \
|
||||
-G "$(uci_get_by_type access_control lan_gm_ips)" \
|
||||
-m "$(uci_get_by_type access_control Interface)" \
|
||||
-D "$proxyport" \
|
||||
"$(get_arg_out)" "$(gfwmode)" "$ARG_UDP" "$ARG_UDP_RULES" "$ARG_A"
|
||||
fi
|
||||
/usr/share/shadowsocksr/gfw2ipset.sh
|
||||
/usr/bin/ssr-rules \
|
||||
-s "$server" \
|
||||
-l "$local_port" \
|
||||
-S "$udp_server" \
|
||||
-L "$udp_local_port" \
|
||||
-a "$ac_ips" \
|
||||
-i "/etc/ssrplus/china_ssr.txt" \
|
||||
-b "$(uci_get_by_type access_control wan_bp_ips)" \
|
||||
-w "$(uci_get_by_type access_control wan_fw_ips)" \
|
||||
-B "$(uci_get_by_type access_control lan_bp_ips)" \
|
||||
-p "$(uci_get_by_type access_control lan_fp_ips)" \
|
||||
-G "$(uci_get_by_type access_control lan_gm_ips)" \
|
||||
-m "$(uci_get_by_type access_control Interface)" \
|
||||
-D "$proxyport" \
|
||||
-E "$enable_fake_ip" \
|
||||
"$(get_arg_out)" "$(gfwmode)" "$ARG_UDP" "$ARG_UDP_RULES" "$ARG_A"
|
||||
|
||||
return $?
|
||||
}
|
||||
return $?
|
||||
}
|
||||
|
||||
start() {
|
||||
local run_mode
|
||||
|
||||
Reference in new issue
Block a user