mirror of
https://github.com/juewuy/ShellCrash.git
synced 2026-03-15 09:51:28 +00:00
Merge pull request #1112 from sofia-riese/patch-6
refactor(set_ipv6): replace recursion with while loop
This commit is contained in:
@@ -489,7 +489,10 @@ set_firewall_vm(){
|
||||
setconfig vm_redir $vm_redir
|
||||
setconfig vm_ipv4 "'$vm_ipv4'"
|
||||
}
|
||||
set_ipv6() { #ipv6设置
|
||||
|
||||
# ipv6设置
|
||||
set_ipv6() {
|
||||
while true; do
|
||||
[ -z "$ipv6_redir" ] && ipv6_redir=OFF
|
||||
[ -z "$ipv6_dns" ] && ipv6_dns=ON
|
||||
echo "-----------------------------------------------"
|
||||
@@ -499,7 +502,9 @@ set_ipv6() { #ipv6设置
|
||||
echo "-----------------------------------------------"
|
||||
read -p "请输入对应数字 > " num
|
||||
case "$num" in
|
||||
0) ;;
|
||||
"" | 0)
|
||||
break
|
||||
;;
|
||||
1)
|
||||
if [ "$ipv6_redir" = "OFF" ]; then
|
||||
ipv6_support=ON
|
||||
@@ -510,15 +515,16 @@ set_ipv6() { #ipv6设置
|
||||
fi
|
||||
setconfig ipv6_redir $ipv6_redir
|
||||
setconfig ipv6_support $ipv6_support
|
||||
set_ipv6
|
||||
;;
|
||||
2)
|
||||
[ "$ipv6_dns" = "OFF" ] && ipv6_dns=ON || ipv6_dns=OFF
|
||||
setconfig ipv6_dns $ipv6_dns
|
||||
set_ipv6
|
||||
;;
|
||||
*)
|
||||
errornum
|
||||
sleep 1
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user