|
@@ -36,7 +36,8 @@ setport(){
|
|
|
|
|
|
# Display Client Configuration and Mobile Phone QR code
|
|
|
conf_QRcode(){
|
|
|
- echo -e "${Yellow}:: 显示客户端配置和手机二维码 (默认2号),请输入数字${Font}\c"
|
|
|
+ echo -e "${Yellow}:: Display Client Configuration and Mobile Phone QR_code."
|
|
|
+ echo -e "Please Enter the Number${Font}\c"
|
|
|
read -p "(2-9): " x
|
|
|
|
|
|
if [[ ${x} -ge 2 ]] && [[ ${x} -le 9 ]]; then
|
|
@@ -46,13 +47,13 @@ conf_QRcode(){
|
|
|
fi
|
|
|
|
|
|
host=$(hostname -s)
|
|
|
- echo -e "${SkyBlue}:: 客户端配置文件: wg_${host}_$i.conf ${Font}"
|
|
|
+ echo -e "${SkyBlue}:: Client Configuration: wg_${host}_$i.conf ${Font}"
|
|
|
cat /etc/wireguard/wg_${host}_$i.conf
|
|
|
- echo -e "${SkyBlue}:: 请使用组合键 Ctrl+Ins 复制文本给Windows客户端使用${Font}"
|
|
|
+ echo -e "${SkyBlue}:: Please use the key combination Ctrl+Ins to copy the text to the Windows client.${Font}"
|
|
|
cat /etc/wireguard/wg_${host}_$i.conf | qrencode -o - -t UTF8
|
|
|
- echo -e "${Green}:: 配置文件: wg_${host}_$i.conf 生成二维码,请用手机客户端扫描使用${Font}"
|
|
|
+ echo -e "${Green}:: Client Config: wg_${host}_$i.conf Generate QR code, Please use the mobile client to scan.${Font}"
|
|
|
|
|
|
- echo -e "${SkyBlue}:: 安卓手机WireGuard官方APP目前支持纯IPV6连接,是否显示IPV6二维码?${Font}\c"
|
|
|
+ echo -e "${SkyBlue}:: Mobile Phone WireGuard APP Support pure IPV6 connection, Whether to display IPV6 QR code?${Font}\c"
|
|
|
read -p "(Y/N): " key
|
|
|
case $key in
|
|
|
Y)
|
|
@@ -62,11 +63,9 @@ conf_QRcode(){
|
|
|
ipv6_QRcode $i
|
|
|
;;
|
|
|
esac
|
|
|
-
|
|
|
- echo -e "${SkyBlue}:: SSH工具推荐Git-Bash 2.20; GCP_SSH(浏览器)字体Courier New 二维码正常${Font}"
|
|
|
}
|
|
|
|
|
|
-# 显示IPV6手机客户端二维码
|
|
|
+# Display IPV6 QR code
|
|
|
ipv6_QRcode(){
|
|
|
if [[ $# > 0 ]]; then
|
|
|
i="$1"
|
|
@@ -74,10 +73,10 @@ ipv6_QRcode(){
|
|
|
get_serverip
|
|
|
serveripv6=$(curl -6 ip.sb)
|
|
|
if [[ -z $serveripv6 ]]; then
|
|
|
- echo -e "${Red}:: 获取IPV6地址不正确,你的服务器可能没有IPV6网络支持!${Font}"
|
|
|
+ echo -e "${Red}:: Get IPV6 address is incorrect, Your Server may not have IPV6 network support!${Font}"
|
|
|
else
|
|
|
cat /etc/wireguard/wg_${host}_$i.conf | sed "s/${serverip}/[${serveripv6}]/g" | qrencode -o - -t UTF8
|
|
|
- echo -e "${Green}:: IPV6地址: [${serveripv6}] 请确认服务器和本地网络支持IPV6!${Font}"
|
|
|
+ echo -e "${Green}:: IPV6 Addr: [${serveripv6}] Please confirm server and local network support IPV6!${Font}"
|
|
|
fi
|
|
|
}
|
|
|
|
|
@@ -89,15 +88,14 @@ get_serverip(){
|
|
|
ipv6_range="fd08:620c:4df0:65eb::"
|
|
|
}
|
|
|
|
|
|
-# 重置 WireGuard 客户端配置和数量
|
|
|
+# Reset WireGuard All Client Peer
|
|
|
wg_clients(){
|
|
|
- echo -e "${Red}:: 注意原来的客户端配置都会删除,按 Ctrl+ C 可以紧急撤销 ${Font}"
|
|
|
+ echo -e "${Red}:: Warning: The original client configuration will be deleted, press Ctrl+C to revoke urgently. ${Font}"
|
|
|
|
|
|
- # 转到wg配置文件目录
|
|
|
cd /etc/wireguard
|
|
|
cp wg0.conf conf.wg0.bak
|
|
|
|
|
|
- echo -e "${SkyBlue}:: 输入客户端Peer总数${Font}\c"
|
|
|
+ echo -e "${SkyBlue}:: Enter the total number of client Peers${Font}\c"
|
|
|
read -p "(2--200): " num_x
|
|
|
|
|
|
if [[ ${num_x} -ge 2 ]] && [[ ${num_x} -le 200 ]]; then
|
|
@@ -106,20 +104,20 @@ wg_clients(){
|
|
|
num_x=3
|
|
|
fi
|
|
|
|
|
|
- # 服务器 IP 和 端口
|
|
|
+ # Server IP and Port
|
|
|
port=$(wg show wg0 listen-port) && host=$(hostname -s)
|
|
|
get_serverip
|
|
|
|
|
|
- # 删除原配置,让IP和ID号对应; 保留原来服务器的端口等配置
|
|
|
+ # Delete the original configuration, let the IP and ID numbers correspond; retain the configuration of the original server port, etc.
|
|
|
rm /etc/wireguard/wg_${host}_* >/dev/null 2>&1
|
|
|
line_num=$(cat -n wg0.conf | grep 'AllowedIPs' | head -n 1 | awk '{print $1}')
|
|
|
head -n ${line_num} conf.wg0.bak > wg0.conf
|
|
|
|
|
|
- # 重启wg服务器
|
|
|
+ # restart WG server
|
|
|
wg-quick down wg0 >/dev/null 2>&1
|
|
|
wg-quick up wg0 >/dev/null 2>&1
|
|
|
|
|
|
- # 重新生成用户配置数量
|
|
|
+ # Reset WireGuard All Client Peer
|
|
|
for i in `seq 2 200`
|
|
|
do
|
|
|
ip=10.0.0.${i}
|
|
@@ -147,20 +145,19 @@ EOF
|
|
|
wg-quick save wg0
|
|
|
clear && display_peer
|
|
|
cat /etc/wireguard/wg_${host}_2.conf
|
|
|
- echo -e "${SkyBlue}:: 使用${GreenBG} bash wg5 ${SkyBlue}命令,可以临时网页下载配置和二维码${Font}"
|
|
|
}
|
|
|
|
|
|
-# 安装 WireGuard+Speeder+Udp2Raw 和 SS+Kcp+Udp2RAW 配置
|
|
|
+# WireGuard+Speeder+Udp2Raw and SS+Kcp+Udp2RAW Automated Configuration
|
|
|
ss_kcp_udp2raw_wg_speed(){
|
|
|
- # 下载/编译 shadowsocks-libev
|
|
|
+ # install shadowsocks-libev
|
|
|
wget -qO- git.io/fhExJ | bash
|
|
|
|
|
|
wget -O ~/ss_wg_set_raw git.io/fpKnF >/dev/null 2>&1
|
|
|
- bash ~/ss_wg_set_raw
|
|
|
+ bash ~/ss_wg_set_raw english
|
|
|
rm ~/ss_wg_set_raw
|
|
|
}
|
|
|
|
|
|
-# 定义文字颜色
|
|
|
+# Definition Display Text Color
|
|
|
Green="\033[32m" && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m"
|
|
|
Font="\033[0m" && Yellow="\033[0;33m" && SkyBlue="\033[0;36m"
|
|
|
|
|
@@ -183,33 +180,33 @@ safe_iptables(){
|
|
|
wget -qO safe_iptables.sh git.io/fhUSe && bash safe_iptables.sh
|
|
|
}
|
|
|
|
|
|
-# 更新wgmtu脚本
|
|
|
+# Get WireGuard Management Command : bash wgmtu
|
|
|
update_self(){
|
|
|
- # Get WireGuard Management Command : bash wgmtu
|
|
|
+
|
|
|
wget -O ~/wgmtu https://raw.githubusercontent.com/hongwenjun/vps_setup/english/wgmtu.sh
|
|
|
}
|
|
|
|
|
|
-# 更新 WireGuard
|
|
|
+# update WireGuard
|
|
|
wireguard_update(){
|
|
|
yum update -y wireguard-dkms wireguard-tools >/dev/null 2>&1
|
|
|
apt update -y wireguard-dkms wireguard-tools >/dev/null 2>&1
|
|
|
- echo -e "${RedBG} 更新完成 ${Font}"
|
|
|
+ echo -e "${RedBG} Updated! ${Font}"
|
|
|
}
|
|
|
-# 卸载 WireGuard
|
|
|
+# remove WireGuard
|
|
|
wireguard_remove(){
|
|
|
wg-quick down wg0
|
|
|
yum remove -y wireguard-dkms wireguard-tools >/dev/null 2>&1
|
|
|
apt remove -y wireguard-dkms wireguard-tools >/dev/null 2>&1
|
|
|
rm -rf /etc/wireguard/
|
|
|
- echo -e "${RedBG} 卸载完成 ${Font}"
|
|
|
+ echo -e "${RedBG} Removed! ${Font}"
|
|
|
}
|
|
|
|
|
|
-# 更新/安装 UDP2RAW KCPTUN UDPspeeder 工具
|
|
|
+# update/install UDP2RAW KCPTUN UDPspeeder
|
|
|
udp2raw_update()
|
|
|
{
|
|
|
systemctl stop rc-local
|
|
|
|
|
|
- # 下载 UDP2RAW
|
|
|
+ # download UDP2RAW
|
|
|
udp2raw_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/wangyu-/udp2raw-tunnel/releases/latest | grep 'tag_name' | cut -d\" -f4)
|
|
|
wget https://github.com/wangyu-/udp2raw-tunnel/releases/download/${udp2raw_ver}/udp2raw_binaries.tar.gz
|
|
|
tar xf udp2raw_binaries.tar.gz
|
|
@@ -217,7 +214,7 @@ udp2raw_update()
|
|
|
rm udp2raw* -rf
|
|
|
rm version.txt
|
|
|
|
|
|
- # 下载 KCPTUN
|
|
|
+ # download KCPTUN
|
|
|
kcp_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/xtaci/kcptun/releases/latest | grep 'tag_name' | cut -d\" -f4)
|
|
|
kcp_gz_ver=${kcp_ver:1:8}
|
|
|
|
|
@@ -228,7 +225,7 @@ udp2raw_update()
|
|
|
rm $kcptun_tar_gz
|
|
|
rm client_linux_amd64
|
|
|
|
|
|
- # 下载 UDPspeeder
|
|
|
+ # download UDPspeeder
|
|
|
udpspeeder_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/wangyu-/UDPspeeder/releases/latest | grep 'tag_name' | cut -d\" -f4)
|
|
|
wget https://github.com/wangyu-/UDPspeeder/releases/download/${udpspeeder_ver}/speederv2_binaries.tar.gz
|
|
|
tar xf speederv2_binaries.tar.gz
|
|
@@ -243,23 +240,23 @@ udp2raw_update()
|
|
|
}
|
|
|
|
|
|
rc-local_remove(){
|
|
|
- echo -e "${RedBG} 卸载Udp2Raw套接服务配置 /etc/rc.local ${Font}"
|
|
|
+ echo -e "${RedBG} Remove Udp2Raw Bridge Service Configuration /etc/rc.local ${Font}"
|
|
|
systemctl stop rc-local
|
|
|
rm /usr/bin/udp2raw /usr/bin/kcp-server /usr/bin/speederv2
|
|
|
ps aux | grep -e kcp -e udp -e speed
|
|
|
mv /etc/rc.local ~/rc.local
|
|
|
- echo -e "${RedBG} 卸载完成,备份在 /root/rc.local ${Font}"
|
|
|
+ echo -e "${RedBG} Removed! Backup on /root/rc.local ${Font}"
|
|
|
}
|
|
|
|
|
|
update_remove_menu(){
|
|
|
- echo -e "${RedBG} 更新/卸载 WireGuard服务端和Udp2Raw ${Font}"
|
|
|
- echo -e "${Green}> 1. 更新 WireGuard 服务端"
|
|
|
- echo -e "> 2. 卸载 WireGuard 服务端"
|
|
|
- echo -e "> 3. 更新 Udp2Raw KCPTUN UDPspeeder 软件"
|
|
|
- echo -e "> 4. 卸载 Udp2Raw KCPTUN UDPspeeder 服务套件"
|
|
|
- echo -e "> 5. 退出${Font}"
|
|
|
+ echo -e "${RedBG} Update/Remove WireGuard and Udp2Raw Service ${Font}"
|
|
|
+ echo -e "${Green}> 1. Update WireGuard Service"
|
|
|
+ echo -e "> 2. Remove WireGuard Service"
|
|
|
+ echo -e "> 3. Update Udp2Raw KCPTUN UDPspeeder Soft"
|
|
|
+ echo -e "> 4. Remove Udp2Raw KCPTUN UDPspeeder Service"
|
|
|
+ echo -e "> 5. Exit${Font}"
|
|
|
echo
|
|
|
- read -p "请输入数字(1-4):" num_x
|
|
|
+ read -p "Please Enter the Number(1-5):" num_x
|
|
|
case "$num_x" in
|
|
|
1)
|
|
|
wireguard_update
|
|
@@ -281,20 +278,19 @@ update_remove_menu(){
|
|
|
esac
|
|
|
}
|
|
|
|
|
|
-# 删除末尾的Peer
|
|
|
+# Delete the last Peer
|
|
|
del_last_peer(){
|
|
|
peer_key=$(wg show wg0 allowed-ips | tail -1 | awk '{print $1}')
|
|
|
wg set wg0 peer $peer_key remove
|
|
|
wg-quick save wg0
|
|
|
- echo -e "${SkyBlue}:: 删除客户端 peer: ${Yellow} ${peer_key} ${SkyBlue} 完成.${Font}"
|
|
|
+ echo -e "${SkyBlue}:: Delete Clint Peer: ${Yellow} ${peer_key} ${SkyBlue} .${Font}"
|
|
|
}
|
|
|
|
|
|
-# 显示激活Peer表
|
|
|
+# Display active Peer table
|
|
|
display_peer(){
|
|
|
- # peer和ip表写临时文件
|
|
|
+ # Peer and ip table to write temporary files
|
|
|
wg show wg0 allowed-ips > /tmp/peer_list
|
|
|
|
|
|
- # 显示 peer和ip表
|
|
|
echo -e "${RedBG} ID ${GreenBG} Peer: <base64 public key> ${SkyBlue} IP_Addr: ${Font}"
|
|
|
i=1
|
|
|
while read -r line || [[ -n $line ]]; do
|
|
@@ -305,12 +301,12 @@ display_peer(){
|
|
|
done < /tmp/peer_list
|
|
|
}
|
|
|
|
|
|
-# 选择删除Peer客户端
|
|
|
+# Select to delete the Peer client
|
|
|
del_peer(){
|
|
|
display_peer
|
|
|
echo
|
|
|
- echo -e "${RedBG}请选择 IP_Addr 对应 ID 号码,指定客户端配置将删除! ${Font}"
|
|
|
- read -p "请输入ID号数字(1-X):" x
|
|
|
+ echo -e "${RedBG}Please select IP_Addr corresponding ID number, specify the client configuration will be deleted! ${Font}"
|
|
|
+ read -p "Please enter the ID number(1-X):" x
|
|
|
|
|
|
peer_cnt=$(cat /tmp/peer_list | wc -l)
|
|
|
if [[ ${x} -ge 1 ]] && [[ ${x} -le ${peer_cnt} ]]; then
|
|
@@ -318,25 +314,25 @@ del_peer(){
|
|
|
peer_key=$(cat /tmp/peer_list | head -n $i | tail -1 | awk '{print $1}')
|
|
|
wg set wg0 peer $peer_key remove
|
|
|
wg-quick save wg0
|
|
|
- echo -e "${SkyBlue}:: 删除客户端 peer: ${Yellow} ${peer_key} ${SkyBlue} 完成.${Font}"
|
|
|
+ echo -e "${SkyBlue}:: Client peer: ${Yellow} ${peer_key} ${SkyBlue} Removed! ${Font}"
|
|
|
else
|
|
|
- echo -e "${SkyBlue}:: 命令使用: ${GreenBG} wg set wg0 peer <base64 public key> remove ${Font}"
|
|
|
+ echo -e "${SkyBlue}:: Usage: ${GreenBG} wg set wg0 peer <base64 public key> remove ${Font}"
|
|
|
fi
|
|
|
rm /tmp/peer_list
|
|
|
}
|
|
|
|
|
|
-# 添加新的客户端peer
|
|
|
+# Add new WireGuard Client Peer
|
|
|
add_peer(){
|
|
|
|
|
|
- # 服务器 IP 端口 ,新客户端 序号和IP
|
|
|
+ # Server IP port, new client serial number and IP
|
|
|
port=$(wg show wg0 listen-port)
|
|
|
get_serverip && host=$(hostname -s) && cd /etc/wireguard
|
|
|
- wg genkey | tee cprivatekey | wg pubkey > cpublickey
|
|
|
+ wg genkey | tee cprivatekey | wg pubkey `> cpublickey
|
|
|
|
|
|
ipnum=$(wg show wg0 allowed-ips | tail -1 | awk '{print $2}' | awk -F '[./]' '{print $4}')
|
|
|
i=$((10#${ipnum}+1)) && ip=10.0.0.${i} ip6=${ipv6_range}${i}
|
|
|
|
|
|
- # 生成客户端配置文件
|
|
|
+ # Generate a client profile
|
|
|
cat <<EOF >wg_${host}_$i.conf
|
|
|
[Interface]
|
|
|
PrivateKey = $(cat cprivatekey)
|
|
@@ -350,14 +346,14 @@ AllowedIPs = 0.0.0.0/0, ::0/0
|
|
|
PersistentKeepalive = 25
|
|
|
EOF
|
|
|
|
|
|
- # 在wg服务器中生效客户端peer
|
|
|
+ # Effective client peer in wg server
|
|
|
wg set wg0 peer $(cat cpublickey) allowed-ips "${ip}/32, ${ip6}"
|
|
|
wg-quick save wg0
|
|
|
|
|
|
- # 显示客户端
|
|
|
+ # display Client peer
|
|
|
cat /etc/wireguard/wg_${host}_$i.conf | qrencode -o wg_${host}_$i.png
|
|
|
cat /etc/wireguard/wg_${host}_$i.conf | qrencode -o - -t UTF8
|
|
|
- echo -e "${SkyBlue}:: 新客户端peer添加完成; 文件:${Yellow} /etc/wireguard/wg_${host}_$i.conf ${Font}"
|
|
|
+ echo -e "${SkyBlue}:: New client Peer added; File:${Yellow} /etc/wireguard/wg_${host}_$i.conf ${Font}"
|
|
|
cat /etc/wireguard/wg_${host}_$i.conf
|
|
|
}
|
|
|
|
|
@@ -395,7 +391,7 @@ wg_clients_menu(){
|
|
|
}
|
|
|
|
|
|
|
|
|
-# 设置菜单
|
|
|
+# Setting Menu
|
|
|
start_menu(){
|
|
|
clear
|
|
|
echo_RedBG " One-Step Automated Install WireGuard Script For Debian_9 Ubuntu Centos_7 "
|
|
@@ -407,7 +403,7 @@ echo_GreenBG " Open Source Project: https://github.com/hongwenjun/vps_setup
|
|
|
echo "----------------------------------------------------------"
|
|
|
echo -e "${SkyBlue}> 5. Add/Delete WireGuard Client Peer Management"
|
|
|
echo -e "> 6. Update/Remove WireGuard and Udp2Raw Service"
|
|
|
- echo -e "> 7. Replace English to Simplified Chinese(中文)"
|
|
|
+ echo -e "> 7. Replace the Script itself with English to Simplified Chinese(中文)"
|
|
|
echo -e "> 8. ${RedBG} IPTABLES Firewall Setup Script ${Font}"
|
|
|
echo
|
|
|
echo_SkyBlue "Usage: ${GreenBG} bash wgmtu ${SkyBlue} [ setup | remove | vps | bench | -U ] "
|
|
@@ -493,7 +489,7 @@ wgmtu_help(){
|
|
|
echo_Yellow "[v2ray 你懂 | vnstat 流量 | log 信息 | trace 网络回程 | -h 帮助]"
|
|
|
}
|
|
|
|
|
|
-# WireGuard 管理命令 bash wgmtu 命令行参数
|
|
|
+# Manage menu input command line parameters
|
|
|
if [[ $# > 0 ]]; then
|
|
|
key="$1"
|
|
|
case $key in
|
|
@@ -504,11 +500,8 @@ if [[ $# > 0 ]]; then
|
|
|
wireguard_remove
|
|
|
rc-local_remove
|
|
|
;;
|
|
|
- 88)
|
|
|
- scp_conf
|
|
|
- ;;
|
|
|
9999)
|
|
|
- bash <(curl -L -s https://git.io/fpnQt) 9999
|
|
|
+ bash <(curl -L -s https://git.io/wireguard.sh) 9999
|
|
|
;;
|
|
|
-U)
|
|
|
update_self
|
|
@@ -517,7 +510,7 @@ if [[ $# > 0 ]]; then
|
|
|
wgmtu_help
|
|
|
;;
|
|
|
vps)
|
|
|
- bash <(curl -L -s https://git.io/vps.sh)
|
|
|
+ bash <(curl -L -s https://git.io/vps.setup)
|
|
|
;;
|
|
|
vnstat)
|
|
|
wget -qO- git.io/fxxlb | bash
|
|
@@ -529,7 +522,7 @@ if [[ $# > 0 ]]; then
|
|
|
wget -qO- git.io/fp5lf | bash
|
|
|
;;
|
|
|
v2ray)
|
|
|
- bash <(curl -L -s https://git.io/v2ray.ss)
|
|
|
+ bash <(curl -L -s https://git.io/v2ray_ss.sh)
|
|
|
;;
|
|
|
log)
|
|
|
cat vps_setup.log
|