mirror of
https://gitlab.com/fscarmen/warp.git
synced 2026-06-15 03:25:42 +08:00
v3.1.2 Remove the function of generating licenses.
This commit is contained in:
@@ -20,9 +20,11 @@
|
||||
* * *
|
||||
|
||||
## 更新信息
|
||||
2024.7.25 menu.sh 3.1.1 / warp-go.sh v1.2.1 1. Support using the self-built WARP API at https://www.warpapi.us.kg/?run=pluskey to generate a 1920 PB WARP+ license for upgrading to a Plus account; 2. Client lacks sufficient support for WARP+, only able to use IPv4 and not IPv6; 3. Optimize the installer to further reduce script runtime; 1. 支持使用自建 warp api: https://www.warpapi.us.kg/?run=pluskey, 生成 1920 PB WARP+ license 升级为 Plus 账户; 2. Client 对 WARP+ 支持不够,只能使用 IPv4,不能使用 IPv6; 3. 优化安装程序,进一步缩短脚本运行时间
|
||||
2024.9.14 menu.sh v3.1.2 / warp-go.sh v1.2.2 1. Remove the function of generating licenses from the previous version because cloning Warp+ licenses is officially prohibited; 2. Remove unnecessary dependencies on python3; 1. 由于官方禁止了克隆 Warp+ license,故去掉上个版本生成 license 的功能; 2. 去掉不必要的依赖 python3
|
||||
|
||||
2024.7.18 menu.sh 3.1.0 / warp-go.sh v1.2.0 1. Use self-built warp api: https://www.warpapi.us.kg/ to upgrade to Teams account, no need to prepare Token in advance, only need to enter organization, email and verification code when the script is running to complete, the efficiency is greatly increased; 2. Because the Client's settings need to be set up in the Cloudflare dashboard, which can cause the vps to lose contact if not handled properly, the Client's is not upgraded to a Teams account, and the user can look up the information to set it up on their own; 1. 使用自建 warp api: https://www.warpapi.us.kg/ ,升级为 Teams 账户,不需要提前获取 Token,只须在脚本运行的时候输入组织名、邮箱和验证码即可完成,效率大增; 2. 由于 Client 的设置需要到 Cloudflare 控制后台设置,处理不好会导致 vps 失去联系,所以 Client 并没有升级为 Teams 账户的处理,用户可自行查资料设置
|
||||
2024.7.25 menu.sh v3.1.1 / warp-go.sh v1.2.1 1. Support using the self-built WARP API at https://www.warpapi.us.kg/?run=pluskey to generate a 1920 PB WARP+ license for upgrading to a Plus account; 2. Client lacks sufficient support for WARP+, only able to use IPv4 and not IPv6; 3. Optimize the installer to further reduce script runtime; 1. 支持使用自建 warp api: https://www.warpapi.us.kg/?run=pluskey, 生成 1920 PB WARP+ license 升级为 Plus 账户; 2. Client 对 WARP+ 支持不够,只能使用 IPv4,不能使用 IPv6; 3. 优化安装程序,进一步缩短脚本运行时间
|
||||
|
||||
2024.7.18 menu.sh v3.1.0 / warp-go.sh v1.2.0 1. Use self-built warp api: https://www.warpapi.us.kg/ to upgrade to Teams account, no need to prepare Token in advance, only need to enter organization, email and verification code when the script is running to complete, the efficiency is greatly increased; 2. Because the Client's settings need to be set up in the Cloudflare dashboard, which can cause the vps to lose contact if not handled properly, the Client's is not upgraded to a Teams account, and the user can look up the information to set it up on their own; 1. 使用自建 warp api: https://www.warpapi.us.kg/ ,升级为 Teams 账户,不需要提前获取 Token,只须在脚本运行的时候输入组织名、邮箱和验证码即可完成,效率大增; 2. 由于 Client 的设置需要到 Cloudflare 控制后台设置,处理不好会导致 vps 失去联系,所以 Client 并没有升级为 Teams 账户的处理,用户可自行查资料设置
|
||||
|
||||
<details>
|
||||
<summary>历史更新 history(点击即可展开或收起)</summary>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 当前脚本版本号
|
||||
VERSION='3.1.1'
|
||||
VERSION='3.1.2'
|
||||
|
||||
# 环境变量用于在Debian或Ubuntu操作系统中设置非交互式(noninteractive)安装模式
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
@@ -9,12 +9,12 @@ export DEBIAN_FRONTEND=noninteractive
|
||||
# Github 反代加速代理
|
||||
GH_PROXY='https://ghproxy.lvedong.eu.org/'
|
||||
|
||||
trap "rm -f /tmp/{wireguard-go-*,best_mtu,best_endpoint,endpoint,ip,license-tmp}; exit" INT
|
||||
trap "rm -f /tmp/{wireguard-go-*,best_mtu,best_endpoint,endpoint,ip}; exit" INT
|
||||
|
||||
E[0]="\n Language:\n 1. English (default) \n 2. 简体中文"
|
||||
C[0]="${E[0]}"
|
||||
E[1]="1. Support using the self-built WARP API at https://www.warpapi.us.kg/?run=pluskey to generate a 1920 PB WARP+ license for upgrading to a Plus account; 2. Client lacks sufficient support for WARP+, only able to use IPv4 and not IPv6; 3. Optimize the installer to further reduce script runtime."
|
||||
C[1]="1. 支持使用自建 warp api: https://www.warpapi.us.kg/?run=pluskey, 生成 1920 PB WARP+ license 升级为 Plus 账户; 2. Client 对 WARP+ 支持不够,只能使用 IPv4,不能使用 IPv6; 3. 优化安装程序,缩短脚本运行时间"
|
||||
E[1]="1. Remove the function of generating licenses from the previous version because cloning Warp+ licenses is officially prohibited; 2. Remove unnecessary dependencies on python3."
|
||||
C[1]="1. 由于官方禁止了克隆 Warp+ license,故去掉上个版本生成 license 的功能; 2. 去掉不必要的依赖 python3"
|
||||
E[2]="The script must be run as root, you can enter sudo -i and then download and run again. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
C[2]="必须以root方式运行脚本,可以输入 sudo -i 后重新下载运行,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[3]="The TUN module is not loaded. You should turn it on in the control panel. Ask the supplier for more help. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
@@ -67,12 +67,12 @@ E[26]="Curren operating system is \$SYS.\\\n The system lower than \$SYSTEM \${M
|
||||
C[26]="当前操作是 \$SYS\\\n 不支持 \$SYSTEM \${MAJOR[int]} 以下系统,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[27]="Local Socks5"
|
||||
C[27]="本地 Socks5"
|
||||
E[28]="If you have a WARP+ License, please input it. Otherwise, press Enter to use the key generated by the plusKey API:"
|
||||
C[28]="如果您有 WARP+ License,请输入;否则,请按 Enter 键使用由 plusKey API 生成的 license:"
|
||||
E[28]="If you have a WARP+ License, please input it:"
|
||||
C[28]="如果您有 WARP+ License,请输入:"
|
||||
E[29]="Input errors up to 5 times.The script is aborted."
|
||||
C[29]="输入错误达5次,脚本退出"
|
||||
E[30]="License should be 26 characters, please re-input WARP+ License. Otherwise, press Enter to use the key generated by the plusKey API. \(\${i} times remaining\):"
|
||||
C[30]="License 应为26位字符,请重新输入 WARP+ License,回车则使用 plusKey api 生成 的 key \(剩余\${i}次\):"
|
||||
E[30]="License should be 26 characters, please re-enter WARP+ License. Otherwise press Enter to continue. \(\${i} times remaining\):"
|
||||
C[30]="License 应为26位字符,请重新输入 WARP+ License,没有可回车继续\(剩余\${i}次\):"
|
||||
E[31]="The new \$KEY_LICENSE is the same as the one currently in use. Does not need to be replaced."
|
||||
C[31]="新输入的 \$KEY_LICENSE 与现使用中的一样,不需要更换。"
|
||||
E[32]="Step 1/3: Install dependencies..."
|
||||
@@ -133,8 +133,8 @@ E[59]="Cannot find the account file: /etc/wireguard/warp-account.conf, you can r
|
||||
C[59]="找不到账户文件:/etc/wireguard/warp-account.conf,可以卸载后重装,输入 WARP+ License"
|
||||
E[60]="Cannot find the configuration file: /etc/wireguard/warp.conf, you can reinstall with the WARP+ License"
|
||||
C[60]="找不到配置文件: /etc/wireguard/warp.conf,可以卸载后重装,输入 WARP+ License"
|
||||
E[61]="Please Input WARP+ license. Enter to use the key generated by the plusKey api:"
|
||||
C[61]="请输入WARP+ License,回车则使用 plusKey api 生成 的 key:"
|
||||
E[61]="Please Input WARP+ license:"
|
||||
C[61]="请输入WARP+ License:"
|
||||
E[62]="Successfully change to a WARP\$TYPE account"
|
||||
C[62]="已变更为 WARP\$TYPE 账户"
|
||||
E[63]="WARP+ quota"
|
||||
@@ -211,12 +211,12 @@ E[98]="Uninstall Wireproxy was complete."
|
||||
C[98]="Wireproxy 卸载成功"
|
||||
E[99]="WireProxy is connected"
|
||||
C[99]="WireProxy 已连接"
|
||||
E[100]="Generating Plus License..."
|
||||
C[100]="正在生成 Plus License...."
|
||||
E[100]="License should be 26 characters, please re-enter WARP+ License. Otherwise press Enter to continue. \(\${i} times remaining\): "
|
||||
C[100]="License 应为26位字符,请重新输入 WARP+ License \(剩余\${i}次\): "
|
||||
E[101]="Client support amd64 and arm64 only. Curren architecture \$ARCHITECTURE. Official Support List: [https://pkg.cloudflareclient.com/packages/cloudflare-warp]. The script is aborted. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
C[101]="Client 只支持 amd64 和 arm64 架构,当前架构 \$ARCHITECTURE,官方支持列表: [https://pkg.cloudflareclient.com/packages/cloudflare-warp]。脚本中止,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[102]="License: \$LICENSE\\\n Please customize the WARP+ device name \(Default is \$(hostname)\):"
|
||||
C[102]="License: \$LICENSE\\\n 请自定义 WARP+ 设备名 \(默认为 \$(hostname)\):"
|
||||
E[102]="Please customize the WARP+ device name \(Default is \$(hostname)\):"
|
||||
C[102]="请自定义 WARP+ 设备名 \(默认为 \$(hostname)\):"
|
||||
E[103]="Port \$PORT is in use. Please input another Port\(\${i} times remaining\):"
|
||||
C[103]="\$PORT 端口占用中,请使用另一端口\(剩余\${i}次\):"
|
||||
E[104]="Please customize the Client port (1000-65535. Default to 40000 if it is blank):"
|
||||
@@ -509,12 +509,12 @@ check_dependencies() {
|
||||
if [ "$SYSTEM" = 'Alpine' ]; then
|
||||
CHECK_WGET=$(wget 2>&1 | head -n 1)
|
||||
grep -qi 'busybox' <<< "$CHECK_WGET" && ${PACKAGE_INSTALL[int]} wget >/dev/null 2>&1
|
||||
DEPS_CHECK=("ping" "curl" "grep" "bash" "ip" "python3" "virt-what")
|
||||
DEPS_INSTALL=("iputils-ping" "curl" "grep" "bash" "iproute2" "python3" "virt-what")
|
||||
DEPS_CHECK=("ping" "curl" "grep" "bash" "ip" "virt-what")
|
||||
DEPS_INSTALL=("iputils-ping" "curl" "grep" "bash" "iproute2" "virt-what")
|
||||
else
|
||||
# 对于三大系统需要的依赖
|
||||
DEPS_CHECK=("ping" "wget" "curl" "systemctl" "ip" "python3")
|
||||
DEPS_INSTALL=("iputils-ping" "wget" "curl" "systemctl" "iproute2" "python3")
|
||||
DEPS_CHECK=("ping" "wget" "curl" "systemctl" "ip")
|
||||
DEPS_INSTALL=("iputils-ping" "wget" "curl" "systemctl" "iproute2")
|
||||
fi
|
||||
|
||||
for g in "${!DEPS_CHECK[@]}"; do
|
||||
@@ -619,18 +619,9 @@ warp_api(){
|
||||
|
||||
curl -m5 -sL "https://${WARP_API_URL}/?run=token&organization=${TEAM_ORGANIZATION}&A=${A}&S=${S}&N=${N}&code=${TEAM_CODE}"
|
||||
;;
|
||||
pluskey )
|
||||
curl -m20 --retry 3 -sL "https://${WARP_API_URL}/?run=pluskey"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# 通过 warp api 生成 plusKey
|
||||
generate_pluskey() {
|
||||
local FILE_PATH="$1"
|
||||
[ -n "$FILE_PATH" ] && warp_api pluskey | awk -F '"' '/licenseCode/{print $4}' > $FILE_PATH || warp_api pluskey | awk -F '"' '/licenseCode/{print $4}'
|
||||
}
|
||||
|
||||
# 聚合 IP api 函数。由于 ip.sb 会对某些 ip 访问报 error code: 1015,所以使用备用 IP api: ifconfig.co
|
||||
ip_info() {
|
||||
local CHECK_46="$1"
|
||||
@@ -1240,7 +1231,7 @@ uninstall() {
|
||||
|
||||
# 删除本脚本安装在 /etc/wireguard/ 下的所有文件,如果删除后目录为空,一并把目录删除
|
||||
rm -f /usr/bin/wg-quick.{origin,reserved}
|
||||
rm -f /tmp/{best_mtu,best_endpoint,wireguard-go-*,license-tmp}
|
||||
rm -f /tmp/{best_mtu,best_endpoint,wireguard-go-*}
|
||||
rm -f /etc/wireguard/{wgcf-account.conf,warp-temp.conf,warp-account.conf,warp_unlock.sh,warp.conf.bak,warp.conf,up,proxy.conf.bak,proxy.conf,menu.sh,license,language,info-temp.log,info.log,down,account-temp.conf,NonGlobalUp.sh,NonGlobalDown.sh}
|
||||
[[ -e /etc/wireguard && -z "$(ls -A /etc/wireguard/)" ]] && rmdir /etc/wireguard
|
||||
|
||||
@@ -1668,20 +1659,10 @@ rule_del() {
|
||||
input_license() {
|
||||
local WARP_OR_CLIENT="$1"
|
||||
[ -z "$LICENSE" ] && reading " $(text 28) " LICENSE
|
||||
if [ -z "$LICENSE" ]; then
|
||||
hint " $(text 100) "
|
||||
wait
|
||||
[ -s /tmp/license-tmp ] && LICENSE=$(cat /tmp/license-tmp) && rm -f /tmp/license-tmp
|
||||
fi
|
||||
i=5
|
||||
until [[ "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
|
||||
until [[ -z "$LICENSE" || "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
|
||||
(( i-- )) || true
|
||||
[ "$i" = 0 ] && error " $(text 29) " || reading " $(text 30) " LICENSE
|
||||
if [ -z "$LICENSE" ]; then
|
||||
hint " $(text 100) "
|
||||
wait
|
||||
[ -s /tmp/license-tmp ] && LICENSE=$(cat /tmp/license-tmp) && rm -f /tmp/license-tmp
|
||||
fi
|
||||
done
|
||||
if [ "$WARP_OR_CLIENT" = is_warp ]; then
|
||||
[[ -n "$LICENSE" && -z "$NAME" ]] && reading " $(text 102) " NAME
|
||||
@@ -1772,16 +1753,10 @@ input_url_token() {
|
||||
# 升级 WARP+ 账户(如有),限制位数为空或者26位以防输入错误,WARP interface 可以自定义设备名(不允许字符串间有空格,如遇到将会以_代替)
|
||||
update_license() {
|
||||
[ -z "$LICENSE" ] && reading " $(text 61) " LICENSE
|
||||
hint " $(text 100) "
|
||||
wait
|
||||
[ -z "$LICENSE" ] && [ -s /tmp/license-tmp ] && LICENSE=$(cat /tmp/license-tmp) && rm -f /tmp/license-tmp
|
||||
i=5
|
||||
until [[ "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
|
||||
(( i-- )) || true
|
||||
[ "$i" = 0 ] && error " $(text 29) " || reading " $(text 30) " LICENSE
|
||||
hint " $(text 100) "
|
||||
wait
|
||||
[ -z "$LICENSE" ] && [ -s /tmp/license-tmp ] && LICENSE=$(cat /tmp/license-tmp) && rm -f /tmp/license-tmp
|
||||
done
|
||||
[[ -z "$CLIENT_ACCOUNT" && "$CHOOSE_TYPE" = 2 && -n "$LICENSE" && -z "$NAME" ]] && reading " $(text 102) " NAME
|
||||
[ -n "$NAME" ] && NAME="${NAME//[[:space:]]/_}" || NAME=${NAME:-"$(hostname)"}
|
||||
@@ -3263,9 +3238,6 @@ fi
|
||||
# 自定义 WARP+ 设备名
|
||||
NAME=$3
|
||||
|
||||
# 后台生成 plus key
|
||||
{ generate_pluskey /tmp/license-tmp; }&
|
||||
|
||||
# 主程序运行 1/3
|
||||
|
||||
check_cdn
|
||||
|
||||
+27
-55
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# 当前脚本版本号和新增功能
|
||||
VERSION='1.2.1'
|
||||
VERSION='1.2.2'
|
||||
|
||||
# 判断 Teams token 最少字符数
|
||||
TOKEN_LENGTH=800
|
||||
@@ -16,8 +16,8 @@ trap "rm -f /tmp/warp-go*; exit" INT
|
||||
|
||||
E[0]="Language:\n 1.English (default) \n 2.简体中文"
|
||||
C[0]="${E[0]}"
|
||||
E[1]="1. Support using the self-built WARP API at https://www.warpapi.us.kg/?run=pluskey to generate a 1920 PB WARP+ license for upgrading to a Plus account; 2. Client lacks sufficient support for WARP+, only able to use IPv4 and not IPv6; 3. Optimize the installer to further reduce script runtime."
|
||||
C[1]="1. 支持使用自建 warp api: https://www.warpapi.us.kg/?run=pluskey, 生成 1920 PB WARP+ license 升级为 Plus 账户; 2. Client 对 WARP+ 支持不够,只能使用 IPv4,不能使用 IPv6; 3. 优化安装程序,缩短脚本运行时间"
|
||||
E[1]="1. Remove the function of generating licenses from the previous version because cloning Warp+ licenses is officially prohibited; 2. Remove unnecessary dependencies on python3."
|
||||
C[1]="1. 由于官方禁止了克隆 Warp+ license,故去掉上个版本生成 license 的功能; 2. 去掉不必要的依赖 python3"
|
||||
E[2]="warp-go h (help)\n warp-go o (temporary warp-go switch)\n warp-go u (uninstall WARP web interface and warp-go)\n warp-go v (sync script to latest version)\n warp-go i (replace IP with Netflix support)\n warp-go 4/6 ( WARP IPv4/IPv6 single-stack)\n warp-go d (WARP dual-stack)\n warp-go n (WARP IPv4 non-global)\n warp-go g (WARP global/non-global switching)\n warp-go e (output wireguard and sing-box configuration file)\n warp-go a (Change to Free, WARP+ or Teams account)"
|
||||
C[2]="warp-go h (帮助)\n warp-go o (临时 warp-go 开关)\n warp-go u (卸载 WARP 网络接口和 warp-go)\n warp-go v (同步脚本至最新版本)\n warp-go i (更换支持 Netflix 的IP)\n warp-go 4/6 (WARP IPv4/IPv6 单栈)\n warp-go d (WARP 双栈)\n warp-go n (WARP IPv4 非全局)\n warp-go g (WARP 全局 / 非全局相互切换)\n warp-go e (输出 wireguard 和 sing-box 配置文件)\n warp-go a (更换到 Free,WARP+ 或 Teams 账户)"
|
||||
E[3]="This project is designed to add WARP network interface for VPS, using warp-go core, using various interfaces of CloudFlare-WARP, integrated wireguard-go, can completely replace WGCF. Save Hong Kong, Toronto and other VPS, can also get WARP IP. Thanks again @CoiaPrant and his team. Project address: https://gitlab.com/ProjectWARP/warp-go/-/tree/master/"
|
||||
@@ -90,18 +90,18 @@ E[36]="The TUN module is not loaded. You should turn it on in the control panel.
|
||||
C[36]="没有加载 TUN 模块,请在管理后台开启或联系供应商了解如何开启,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[37]="Curren architecture \$(uname -m) is not supported. Feedback: [https://github.com/fscarmen/warp-sh/issues]"
|
||||
C[37]="当前架构 \$(uname -m) 暂不支持,问题反馈:[https://github.com/fscarmen/warp-sh/issues]"
|
||||
E[38]="If you have a WARP+ License, please input it. Otherwise, press Enter to use the key generated by the plusKey API:"
|
||||
C[38]="如果您有 WARP+ License,请输入;否则,请按 Enter 键使用由 plusKey API 生成的 license:"
|
||||
E[38]="If there is a WARP+ License, please enter it, otherwise press Enter to continue:"
|
||||
C[38]="如有 WARP+ License 请输入,没有可回车继续:"
|
||||
E[39]="Input errors up to 5 times.The script is aborted."
|
||||
C[39]="输入错误达5次,脚本退出"
|
||||
E[40]="License should be 26 characters, please re-input WARP+ License. Otherwise, press Enter to use the key generated by the plusKey API. \(\${i} times remaining\):"
|
||||
C[40]="License 应为26位字符,请重新输入 WARP+ License,回车则使用 plusKey api 生成 的 key \(剩余\${i}次\):"
|
||||
E[40]="License should be 26 characters, please re-enter WARP+ License. Otherwise press Enter to continue. \(\${i} times remaining\):"
|
||||
C[40]="License 应为26位字符,请重新输入 WARP+ License,没有可回车继续\(剩余\${i}次\):"
|
||||
E[41]="Please customize the device name (Default is [warp-go] if left blank):"
|
||||
C[41]="请自定义设备名 (如果不输入,默认为 [warp-go]):"
|
||||
E[42]="Please Input WARP+ license. Enter to use the key generated by the plusKey api:"
|
||||
C[42]="请输入WARP+ License,回车则使用 plusKey api 生成 的 key:"
|
||||
E[43]="Generating Plus License..."
|
||||
C[43]="正在生成 Plus License...."
|
||||
E[42]="Please Input WARP+ license:"
|
||||
C[42]="请输入WARP+ License:"
|
||||
E[43]="License should be 26 characters, please re-enter WARP+ License. Otherwise press Enter to continue. \(\${i} times remaining\): "
|
||||
C[43]="License 应为26位字符,请重新输入 WARP+ License \(剩余\${i}次\): "
|
||||
E[44]="Your organization"
|
||||
C[44]="组织名:"
|
||||
E[45]="Token error, please re-enter Teams token \(remaining \${i} times\):"
|
||||
@@ -379,13 +379,13 @@ check_arch() {
|
||||
check_dependencies() {
|
||||
# 对于 Alpine 和 OpenWrt 系统,升级库并重新安装依赖
|
||||
if [[ "$SYSTEM" =~ Alpine|OpenWrt ]]; then
|
||||
DEPS_CHECK=("ping" "curl" "wget" "grep" "bash" "ip" "python3" "tar" "virt-what")
|
||||
DEPS_INSTALL=("iputils-ping" "curl" "wget" "grep" "bash" "iproute2" "python3" "tar" "virt-what")
|
||||
DEPS_CHECK=("ping" "curl" "wget" "grep" "bash" "ip" "tar" "virt-what")
|
||||
DEPS_INSTALL=("iputils-ping" "curl" "wget" "grep" "bash" "iproute2" "tar" "virt-what")
|
||||
else
|
||||
# 对于三大系统需要的依赖
|
||||
[ "${SYSTEM}" = 'CentOS' ] && ${PACKAGE_INSTALL[int]} vim-common
|
||||
DEPS_CHECK=("ping" "wget" "curl" "systemctl" "ip" "python3")
|
||||
DEPS_INSTALL=("iputils-ping" "wget" "curl" "systemctl" "iproute2" "python3")
|
||||
DEPS_CHECK=("ping" "wget" "curl" "systemctl" "ip")
|
||||
DEPS_INSTALL=("iputils-ping" "wget" "curl" "systemctl" "iproute2")
|
||||
fi
|
||||
|
||||
for c in "${!DEPS_CHECK[@]}"; do
|
||||
@@ -401,12 +401,6 @@ check_dependencies() {
|
||||
PING6='ping -6' && [ $(type -p ping6) ] && PING6='ping6'
|
||||
}
|
||||
|
||||
# 通过 warp api 生成 plusKey
|
||||
generate_pluskey() {
|
||||
local FILE_PATH="$1"
|
||||
[ -n "$FILE_PATH" ] && warp_api pluskey | awk -F '"' '/licenseCode/{print $4}' > $FILE_PATH || warp_api pluskey | awk -F '"' '/licenseCode/{print $4}'
|
||||
}
|
||||
|
||||
# 获取 warp 账户信息
|
||||
warp_api(){
|
||||
local WARP_API_URL="www.warpapi.us.kg"
|
||||
@@ -494,9 +488,6 @@ warp_api(){
|
||||
|
||||
curl -m5 -sL "https://${WARP_API_URL}/?run=token&organization=${TEAM_ORGANIZATION}&A=${A}&S=${S}&N=${N}&code=${TEAM_CODE}"
|
||||
;;
|
||||
pluskey )
|
||||
curl -m20 --retry 3 -sL "https://${WARP_API_URL}/?run=pluskey"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
@@ -1059,7 +1050,7 @@ check_system_info() {
|
||||
info " $(text 35) "
|
||||
|
||||
# 由于 warp-go 内置了 wireguard-go ,而 wireguard-go 运行时会先判断 tun 设备,如果文件不存在,则马上退出
|
||||
[ ! -e /dev/net/tun ] && error "$(text 36)"
|
||||
[ ! -e /dev/net/tun ] && error " $(text 36) "
|
||||
|
||||
# 必须加载 TUN 模块,先尝试在线打开 TUN。尝试成功放到启动项,失败作提示并退出脚本
|
||||
TUN=$(cat /dev/net/tun 2>&1 | tr 'A-Z' 'a-z')
|
||||
@@ -1075,7 +1066,7 @@ EOF
|
||||
bash /opt/warp-go/tun.sh
|
||||
TUN=$(cat /dev/net/tun 2>&1 | tr 'A-Z' 'a-z')
|
||||
if [[ ! "$TUN" =~ 'in bad state'|'处于错误状态' ]]; then
|
||||
rm -f /opt/warp-go/tun.sh && error "$(text 36)"
|
||||
rm -f /opt/warp-go/tun.sh && error " $(text 36) "
|
||||
else
|
||||
chmod +x /opt/warp-go/tun.sh
|
||||
echo "$SYSTEM" | grep -qvE "Alpine|OpenWrt" && echo "@reboot root bash /opt/warp-go/tun.sh" >> /etc/crontab
|
||||
@@ -1154,40 +1145,24 @@ best_endpoint() {
|
||||
# 输入 WARP+ 账户(如有),限制位数为空或者26位以防输入错误
|
||||
input_license() {
|
||||
[ -z "$LICENSE" ] && reading " $(text 38) " LICENSE
|
||||
if [ -z "$LICENSE" ]; then
|
||||
hint " $(text 43) "
|
||||
wait
|
||||
[ -s /tmp/warp-go-license ] && LICENSE=$(cat /tmp/warp-go-license) && rm -f /tmp/warp-go-license
|
||||
fi
|
||||
i=5
|
||||
until [[ "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
|
||||
until [[ -z "$LICENSE" || "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
|
||||
(( i-- )) || true
|
||||
[ "$i" = 0 ] && error "$(text 39)" || reading " $(text_eval 40) " LICENSE
|
||||
if [ -z "$LICENSE" ]; then
|
||||
hint " $(text 43) "
|
||||
wait
|
||||
[ -s /tmp/warp-go-license ] && LICENSE=$(cat /tmp/warp-go-license) && rm -f /tmp/warp-go-license
|
||||
fi
|
||||
[ "$i" = 0 ] && error " $(text 39) " || reading " $(text_eval 40) " LICENSE
|
||||
done
|
||||
[[ -n "$LICENSE" && -z "$NAME" ]] && hint " WARP+ license: $LICENSE " && reading " $(text 41) " NAME
|
||||
[[ -n "$LICENSE" && -z "$NAME" ]] && reading " $(text 41) " NAME
|
||||
[ -n "$NAME" ] && NAME="${NAME//[[:space:]]/_}" || NAME="${NAME:-warp-go}"
|
||||
}
|
||||
|
||||
# 升级 WARP+ 账户(如有),限制位数为空或者26位以防输入错误,WARP interface 可以自定义设备名(不允许字符串间有空格,如遇到将会以_代替)
|
||||
update_license() {
|
||||
[ -z "$LICENSE" ] && reading " $(text 42) " LICENSE
|
||||
hint " $(text 43) "
|
||||
wait
|
||||
[ -z "$LICENSE" ] && [ -s /tmp/warp-go-license ] && LICENSE=$(cat /tmp/warp-go-license) && rm -f /tmp/warp-go-license
|
||||
i=5
|
||||
until [[ "$LICENSE" =~ ^[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}-[A-Z0-9a-z]{8}$ ]]; do
|
||||
(( i-- )) || true
|
||||
[ "$i" = 0 ] && error "$(text 39)" || reading " $(text_eval 40) " LICENSE
|
||||
hint " $(text 43) "
|
||||
wait
|
||||
[ -z "$LICENSE" ] && [ -s /tmp/warp-go-license ] && LICENSE=$(cat /tmp/warp-go-license) && rm -f /tmp/warp-go-license
|
||||
[ "$i" = 0 ] && error " $(text 39) " || reading " $(text_eval 43) " LICENSE
|
||||
done
|
||||
[[ -n "$LICENSE" && -z "$NAME" ]] && hint " WARP+ license: $LICENSE " && reading " $(text 41) " NAME
|
||||
[[ -n "$LICENSE" && -z "$NAME" ]] && reading " $(text 41) " NAME
|
||||
[ -n "$NAME" ] && NAME="${NAME//[[:space:]]/_}" || NAME="${NAME:-warp-go}"
|
||||
}
|
||||
|
||||
@@ -1227,7 +1202,7 @@ get_token() {
|
||||
# 免费 WARP 账户升级 WARP+ 或 Teams 账户
|
||||
update() {
|
||||
need_install
|
||||
[ ! -s /opt/warp-go/warp.conf ] && error "$(text 21)"
|
||||
[ ! -s /opt/warp-go/warp.conf ] && error " $(text 21) "
|
||||
|
||||
ACCOUNT_TYPE=$(grep "Type" /opt/warp-go/warp.conf | cut -d= -f2 | sed "s# ##g")
|
||||
case "$ACCOUNT_TYPE" in
|
||||
@@ -1309,7 +1284,7 @@ export_file() {
|
||||
/opt/warp-go/warp-go --config=/opt/warp-go/warp.conf --export-wireguard=/opt/warp-go/wgcf.conf >/dev/null 2>&1
|
||||
/opt/warp-go/warp-go --config=/opt/warp-go/warp.conf --export-singbox=/opt/warp-go/singbox.json >/dev/null 2>&1
|
||||
else
|
||||
error "$(text 51)"
|
||||
error " $(text 51) "
|
||||
fi
|
||||
|
||||
info "\n $(text 52) "
|
||||
@@ -1324,7 +1299,7 @@ export_file() {
|
||||
# warp-go 安装
|
||||
install() {
|
||||
# 已经状态码不为 0, 即已安装, 脚本退出
|
||||
[ "$STATUS" != 0 ] && error "$(text 53)"
|
||||
[ "$STATUS" != 0 ] && error " $(text 53) "
|
||||
|
||||
# CONF 参数如果不是3位或4位, 即检测不出正确的配置参数, 脚本退出
|
||||
[[ "${#CONF}" != [34] ]] && error " $(text 10) "
|
||||
@@ -1354,8 +1329,8 @@ install() {
|
||||
{
|
||||
mkdir -p /opt/warp-go/ >/dev/null 2>&1
|
||||
wait
|
||||
[ ! -s /tmp/warp-go ] && error "$(text 56)" || mv -f /tmp/warp-go /opt/warp-go/
|
||||
[ ! -s /opt/warp-go/warp-go ] && error "$(text 57)"
|
||||
[ ! -s /tmp/warp-go ] && error " $(text 56) " || mv -f /tmp/warp-go /opt/warp-go/
|
||||
[ ! -s /opt/warp-go/warp-go ] && error " $(text 57) "
|
||||
|
||||
# 注册用户自定义 token 的 Teams 账户
|
||||
if [ "$LICENSE_TYPE" = 2 ]; then
|
||||
@@ -1650,9 +1625,6 @@ fi
|
||||
# 自定义 WARP+ 设备名
|
||||
NAME="$3"
|
||||
|
||||
# 后台生成 plus key
|
||||
{ generate_pluskey /tmp/warp-go-license; }&
|
||||
|
||||
# 主程序运行 1/3
|
||||
check_cdn
|
||||
statistics_of_run-times
|
||||
|
||||
Reference in New Issue
Block a user