mirror of
https://gitlab.com/fscarmen/warp.git
synced 2026-06-25 15:42:40 +08:00
Update t.sh
Former-commit-id: 0a603ffc07fc51437860a92e5302b90fa6d2108f
This commit is contained in:
@@ -43,7 +43,7 @@ modify5='sed -i "7 s/^/PostUp = ip -4 rule add from $(ip route get 114.114.114.1
|
||||
# VPS 当前状态
|
||||
function status(){
|
||||
clear
|
||||
yellow "本项目专为 VPS 添加 wgcf 网络接口,详细说明:https://github.com/fscarmen/warp\n脚本特点:\n * 根据不同系统综合情况显示不同的菜单,避免出错\n * 结合 Linux 版本和虚拟化方式,自动优选三个 WireGuard 方案。网络性能方面:内核集成 WireGuard>安装内核模块>wireguard-go\n * 智能判断 WGCF 作者 github库的最新版本 (Latest release\n * 智能判断vps操作系统:Ubuntu 18.04、Ubuntu 20.04、Debian 10、Debian 11、CentOS 7、CentOS 8,请务必选择 LTS 系统\n * 智能判断硬件结构类型:Architecture 为 AMD 或者 ARM\n * 智能分析内网和公网IP生成 WGCF 配置文件\n * 结束后会有结果提示,并自动清理安装时的临时文件\n"
|
||||
yellow "本项目专为 VPS 添加 wgcf 网络接口,详细说明:https://github.com/fscarmen/warp\n脚本特点:\n * 根据不同系统综合情况显示不同的菜单,避免出错\n * 结合 Linux 版本和虚拟化方式,自动优选三个 WireGuard 方案。网络性能方面:内核集成 WireGuard>安装内核模块>wireguard-go\n * 智能判断 WGCF 作者 github库的最新版本 (Latest release\n * 智能判断vps操作系统:Ubuntu 18.04、Ubuntu 20.04、Debian 10、Debian 11、CentOS 7、CentOS 8,请务必选择 LTS 系统\n * 智能判断硬件结构类型:Architecture 为 AMD 或者 ARM\n * 智能分析内网和公网IP生成 WGCF 配置文件\n * 输出结果,提示是否使用 WARP IP ,并自动清理安装时的临时文件\n"
|
||||
red "======================================================================================================================\n"
|
||||
green " 系统信息:\n 当前操作系统:$(hostnamectl | grep -i operating | awk -F ':' '{print $2}')\n 内核:$(uname -r)\n 处理器架构:$architecture\n 虚拟化:$(hostnamectl | grep -i virtualization | awk -F ': ' '{print $2}') "
|
||||
[[ $(wget -qO- -4 https://www.cloudflare.com/cdn-cgi/trace | grep warp=on) ]] && green " IPv4:$(wget -T1 -t1 -qO- -4 ip.gs) ( WARP IPv4 ) " || green " IPv4:$(wget -T1 -t1 -qO- -4 ip.gs) "
|
||||
@@ -59,11 +59,11 @@ function install(){
|
||||
|
||||
# 先删除之前安装,可能导致失败的文件
|
||||
rm -f /usr/local/bin/wgcf /etc/wireguard/wgcf.conf /usr/bin/wireguard-go wgcf-account.toml wgcf-profile.conf
|
||||
|
||||
|
||||
# 判断系统,安装差异部分,安装依赖
|
||||
# Debian 运行以下脚本
|
||||
if [[ $(hostnamectl | tr A-Z a-z ) =~ debian ]]; then
|
||||
|
||||
|
||||
# 更新源
|
||||
apt -y update
|
||||
|
||||
@@ -127,10 +127,10 @@ function install(){
|
||||
|
||||
# 添加执行权限
|
||||
chmod +x /usr/local/bin/wgcf
|
||||
|
||||
|
||||
# 如是 lXC,安装 wireguard-go
|
||||
[[ $virtualization == 1 ]] && wget -N --no-check-certificate -P /usr/bin https://cdn.jsdelivr.net/gh/fscarmen/warp/wireguard-go && chmod +x /usr/bin/wireguard-go
|
||||
|
||||
|
||||
# 注册 WARP 账户 (将生成 wgcf-account.toml 文件保存账户信息,为避免文件已存在导致出错,先尝试删掉原文件)
|
||||
rm -f wgcf-account.toml
|
||||
yellow " WGCF 注册中…… "
|
||||
@@ -162,7 +162,7 @@ function install(){
|
||||
systemctl enable wg-quick@wgcf >/dev/null 2>&1
|
||||
|
||||
# 优先使用 IPv4 网络
|
||||
if [[ -e /etc/gai.conf ]]; then grep -qE '^[ ]*precedence[ ]*::ffff:0:0/96[ ]*100' /etc/gai.conf || echo 'precedence ::ffff:0:0/96 100' | tee -a /etc/gai.conf >/dev/null 2>&1; fi
|
||||
[[ -e /etc/gai.conf ]] && [[ -n $(grep '^[ ]*precedence[ ]*::ffff:0:0/96[ ]*100' /etc/gai.conf) ]] || echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf
|
||||
|
||||
# 结果提示
|
||||
endTime_s=`date +%s`
|
||||
|
||||
Reference in New Issue
Block a user