~增加清理providers目录功能

~尝试修复systemd和保守模式产生冲突的问题
~优化tun模式对iptables的检测机制
This commit is contained in:
juewuy 2024-02-16 15:19:39 +08:00
parent 8600e85ff4
commit 95920c3630
3 changed files with 13 additions and 3 deletions

View File

@ -487,7 +487,7 @@ EOF
setproviders(){ #自定义providers
echo -----------------------------------------------
echo -e "\033[33m你可以在这里快捷管理与生成自定义的providers提供者\033[0m"
echo -e "\033[33m暂时只支持yaml格式的配置导入\033[0m"
echo -e "\033[33m暂时只支持yaml格式的配置导入,并且不支持跳过证书验证功能\033[0m"
[ -s $CRASHDIR/configs/providers.cfg ] && {
echo -----------------------------------------------
echo -e "\033[36m输入对应数字可管理providers提供者\033[0m"
@ -498,6 +498,7 @@ setproviders(){ #自定义providers
echo -e " b \033[32m生成\033[0m基于providers的配置文件"
echo -e " c 选择\033[33m规则模版\033[0m"
echo -e " d \033[31m清空\033[0mproviders列表"
echo -e " e \033[31m清理\033[0mproviders目录"
echo -e " 0 返回上级菜单"
read -p "请输入对应数字 > " num
case $num in
@ -613,6 +614,12 @@ setproviders(){ #自定义providers
[ "$res" = "1" ] && rm -rf $CRASHDIR/configs/providers.cfg
setproviders
;;
d)
echo -e "\033[33m将清空 $CRASHDIR/providers 目录下所有内容\033[0m"
read -p "是否继续?(1/0) > " res
[ "$res" = "1" ] && rm -rf $CRASHDIR/providers
setproviders
;;
*)
errornum
;;

View File

@ -176,6 +176,7 @@ else
systemctl daemon-reload
else
#设为保守模式启动
systemctl disable shellcrash 2>/dev/null
setconfig start_old 已开启
fi
fi

View File

@ -1089,7 +1089,7 @@ start_tun(){ #iptables-tun
iptables -I FORWARD -p udp --dport 443 -o utun -m comment --comment "ShellCrash-QUIC-REJECT" $set_cn_ip -j REJECT >/dev/null 2>&1
ip6tables -I FORWARD -p udp --dport 443 -o utun -m comment --comment "ShellCrash-QUIC-REJECT" $set_cn_ip6 -j REJECT >/dev/null 2>&1
fi
modprobe xt_mark >/dev/null 2>&1 && {
if [ -n "$(iptables -j MARK 2>&1 | grep 'mark')" ];then
i=1
while [ -z "$(ip route list |grep utun)" -a "$i" -le 29 ];do
sleep 1
@ -1159,7 +1159,9 @@ start_tun(){ #iptables-tun
[ "$1" = "all" ] && ip6tables -t mangle -A PREROUTING -p tcp $ports -j shellcrashv6
}
fi
}
else
logger "iptables缺少-J MARK功能放弃启动tun相关防火墙规则" 31
fi
}
start_nft(){ #nftables-allinone
#获取局域网host地址