mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-10 23:41:22 +00:00
Merge pull request #1111 from sofia-riese/patch-4
refactor(gateway): replace recursion with while loop
This commit is contained in:
@@ -10,6 +10,7 @@ __IS_MODULE_7_GATEWAY_LOADED=1
|
||||
|
||||
# 访问与控制主菜单
|
||||
gateway() {
|
||||
while true; do
|
||||
echo "-----------------------------------------------"
|
||||
echo -e "\033[30;47m欢迎使用访问与控制菜单:\033[0m"
|
||||
echo "-----------------------------------------------"
|
||||
@@ -26,7 +27,9 @@ gateway(){
|
||||
echo "-----------------------------------------------"
|
||||
read -p "请输入对应数字 > " num
|
||||
case "$num" in
|
||||
0) ;;
|
||||
"" | 0)
|
||||
break
|
||||
;;
|
||||
1)
|
||||
echo "-----------------------------------------------"
|
||||
if [ -n "$(pidof CrashCore)" ] && [ "$firewall_mod" = 'iptables' ]; then
|
||||
@@ -35,23 +38,18 @@ gateway(){
|
||||
else
|
||||
set_fw_wan
|
||||
fi
|
||||
gateway
|
||||
;;
|
||||
2)
|
||||
set_bot_tg
|
||||
gateway
|
||||
;;
|
||||
3)
|
||||
. "$CRASHDIR"/menus/ddns.sh && ddns_menu
|
||||
gateway
|
||||
;;
|
||||
4)
|
||||
set_vmess
|
||||
gateway
|
||||
;;
|
||||
5)
|
||||
set_shadowsocks
|
||||
gateway
|
||||
;;
|
||||
6)
|
||||
if echo "$crashcore" | grep -q 'sing'; then
|
||||
@@ -60,7 +58,6 @@ gateway(){
|
||||
echo -e "\033[33m$crashcore内核暂不支持此功能,请先更换内核!\033[0m"
|
||||
sleep 1
|
||||
fi
|
||||
gateway
|
||||
;;
|
||||
7)
|
||||
if echo "$crashcore" | grep -q 'sing'; then
|
||||
@@ -69,11 +66,16 @@ gateway(){
|
||||
echo -e "\033[33m$crashcore内核暂不支持此功能,请先更换内核!\033[0m"
|
||||
sleep 1
|
||||
fi
|
||||
gateway
|
||||
;;
|
||||
*) errornum ;;
|
||||
*)
|
||||
errornum
|
||||
sleep 1
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
#公网防火墙
|
||||
set_fw_wan() {
|
||||
[ -z "$fw_wan" ] && fw_wan=ON
|
||||
|
||||
Reference in New Issue
Block a user