refactor(set_ipv6): replace recursion with while loop

This commit is contained in:
Sofia
2026-01-11 01:45:10 +08:00
committed by GitHub
parent 093fffee05
commit da11c319b8

View File

@@ -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
}