This commit is contained in:
juewuy
2025-12-12 22:13:12 +08:00
parent 6ff3cc4f3e
commit 3c302d6e1f

View File

@@ -2,6 +2,7 @@
# Copyright (C) Juewuy
CFG="$CRASHDIR"/configs/gateway.cfg
. "$CFG"
gateway(){
echo -----------------------------------------------
@@ -91,37 +92,39 @@ setendpoints(){
[ -n "$ts_auth_key" ] && ts_auth_key_info='已设置'
echo -----------------------------------------------
echo -e "\033[31m注意\033[0m脚本默认内核为了节约内存没有编译Tailscale模块\n如需使用请先前往自定义内核更新完整版内核文件"
echo -e "登陆后请前往此处创建秘钥\033[36;4mhttps://login.tailscale.com/admin/settings/keys\033[0m"
echo -e "通告路由首次启动服务后,需前往\033[36;4mhttps://login.tailscale.com\033[0m允许对应通告,并在客户端启用相关路由"
echo -e "创建秘钥:\033[32;4mhttps://login.tailscale.com/admin/settings/keys\033[0m"
echo -e "访问非本机目标需允许通告:\033[32;4mhttps://login.tailscale.com\033[0m"
echo -e "访问非本机目标需在终端设置使用Subnet或EXIT-NODE模式"
echo -----------------------------------------------
echo -e " 1 启用/关闭Tailscale服务 \033[32m$ts_service\033[0m"
echo -e " 2 设置秘钥(Auth Key) \033[32m$ts_auth_key_info\033[0m"
echo -e " 3 通告路由保留地址(Subnet) \033[32m$ts_advertise_routes\033[0m"
echo -e " 4 通告路由全部流量(EXIT NODE) \033[32m$ts_exit_node_allow\033[0m"
echo -e " 1 启用/关闭Tailscale服务 \033[32m$ts_service\033[0m"
echo -e " 2 设置秘钥(Auth Key) \033[32m$ts_auth_key_info\033[0m"
echo -e " 3 通告路由内网地址(Subnet) \033[32m$ts_subnet\033[0m"
echo -e " 4 通告路由全部流量(EXIT-NODE) \033[32m$ts_exit_node\033[0m"
echo -e " 0 返回上级菜单 \033[0m"
echo -----------------------------------------------
read -p "请输入对应数字 > " num
case "$num" in
0) ;;
1)
[ "ts_service" = ON ] && ts_service=OFF || ts_service=ON
[ "$ts_service" = ON ] && ts_service=OFF || ts_service=ON
setconfig ts_service "$ts_service"
setwireguard
settailscale
;;
2)
read -p "请输入秘钥(Auth key) > " text
[ -n "$text" ] && setconfig ts_auth_key "$text" "$CFG"
setwireguard
read -p "请输入秘钥(输入0删除) > " text
[ "$text" = 0 ] && unset ts_auth_key ts_auth_key_info || ts_auth_key="$text"
[ -n "$ts_auth_key" ] && setconfig ts_auth_key "$ts_auth_key" "$CFG"
settailscale
;;
3)
[ "ts_advertise_routes" = true ] && ts_advertise_routes=false || ts_advertise_routes=true
setconfig ts_advertise_routes "$ts_advertise_routes" "$CFG"
setwireguard
[ "$ts_subnet" = true ] && ts_subnet=false || ts_subnet=true
setconfig ts_subnet "$ts_subnet" "$CFG"
settailscale
;;
4)
[ "advertise_exit_node" = true ] && advertise_exit_node=false || advertise_exit_node=true
setconfig advertise_exit_node "$advertise_exit_node" "$CFG"
setwireguard
[ "$ts_exit_node" = true ] && ts_exit_node=false || ts_exit_node=true
setconfig ts_exit_node "$ts_exit_node" "$CFG"
settailscale
;;
*) errornum ;;
esac
@@ -138,11 +141,11 @@ setendpoints(){
0) ;;
1)
setwireguard
gateway
setendpoints
;;
2)
settailscale
gateway
setendpoints
;;
*) errornum ;;
esac