mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-07-24 15:47:11 +00:00
Compare commits
21 Commits
732d17087e
...
34b1fc3126
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
34b1fc3126 | ||
|
|
bda31de05d | ||
|
|
2ef92f42ed | ||
|
|
7603a480cd | ||
|
|
9401a48c02 | ||
|
|
47e50ee608 | ||
|
|
5cf7aba112 | ||
|
|
b2d8ad9774 | ||
|
|
a3f2aa9b96 | ||
|
|
4c1e4ab036 | ||
|
|
c100d0312d | ||
|
|
baaad12501 | ||
|
|
3c838f2dda | ||
|
|
c4532c979f | ||
|
|
d4e0ec8fb0 | ||
|
|
f89ac976a7 | ||
|
|
c25c7800be | ||
|
|
ca6e79d864 | ||
|
|
a2720dbe3e | ||
|
|
b66dc2c1b6 | ||
|
|
d37ffc53e0 |
2
.github/workflows/core_easy_update.yaml
vendored
2
.github/workflows/core_easy_update.yaml
vendored
@@ -45,7 +45,7 @@ jobs:
|
||||
tag1: MetaCubeX/mihomo
|
||||
tag2: ${{ needs.get_version.outputs.version }}
|
||||
tag4: meta
|
||||
tag5: ""
|
||||
tag5: no_tailscale
|
||||
tag6: tar.gz
|
||||
secrets: inherit
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ grep -qE '/(docker|lxc|kubepods|crio|containerd)/' /proc/1/cgroup 2>/dev/null ||
|
||||
[ "$systype" = 'container' ] && CRASHDIR='/etc/ShellCrash'
|
||||
[ -z "$CRASHDIR" ] && [ -n "$clashdir" ] && CRASHDIR="$clashdir"
|
||||
[ -z "$CRASHDIR" ] && [ -d /tmp/SC_tmp ] && . /tmp/SC_tmp/menus/set_crashdir.sh && set_crashdir
|
||||
CRASHDIR=$(echo "$CRASHDIR" | sed 's#/*$##') #删除末尾的/
|
||||
TASKCFGDIR="$CRASHDIR"/configs/task
|
||||
#移动文件
|
||||
mkdir -p "$CRASHDIR"
|
||||
|
||||
@@ -54,7 +54,7 @@ DNS_CORE_REQUIRE="请使用Mihomo或SingBox内核"
|
||||
DNS_SET_TO="设为"
|
||||
DNS_REMOVE_OK="移除成功"
|
||||
DNS_REMOVE_FAIL="移除失败"
|
||||
DNS_INPUT_REDIR_PORT="请直接输入旁路由IPV4地址"
|
||||
DNS_INPUT_REDIR_PORT="请输入第三方应用的DNS监听端口"
|
||||
DNS_INPUT_REDIR_RESET="或输入 r 重置DNS劫持端口"
|
||||
DNS_INPUT_REDIR_BACK="或输入 0 返回上级菜单"
|
||||
DNS_INPUT="请输入"
|
||||
|
||||
@@ -56,7 +56,7 @@ DNS_CORE_REQUIRE="Please use the Mihomo or SingBox core"
|
||||
DNS_SET_TO="Set to"
|
||||
DNS_REMOVE_OK="Removed successfully"
|
||||
DNS_REMOVE_FAIL="Remove failed"
|
||||
DNS_INPUT_REDIR_PORT="Please input bypass-router IPv4 address"
|
||||
DNS_INPUT_REDIR_PORT="Please input DNS redirect port"
|
||||
DNS_INPUT_REDIR_RESET="or input r to reset DNS redirect port"
|
||||
DNS_INPUT_REDIR_BACK="or input 0 to go back"
|
||||
DNS_INPUT="Please enter"
|
||||
|
||||
@@ -6,8 +6,9 @@ get_ecs_address() {
|
||||
[ -n "$ip" ] && return
|
||||
done
|
||||
. "$CRASHDIR"/libs/web_get_lite.sh
|
||||
for web in http://members.3322.org/dyndns/getip http://4.ipw.cn http://ipinfo.io/ip; do
|
||||
ip=$(web_get_lite "$web" 0)
|
||||
#轮询公网IP,提取并校验为合法IPv4才采用,否则继续尝试下一个
|
||||
for web in http://ddns.oray.com/checkip http://members.3322.org/dyndns/getip http://ipinfo.io/ip; do
|
||||
ip=$(web_get_lite "$web" 0 | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' | tail -1)
|
||||
[ -n "$ip" ] && return
|
||||
done
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ touch "$tmpcron"
|
||||
cronadd() { #定时任务工具
|
||||
if crontab -h 2>&1 | grep -q '\-l'; then
|
||||
crontab "$1"
|
||||
elif [ -f "$crondir/$USER" ];then
|
||||
elif [ -w "$crondir" ];then
|
||||
cat "$1" >"$crondir"/"$USER" && cru a REFRESH "0 0 1 1 * /bin/true" 2>/dev/null
|
||||
else
|
||||
echo "找不到可用的crond或者crontab应用!No available crond or crontab application can be found!"
|
||||
|
||||
@@ -625,6 +625,8 @@ set_firewall_vm() {
|
||||
common_success
|
||||
else
|
||||
msg_alert "\033[33m$VM_NO_NET_DETECTED\033[0m"
|
||||
set_firewall_vm
|
||||
return
|
||||
fi
|
||||
|
||||
;;
|
||||
@@ -639,16 +641,12 @@ set_firewall_vm() {
|
||||
3)
|
||||
vm_redir=OFF
|
||||
vm_ipv4=''
|
||||
common_success
|
||||
;;
|
||||
*) ;;
|
||||
*) return ;;
|
||||
esac
|
||||
case "$num" in
|
||||
1-3)
|
||||
common_success
|
||||
setconfig vm_redir "$vm_redir"
|
||||
setconfig vm_ipv4 "'$vm_ipv4'"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# ipv6设置
|
||||
|
||||
@@ -129,7 +129,7 @@ web_save_auto(){
|
||||
. "$CRASHDIR"/libs/web_save.sh && web_save
|
||||
}
|
||||
update_config() { #更新订阅并重启
|
||||
. "$CRASHDIR"/starts/core_config.sh && get_core_config && "$CRASHDIR"/start.sh start
|
||||
. "$CRASHDIR"/starts/core_config.sh get_core_config && "$CRASHDIR"/start.sh start
|
||||
}
|
||||
hotupdate() { #热更新订阅
|
||||
. "$CRASHDIR"/starts/core_config.sh && get_core_config &&
|
||||
|
||||
@@ -120,7 +120,7 @@ userguide() {
|
||||
read -r -p "$COMMON_INPUT_R" res
|
||||
[ "$res" = 1 ] && {
|
||||
BINDIR=/tmp/ShellCrash
|
||||
sed -i "s#BINDIR=.*#BINDIR=$BINDIR" "$CRASHDIR"/configs/command.env
|
||||
sed -i "s#BINDIR=.*#BINDIR=$BINDIR#" "$CRASHDIR"/configs/command.env
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ prepare_clash_base_config() {
|
||||
if [ -n "$ecs_address" ];then
|
||||
dns_fallback=$(echo "$dns_fallback, " | sed "s|, |#ecs-override=true\&ecs=$ecs_address, |g" | sed 's|, $||')
|
||||
else
|
||||
logger "自动获取ecs网段失败!"
|
||||
logger "自动获取ecs网段失败!" 33
|
||||
fi
|
||||
}
|
||||
}
|
||||
@@ -37,7 +37,7 @@ dns:
|
||||
default-nameserver: [ $dns_resolver ]
|
||||
direct-nameserver: [ $dns_nameserver ]
|
||||
enhanced-mode: fake-ip
|
||||
fake-ip-range: 28.0.0.0/8
|
||||
fake-ip-range: 198.18.0.0/15
|
||||
fake-ip-range6: fc00::/16
|
||||
fake-ip-filter:
|
||||
EOF
|
||||
|
||||
@@ -2,7 +2,7 @@ getlanip() { #获取局域网host地址
|
||||
i=1
|
||||
while [ "$i" -le "20" ]; do
|
||||
#ipv4局域网网段
|
||||
host_ipv4=$(ip route show scope link | grep -Ev 'wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet|wgs|multicast|anycast' | awk '{print $1}')
|
||||
host_ipv4=$(ip route show scope link | grep -Ev 'default|wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet|wgs|multicast|anycast' | awk '{print $1}')
|
||||
#ipv6局域网网段 - 从IPv4已识别的LAN接口获取全局IPv6前缀
|
||||
[ "$ipv6_redir" = "ON" ] && {
|
||||
lan_ifaces=$(ip route show scope link | grep -Ev 'ppp|wan|utun|iot|peer|docker|podman|virbr|vnet|ovs|vmbr|veth|vmnic|vboxnet|lxcbr|xenbr|vEthernet|wgs|multicast|anycast' | awk '{for(i=1;i<=NF;i++) if($i=="dev") {print $(i+1); break}}' | grep -v '^lo$' | sort -u)
|
||||
|
||||
@@ -72,8 +72,23 @@ start_ipt_route() { #iptables-route通用工具
|
||||
done
|
||||
fi
|
||||
#将所在链指定流量指向shellcrash表
|
||||
"$1" $w -t "$2" -I "$3" -p "$5" $ports -j "$4"
|
||||
[ "$dns_mod" = "mix" -o "$dns_mod" = "fake-ip" ] && [ "$common_ports" = "ON" ] && [ "$1" = iptables ] && "$1" $w -t "$2" -I "$3" -p "$5" -d 28.0.0.0/8 -j "$4"
|
||||
if [ -n "$ports" ]; then
|
||||
clean_ports=$(echo "$multiport" | sed 's/ //g')
|
||||
echo "$clean_ports" | awk -F, '{
|
||||
for(i=1; i<=NF; i+=9) {
|
||||
group=""
|
||||
for(j=i; j<i+9 && j<=NF; j++) {
|
||||
group=(group == "" ? $j : group "," $j)
|
||||
}
|
||||
print group
|
||||
}
|
||||
}' | while read -r port_group; do
|
||||
[ -n "$port_group" ] && "$1" $w -t "$2" -I "$3" -p "$5" -m multiport --dports "$port_group" -j "$4"
|
||||
done
|
||||
else
|
||||
"$1" $w -t "$2" -I "$3" -p "$5" -j "$4"
|
||||
fi
|
||||
[ "$dns_mod" = "mix" -o "$dns_mod" = "fake-ip" ] && [ "$common_ports" = "ON" ] && [ "$1" = iptables ] && "$1" $w -t "$2" -I "$3" -p "$5" -d 198.18.0.0/15 -j "$4"
|
||||
[ "$dns_mod" = "mix" -o "$dns_mod" = "fake-ip" ] && [ "$common_ports" = "ON" ] && [ "$1" = ip6tables ] && "$1" $w -t "$2" -I "$3" -p "$5" -d fc00::/16 -j "$4"
|
||||
}
|
||||
[ "$5" = "tcp" -o "$5" = "all" ] && proxy_set "$1" "$2" "$3" "$4" tcp
|
||||
|
||||
@@ -38,12 +38,12 @@ start_nft_route() { #nftables-route通用工具
|
||||
[ -z "$ports" ] && nft add rule inet shellcrash $1 tcp dport {"$mix_port, $redir_port, $tproxy_port"} return
|
||||
#过滤常用端口
|
||||
[ -n "$PORTS" ] && {
|
||||
nft add rule inet shellcrash $1 ip daddr != {28.0.0.0/8} tcp dport != {$PORTS} return
|
||||
nft add rule inet shellcrash $1 ip daddr != {28.0.0.0/8} udp dport != {$PORTS} return
|
||||
nft add rule inet shellcrash $1 ip daddr != {198.18.0.0/15} tcp dport != {$PORTS} return
|
||||
nft add rule inet shellcrash $1 ip daddr != {198.18.0.0/15} udp dport != {$PORTS} return
|
||||
nft add rule inet shellcrash $1 ip6 daddr != {fc00::/16} tcp dport != {$PORTS} return
|
||||
nft add rule inet shellcrash $1 ip6 daddr != {fc00::/16} udp dport != {$PORTS} return
|
||||
}
|
||||
#nft add rule inet shellcrash $1 ip saddr 28.0.0.0/8 return
|
||||
#nft add rule inet shellcrash $1 ip saddr 198.18.0.0/15 return
|
||||
nft add rule inet shellcrash $1 ip daddr {$RESERVED_IP} return #过滤保留地址
|
||||
#过滤局域网设备
|
||||
[ "$1" = 'prerouting' ] && {
|
||||
|
||||
@@ -20,26 +20,46 @@ ckcmd iptables && {
|
||||
$iptable -t nat -D PREROUTING -p udp --dport 53 -j shellcrash_dns 2>/dev/null
|
||||
$iptable -t nat -D OUTPUT -p udp --dport 53 -j shellcrash_dns_out 2>/dev/null
|
||||
$iptable -t nat -D OUTPUT -p tcp --dport 53 -j shellcrash_dns_out 2>/dev/null
|
||||
if [ -n "$ports" ]; then
|
||||
clean_ports=$(echo "$multiport" | sed 's/ //g')
|
||||
echo "$clean_ports" | awk -F, '{
|
||||
for(i=1; i<=NF; i+=9) {
|
||||
group=""; for(j=i; j<i+9 && j<=NF; j++) group=(group == "" ? $j : group "," $j)
|
||||
print group
|
||||
}
|
||||
}' | while read -r port_group; do
|
||||
if [ -n "$port_group" ]; then
|
||||
$iptable -t nat -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrash 2>/dev/null
|
||||
$iptable -t nat -D OUTPUT -p tcp -m multiport --dports "$port_group" -j shellcrash_out 2>/dev/null
|
||||
$iptable -t nat -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrash_vm 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p udp -m multiport --dports "$port_group" -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p tcp -m multiport --dports "$port_group" -j shellcrash_mark_out 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p udp -m multiport --dports "$port_group" -j shellcrash_mark_out 2>/dev/null
|
||||
fi
|
||||
done
|
||||
else
|
||||
$iptable -t nat -D PREROUTING -p tcp -j shellcrash 2>/dev/null
|
||||
$iptable -t nat -D OUTPUT -p tcp -j shellcrash_out 2>/dev/null
|
||||
$iptable -t nat -D PREROUTING -p tcp -j shellcrash_vm 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p tcp -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p udp -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p tcp -j shellcrash_mark_out 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p udp -j shellcrash_mark_out 2>/dev/null
|
||||
fi
|
||||
#redir
|
||||
$iptable -t nat -D PREROUTING -p tcp $ports -j shellcrash 2>/dev/null
|
||||
$iptable -t nat -D PREROUTING -p tcp -d 28.0.0.0/8 -j shellcrash 2>/dev/null
|
||||
$iptable -t nat -D OUTPUT -p tcp $ports -j shellcrash_out 2>/dev/null
|
||||
$iptable -t nat -D OUTPUT -p tcp -d 28.0.0.0/8 -j shellcrash_out 2>/dev/null
|
||||
$iptable -t nat -D PREROUTING -p tcp -d 198.18.0.0/15 -j shellcrash 2>/dev/null
|
||||
$iptable -t nat -D OUTPUT -p tcp -d 198.18.0.0/15 -j shellcrash_out 2>/dev/null
|
||||
#vm_dns
|
||||
$iptable -t nat -D PREROUTING -p tcp --dport 53 -j shellcrash_vm_dns 2>/dev/null
|
||||
$iptable -t nat -D PREROUTING -p udp --dport 53 -j shellcrash_vm_dns 2>/dev/null
|
||||
#vm_redir
|
||||
$iptable -t nat -D PREROUTING -p tcp $ports -j shellcrash_vm 2>/dev/null
|
||||
$iptable -t nat -D PREROUTING -p tcp -d 28.0.0.0/8 -j shellcrash_vm 2>/dev/null
|
||||
$iptable -t nat -D PREROUTING -p tcp -d 198.18.0.0/15 -j shellcrash_vm 2>/dev/null
|
||||
#TPROXY&tun
|
||||
$iptable -t mangle -D PREROUTING -p tcp $ports -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p udp $ports -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p tcp -d 28.0.0.0/8 -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p udp -d 28.0.0.0/8 -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p tcp $ports -j shellcrash_mark_out 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p udp $ports -j shellcrash_mark_out 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p tcp -d 28.0.0.0/8 -j shellcrash_mark_out 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p udp -d 28.0.0.0/8 -j shellcrash_mark_out 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p tcp -d 198.18.0.0/15 -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -p udp -d 198.18.0.0/15 -j shellcrash_mark 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p tcp -d 198.18.0.0/15 -j shellcrash_mark_out 2>/dev/null
|
||||
$iptable -t mangle -D OUTPUT -p udp -d 198.18.0.0/15 -j shellcrash_mark_out 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -m mark --mark $fwmark -p tcp -j TPROXY --on-port $tproxy_port 2>/dev/null
|
||||
$iptable -t mangle -D PREROUTING -m mark --mark $fwmark -p udp -j TPROXY --on-port $tproxy_port 2>/dev/null
|
||||
#tun
|
||||
@@ -73,20 +93,39 @@ ckcmd ip6tables && {
|
||||
#dns
|
||||
$ip6table -t nat -D PREROUTING -p tcp --dport 53 -j shellcrashv6_dns 2>/dev/null
|
||||
$ip6table -t nat -D PREROUTING -p udp --dport 53 -j shellcrashv6_dns 2>/dev/null
|
||||
if [ -n "$ports" ]; then
|
||||
clean_ports=$(echo "$multiport" | sed 's/ //g')
|
||||
echo "$clean_ports" | awk -F, '{
|
||||
for(i=1; i<=NF; i+=9) {
|
||||
group=""; for(j=i; j<i+9 && j<=NF; j++) group=(group == "" ? $j : group "," $j)
|
||||
print group
|
||||
}
|
||||
}' | while read -r port_group; do
|
||||
if [ -n "$port_group" ]; then
|
||||
$ip6table -t nat -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrashv6 2>/dev/null
|
||||
$ip6table -t nat -D OUTPUT -p tcp -m multiport --dports "$port_group" -j shellcrashv6_out 2>/dev/null
|
||||
$ip6table -t mangle -D PREROUTING -p tcp -m multiport --dports "$port_group" -j shellcrashv6_mark 2>/dev/null
|
||||
$ip6table -t mangle -D PREROUTING -p udp -m multiport --dports "$port_group" -j shellcrashv6_mark 2>/dev/null
|
||||
$ip6table -t mangle -D OUTPUT -p tcp -m multiport --dports "$port_group" -j shellcrashv6_mark_out 2>/dev/null
|
||||
$ip6table -t mangle -D OUTPUT -p udp -m multiport --dports "$port_group" -j shellcrashv6_mark_out 2>/dev/null
|
||||
fi
|
||||
done
|
||||
else
|
||||
$ip6table -t nat -D PREROUTING -p tcp -j shellcrashv6 2>/dev/null
|
||||
$ip6table -t nat -D OUTPUT -p tcp -j shellcrashv6_out 2>/dev/null
|
||||
$ip6table -t mangle -D PREROUTING -p tcp -j shellcrashv6_mark 2>/dev/null
|
||||
$ip6table -t mangle -D PREROUTING -p udp -j shellcrashv6_mark 2>/dev/null
|
||||
$ip6table -t mangle -D OUTPUT -p tcp -j shellcrashv6_mark_out 2>/dev/null
|
||||
$ip6table -t mangle -D OUTPUT -p udp -j shellcrashv6_mark_out 2>/dev/null
|
||||
fi
|
||||
#redir
|
||||
$ip6table -t nat -D PREROUTING -p tcp $ports -j shellcrashv6 2>/dev/null
|
||||
$ip6table -t nat -D PREROUTING -p tcp -d fc00::/16 -j shellcrashv6 2>/dev/null
|
||||
$ip6table -t nat -D OUTPUT -p tcp $ports -j shellcrashv6_out 2>/dev/null
|
||||
$ip6table -t nat -D OUTPUT -p tcp -d fc00::/16 -j shellcrashv6_out 2>/dev/null
|
||||
$ip6table -D INPUT -p tcp --dport 53 -j REJECT 2>/dev/null
|
||||
$ip6table -D INPUT -p udp --dport 53 -j REJECT 2>/dev/null
|
||||
#mark
|
||||
$ip6table -t mangle -D PREROUTING -p tcp $ports -j shellcrashv6_mark 2>/dev/null
|
||||
$ip6table -t mangle -D PREROUTING -p udp $ports -j shellcrashv6_mark 2>/dev/null
|
||||
$ip6table -t mangle -D PREROUTING -p tcp -d fc00::/16 -j shellcrashv6_mark 2>/dev/null
|
||||
$ip6table -t mangle -D PREROUTING -p udp -d fc00::/16 -j shellcrashv6_mark 2>/dev/null
|
||||
$ip6table -t mangle -D OUTPUT -p tcp $ports -j shellcrashv6_mark_out 2>/dev/null
|
||||
$ip6table -t mangle -D OUTPUT -p udp $ports -j shellcrashv6_mark_out 2>/dev/null
|
||||
$ip6table -t mangle -D OUTPUT -p tcp -d fc00::/16 -j shellcrashv6_mark_out 2>/dev/null
|
||||
$ip6table -t mangle -D OUTPUT -p udp -d fc00::/16 -j shellcrashv6_mark_out 2>/dev/null
|
||||
$ip6table -D INPUT -p udp --dport 443 $set_cn_ip -j REJECT 2>/dev/null
|
||||
|
||||
@@ -55,6 +55,14 @@ extract_base_jsons() {
|
||||
}
|
||||
|
||||
generate_basic_jsons() {
|
||||
#适配1.14+版本
|
||||
if [ "$(printf '%s' "$core_v" | cut -d. -f2)" -lt 14 ];then
|
||||
preferred='"ip_accept_any": true,'
|
||||
detour_direct='"download_detour": "DIRECT"'
|
||||
else
|
||||
preferred='"preferred_by": [ "hosts" ],'
|
||||
detour_direct='"http_client": "detour_direct"'
|
||||
fi
|
||||
#生成endpoints.json
|
||||
[ "$ts_service" = ON ] || [ "$wg_service" = ON ] && [ "$zip_type" != upx ] && {
|
||||
. "$CRASHDIR"/configs/gateway.cfg
|
||||
@@ -92,7 +100,7 @@ EOF
|
||||
],
|
||||
"rules": [
|
||||
{
|
||||
"preferred_by": [ "hosts" ],
|
||||
$preferred
|
||||
"server": "hosts"
|
||||
}
|
||||
]
|
||||
@@ -113,7 +121,11 @@ prepare_dns_config() {
|
||||
#ecs优化
|
||||
[ "$ecs_subnet" = ON ] && {
|
||||
. "$CRASHDIR"/libs/get_ecsip.sh
|
||||
if [ -n "$ecs_address" ]; then
|
||||
client_subnet='"client_subnet": "'"$ecs_address"'",'
|
||||
else
|
||||
logger "自动获取ecs网段失败!" 33
|
||||
fi
|
||||
}
|
||||
#根据dns模式生成
|
||||
[ "$dns_mod" = "redir_host" ] && {
|
||||
@@ -154,7 +166,7 @@ generate_dns_related_jsons() {
|
||||
"format": "binary",
|
||||
$srs_path
|
||||
"url": "https://testingcf.jsdelivr.net/gh/DustinWin/ruleset_geodata@sing-box-ruleset/cn.srs",
|
||||
"http_client": "detour_direct"
|
||||
$detour_direct
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -181,7 +193,7 @@ EOF
|
||||
{
|
||||
"tag": "dns_fakeip",
|
||||
"type": "fakeip",
|
||||
"inet4_range": "28.0.0.0/8",
|
||||
"inet4_range": "198.18.0.0/15",
|
||||
"inet6_range": "fc00::/16"
|
||||
},
|
||||
{
|
||||
@@ -297,7 +309,7 @@ EOF
|
||||
"interface_name": "utun",
|
||||
"address": [
|
||||
$ipv6_address
|
||||
"28.0.0.1/30"
|
||||
"198.18.0.1/15"
|
||||
],
|
||||
"auto_route": false,
|
||||
"stack": "system"
|
||||
|
||||
Reference in New Issue
Block a user