wgmtu.sh 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594
  1. #!/bin/bash
  2. # WireGuard 管理使用命令 bash wgmtu 短网址: https://git.io/wgmtu
  3. # 修改mtu数值
  4. setmtu(){
  5. echo -e "${GreenBG}WireGuard 修改服务器端MTU值,提高效率;默认值MTU=1420${Font}"
  6. read -p "请输入数字(1200--1500): " num
  7. if [[ ${num} -ge 1200 ]] && [[ ${num} -le 1500 ]]; then
  8. mtu=$num
  9. else
  10. mtu=1420
  11. fi
  12. ip link set mtu $num up dev wg0
  13. wg-quick save wg0
  14. echo -e "${SkyBlue}:: 服务器端MTU值已经修改!${Font}"
  15. }
  16. # 修改端口号
  17. setport(){
  18. echo -e "${GreenBG}修改 WireGuard 服务器端端口号,客户端要自行修改${Font}"
  19. read -p "请输入数字(100--60000): " num
  20. if [[ ${num} -ge 100 ]] && [[ ${num} -le 60000 ]]; then
  21. port=$num
  22. wg set wg0 listen-port $port
  23. wg-quick save wg0
  24. echo -e "${SkyBlue}:: 端口号已经修改, 客户端请手工修改! ${Font}"
  25. else
  26. echo -e "${Red}:: 没有修改端口号!${Font}"
  27. fi
  28. }
  29. # 显示客户端配置和手机二维码
  30. conf_QRcode(){
  31. echo -e "${Yellow}:: 显示客户端配置和手机二维码 (默认2号),请输入数字${Font}\c"
  32. read -p "(2-9): " x
  33. if [[ ${x} -ge 2 ]] && [[ ${x} -le 9 ]]; then
  34. i=$x
  35. else
  36. i=2
  37. fi
  38. host=$(hostname -s)
  39. echo -e "${SkyBlue}:: 客户端配置文件: wg_${host}_$i.conf ${Font}"
  40. cat /etc/wireguard/wg_${host}_$i.conf
  41. echo -e "${SkyBlue}:: 请使用组合键 Ctrl+Ins 复制文本给Windows客户端使用${Font}"
  42. cat /etc/wireguard/wg_${host}_$i.conf | qrencode -o - -t UTF8
  43. echo -e "${Green}:: 配置文件: wg_${host}_$i.conf 生成二维码,请用手机客户端扫描使用${Font}"
  44. echo -e "${SkyBlue}:: 安卓手机WireGuard官方APP目前支持纯IPV6连接,是否显示IPV6二维码?${Font}\c"
  45. read -p "(Y/N): " key
  46. case $key in
  47. Y)
  48. ipv6_QRcode $i
  49. ;;
  50. y)
  51. ipv6_QRcode $i
  52. ;;
  53. esac
  54. echo -e "${SkyBlue}:: SSH工具推荐Git-Bash 2.20; GCP_SSH(浏览器)字体Courier New 二维码正常${Font}"
  55. }
  56. # 显示IPV6手机客户端二维码
  57. ipv6_QRcode(){
  58. if [[ $# > 0 ]]; then
  59. i="$1"
  60. fi
  61. get_serverip
  62. serveripv6=$(curl -6 ip.sb)
  63. if [[ -z $serveripv6 ]]; then
  64. echo -e "${Red}:: 获取IPV6地址不正确,你的服务器可能没有IPV6网络支持!${Font}"
  65. else
  66. cat /etc/wireguard/wg_${host}_$i.conf | sed "s/${serverip}/[${serveripv6}]/g" | qrencode -o - -t UTF8
  67. echo -e "${Green}:: IPV6地址: [${serveripv6}] 请确认服务器和本地网络支持IPV6!${Font}"
  68. fi
  69. }
  70. get_serverip(){
  71. if [ ! -e '/var/ip_addr' ]; then
  72. echo -n $(curl -4 ip.sb) > /var/ip_addr
  73. fi
  74. serverip=$(cat /var/ip_addr)
  75. ipv6_range="fd08:620c:4df0:65eb::"
  76. }
  77. # 重置 WireGuard 客户端配置和数量
  78. wg_clients(){
  79. echo -e "${Red}:: 注意原来的客户端配置都会删除,按 Ctrl+ C 可以紧急撤销 ${Font}"
  80. # 转到wg配置文件目录
  81. cd /etc/wireguard
  82. cp wg0.conf conf.wg0.bak
  83. echo -e "${SkyBlue}:: 输入客户端Peer总数${Font}\c"
  84. read -p "(2--200): " num_x
  85. if [[ ${num_x} -ge 2 ]] && [[ ${num_x} -le 200 ]]; then
  86. wg_num=OK
  87. else
  88. num_x=3
  89. fi
  90. # 服务器 IP 和 端口
  91. port=$(wg show wg0 listen-port) && host=$(hostname -s)
  92. get_serverip
  93. # 删除原配置,让IP和ID号对应; 保留原来服务器的端口等配置
  94. rm /etc/wireguard/wg_${host}_* >/dev/null 2>&1
  95. line_num=$(cat -n wg0.conf | grep 'AllowedIPs' | head -n 1 | awk '{print $1}')
  96. head -n ${line_num} conf.wg0.bak > wg0.conf
  97. # 重启wg服务器
  98. wg-quick down wg0 >/dev/null 2>&1
  99. wg-quick up wg0 >/dev/null 2>&1
  100. # 重新生成用户配置数量
  101. for i in `seq 2 200`
  102. do
  103. ip=10.0.0.${i}
  104. ip6=${ipv6_range}${i}
  105. wg genkey | tee cprivatekey | wg pubkey > cpublickey
  106. wg set wg0 peer $(cat cpublickey) allowed-ips "${ip}/32, ${ip6}"
  107. cat <<EOF >wg_${host}_$i.conf
  108. [Interface]
  109. PrivateKey = $(cat cprivatekey)
  110. Address = $ip/24, $ip6/64
  111. DNS = 8.8.8.8, 2001:4860:4860::8888
  112. [Peer]
  113. PublicKey = $(wg show wg0 public-key)
  114. Endpoint = $serverip:$port
  115. AllowedIPs = 0.0.0.0/0, ::0/0
  116. PersistentKeepalive = 25
  117. EOF
  118. cat wg_${host}_$i.conf | qrencode -o wg_${host}_$i.png
  119. if [ $i -ge $num_x ]; then break; fi
  120. done
  121. wg-quick save wg0
  122. clear && display_peer
  123. cat /etc/wireguard/wg_${host}_2.conf
  124. echo -e "${SkyBlue}:: 使用${GreenBG} bash wg5 ${SkyBlue}命令,可以临时网页下载配置和二维码${Font}"
  125. }
  126. # 安装 WireGuard+Speeder+Udp2Raw 和 SS+Kcp+Udp2RAW 配置
  127. ss_kcp_udp2raw_wg_speed(){
  128. # 下载/编译 shadowsocks-libev
  129. wget -qO- git.io/fhExJ | bash
  130. wget -O ~/ss_wg_set_raw git.io/fpKnF >/dev/null 2>&1
  131. bash ~/ss_wg_set_raw
  132. rm ~/ss_wg_set_raw
  133. }
  134. # 常用工具和配置
  135. get_tools_conf(){
  136. apt update
  137. apt install -y htop tmux screen iperf3 >/dev/null 2>&1
  138. yum install -y vim htop tmux screen iperf3 >/dev/null 2>&1
  139. wget -O .vimrc --no-check-certificate https://raw.githubusercontent.com/hongwenjun/srgb/master/vim/_vimrc
  140. wget -O .bashrc --no-check-certificate https://raw.githubusercontent.com/hongwenjun/srgb/master/vim/_bashrc
  141. wget -O .tmux.conf --no-check-certificate https://raw.githubusercontent.com/hongwenjun/tmux_for_windows/master/.tmux.conf
  142. }
  143. # 主菜单输入数字 88 # 隐藏功能:从源VPS克隆服务端配置,获得常用工具和配置
  144. scp_conf(){
  145. echo -e "${RedBG}:: 警告: 警告: 警告:${Yellow} VPS服务器已经被GFW防火墙关照,按 Ctrl+ C 可以紧急逃离! ${Font}"
  146. echo_SkyBlue ":: 隐藏功能: 从源VPS克隆服务端配置,共用客户端配置"
  147. read -p ":: 请输入源VPS的IP地址(域名):" vps_ip
  148. cmd="scp root@${vps_ip}:/etc/wireguard/* /etc/wireguard/. "
  149. echo -e "${GreenBG}# ${cmd} ${Font} 现在运行scp命令,按提示输入yes,源vps的root密码"
  150. ${cmd}
  151. wg-quick down wg0 >/dev/null 2>&1
  152. wg-quick up wg0 >/dev/null 2>&1
  153. echo -e "${RedBG} 我真不知道WG服务器端是否已经使用源vps的配置启动! ${Font}"
  154. if [ ! -e '/root/.tmux.conf' ]; then
  155. get_tools_conf
  156. fi
  157. }
  158. # 定义文字颜色
  159. Green="\033[32m" && Red="\033[31m" && GreenBG="\033[42;37m" && RedBG="\033[41;37m"
  160. Font="\033[0m" && Yellow="\033[0;33m" && SkyBlue="\033[0;36m"
  161. echo_SkyBlue(){
  162. echo -e "${SkyBlue}$1${Font}"
  163. }
  164. echo_Yellow(){
  165. echo -e "${Yellow}$1${Font}"
  166. }
  167. echo_GreenBG(){
  168. echo -e "${GreenBG}$1${Font}"
  169. }
  170. echo_RedBG(){
  171. echo -e "${RedBG}$1${Font}"
  172. }
  173. # Vps_Setup 一键脚本 藏经阁
  174. onekey_plus(){
  175. echo_RedBG " 一键安装设置全家桶 by 蘭雅sRGB "
  176. echo_GreenBG " 开源项目:https://github.com/hongwenjun/vps_setup "
  177. echo_SkyBlue " # 一键安装 WireGuard Shadowsocks V2Ray 服务端三合一脚本"
  178. echo_Yellow " bash <(curl -L -s https://git.io/vps.sh)"
  179. echo_SkyBlue " # 下载 IPTABLES 设置防火墙规则 脚本 By 蘭雅sRGB"
  180. echo_Yellow " wget -qO safe_iptables.sh git.io/fhUSe && bash safe_iptables.sh"
  181. echo_SkyBlue " # Google Cloud Platform GCP实例开启密码与root用户登陆"
  182. echo_Yellow " wget -qO- git.io/fpQWf | bash"
  183. echo_SkyBlue " # 一键安装 vnstat 流量检测 by 蘭雅sRGB"
  184. echo_Yellow " wget -qO- git.io/fxxlb | bash"
  185. echo_SkyBlue " # 一键安装wireguard 脚本 For Debian_9 Ubuntu Centos_7"
  186. echo_Yellow " wget -qO- git.io/fptwc | bash"
  187. echo_SkyBlue " # 一键安装 SS+Kcp+Udp2Raw 脚本 快速安装 for Debian 9"
  188. echo_Yellow " wget -qO- git.io/fpZIW | bash"
  189. echo_SkyBlue " # 一键安装 SS+Kcp+Udp2Raw 脚本 for Debian 9 Ubuntu (编译安装)"
  190. echo_Yellow " wget -qO- git.io/fx6UQ | bash"
  191. echo_SkyBlue " # Telegram 代理 MTProxy Go版 一键脚本(源:逗比网)"
  192. echo_Yellow " wget -qO mtproxy_go.sh git.io/fpWo4 && bash mtproxy_go.sh"
  193. echo_SkyBlue " # linux下golang环境搭建自动脚本 by 蘭雅sRGB"
  194. echo_Yellow " wget -qO- https://git.io/fp4jf | bash"
  195. echo_SkyBlue " # SuperBench.sh 一键测试服务器的基本参数"
  196. echo_Yellow " wget -qO- git.io/superbench.sh | bash"
  197. echo_SkyBlue " # 使用BestTrace查看VPS的去程和回程"
  198. echo_Yellow " wget -qO- git.io/fp5lf | bash"
  199. }
  200. safe_iptables(){
  201. # IPTABLES 设置防火墙规则 脚本 By 蘭雅sRGB 特别感谢 TaterLi 指导
  202. wget -qO safe_iptables.sh git.io/fhUSe && bash safe_iptables.sh
  203. }
  204. # 更新wgmtu脚本
  205. update_self(){
  206. # 安装 bash wgmtu 脚本用来设置服务器
  207. wget -O ~/wgmtu https://git.io/wgmtu >/dev/null 2>&1
  208. }
  209. # 更新 WireGuard
  210. wireguard_update(){
  211. yum update -y wireguard-dkms wireguard-tools >/dev/null 2>&1
  212. apt update -y wireguard-dkms wireguard-tools >/dev/null 2>&1
  213. echo -e "${RedBG} 更新完成 ${Font}"
  214. }
  215. # 卸载 WireGuard
  216. wireguard_remove(){
  217. wg-quick down wg0
  218. yum remove -y wireguard-dkms wireguard-tools >/dev/null 2>&1
  219. apt remove -y wireguard-dkms wireguard-tools >/dev/null 2>&1
  220. rm -rf /etc/wireguard/
  221. echo -e "${RedBG} 卸载完成 ${Font}"
  222. }
  223. # 更新/安装 UDP2RAW KCPTUN UDPspeeder 工具
  224. udp2raw_update()
  225. {
  226. systemctl stop rc-local
  227. # 下载 UDP2RAW
  228. wget https://github.com/wangyu-/udp2raw-tunnel/releases/download/20181113.0/udp2raw_binaries.tar.gz
  229. tar xf udp2raw_binaries.tar.gz
  230. mv udp2raw_amd64 /usr/bin/udp2raw
  231. rm udp2raw* -rf
  232. rm version.txt
  233. # 下载更新 KCPTUN
  234. kcp_ver=$(wget --no-check-certificate -qO- https://api.github.com/repos/xtaci/kcptun/releases/latest | grep 'tag_name' | cut -d\" -f4)
  235. kcp_gz_ver=${kcp_ver:1:8}
  236. kcptun_tar_gz=kcptun-linux-amd64-${kcp_gz_ver}.tar.gz
  237. wget https://github.com/xtaci/kcptun/releases/download/${kcp_ver}/$kcptun_tar_gz
  238. tar xf $kcptun_tar_gz
  239. mv server_linux_amd64 /usr/bin/kcp-server
  240. rm $kcptun_tar_gz
  241. rm client_linux_amd64
  242. # 下载 UDPspeeder
  243. wget https://github.com/wangyu-/UDPspeeder/releases/download/20190121.0/speederv2_binaries.tar.gz
  244. tar xf speederv2_binaries.tar.gz
  245. mv speederv2_amd64 /usr/bin/speederv2
  246. rm speederv2* -rf
  247. rm version.txt
  248. systemctl restart rc-local
  249. ps aux | grep -e kcp -e udp -e speed
  250. }
  251. rc-local_remove(){
  252. echo -e "${RedBG} 卸载Udp2Raw套接服务配置 /etc/rc.local ${Font}"
  253. systemctl stop rc-local
  254. rm /usr/bin/udp2raw /usr/bin/kcp-server /usr/bin/speederv2
  255. ps aux | grep -e kcp -e udp -e speed
  256. mv /etc/rc.local ~/rc.local
  257. echo -e "${RedBG} 卸载完成,备份在 /root/rc.local ${Font}"
  258. }
  259. update_remove_menu(){
  260. echo -e "${RedBG} 更新/卸载 WireGuard服务端和Udp2Raw ${Font}"
  261. echo -e "${Green}> 1. 更新 WireGuard 服务端"
  262. echo -e "> 2. 卸载 WireGuard 服务端"
  263. echo -e "> 3. 更新 Udp2Raw KCPTUN UDPspeeder 软件"
  264. echo -e "> 4. 卸载 Udp2Raw KCPTUN UDPspeeder 服务套件"
  265. echo -e "> 5. 退出${Font}"
  266. echo
  267. read -p "请输入数字(1-4):" num_x
  268. case "$num_x" in
  269. 1)
  270. wireguard_update
  271. ;;
  272. 2)
  273. wireguard_remove
  274. ;;
  275. 3)
  276. udp2raw_update
  277. ;;
  278. 4)
  279. rc-local_remove
  280. ;;
  281. 5)
  282. exit 1
  283. ;;
  284. *)
  285. ;;
  286. esac
  287. }
  288. # 删除末尾的Peer
  289. del_last_peer(){
  290. peer_key=$(wg show wg0 allowed-ips | tail -1 | awk '{print $1}')
  291. wg set wg0 peer $peer_key remove
  292. wg-quick save wg0
  293. echo -e "${SkyBlue}:: 删除客户端 peer: ${Yellow} ${peer_key} ${SkyBlue} 完成.${Font}"
  294. }
  295. # 显示激活Peer表
  296. display_peer(){
  297. # peer和ip表写临时文件
  298. wg show wg0 allowed-ips > /tmp/peer_list
  299. # 显示 peer和ip表
  300. echo -e "${RedBG} ID ${GreenBG} Peer: <base64 public key> ${SkyBlue} IP_Addr: ${Font}"
  301. i=1
  302. while read -r line || [[ -n $line ]]; do
  303. peer=$(echo $line | awk '{print $1}')
  304. ip=$(echo $line | awk '{print $2}')
  305. line="> ${Red}${i} ${Yellow}${peer}${Font} ${ip}"
  306. echo -e $line && let i++
  307. done < /tmp/peer_list
  308. }
  309. # 选择删除Peer客户端
  310. del_peer(){
  311. display_peer
  312. echo
  313. echo -e "${RedBG}请选择 IP_Addr 对应 ID 号码,指定客户端配置将删除! ${Font}"
  314. read -p "请输入ID号数字(1-X):" x
  315. peer_cnt=$(cat /tmp/peer_list | wc -l)
  316. if [[ ${x} -ge 1 ]] && [[ ${x} -le ${peer_cnt} ]]; then
  317. i=$x
  318. peer_key=$(cat /tmp/peer_list | head -n $i | tail -1 | awk '{print $1}')
  319. wg set wg0 peer $peer_key remove
  320. wg-quick save wg0
  321. echo -e "${SkyBlue}:: 删除客户端 peer: ${Yellow} ${peer_key} ${SkyBlue} 完成.${Font}"
  322. else
  323. echo -e "${SkyBlue}:: 命令使用: ${GreenBG} wg set wg0 peer <base64 public key> remove ${Font}"
  324. fi
  325. rm /tmp/peer_list
  326. }
  327. # 添加新的客户端peer
  328. add_peer(){
  329. # 服务器 IP 端口 ,新客户端 序号和IP
  330. port=$(wg show wg0 listen-port)
  331. get_serverip && host=$(hostname -s) && cd /etc/wireguard
  332. wg genkey | tee cprivatekey | wg pubkey > cpublickey
  333. ipnum=$(wg show wg0 allowed-ips | tail -1 | awk '{print $2}' | awk -F '[./]' '{print $4}')
  334. i=$((10#${ipnum}+1)) && ip=10.0.0.${i} ip6=${ipv6_range}${i}
  335. # 生成客户端配置文件
  336. cat <<EOF >wg_${host}_$i.conf
  337. [Interface]
  338. PrivateKey = $(cat cprivatekey)
  339. Address = $ip/24, $ip6/64
  340. DNS = 8.8.8.8, 2001:4860:4860::8888
  341. [Peer]
  342. PublicKey = $(wg show wg0 public-key)
  343. Endpoint = $serverip:$port
  344. AllowedIPs = 0.0.0.0/0, ::0/0
  345. PersistentKeepalive = 25
  346. EOF
  347. # 在wg服务器中生效客户端peer
  348. wg set wg0 peer $(cat cpublickey) allowed-ips "${ip}/32, ${ip6}"
  349. wg-quick save wg0
  350. # 显示客户端
  351. cat /etc/wireguard/wg_${host}_$i.conf | qrencode -o wg_${host}_$i.png
  352. cat /etc/wireguard/wg_${host}_$i.conf | qrencode -o - -t UTF8
  353. echo -e "${SkyBlue}:: 新客户端peer添加完成; 文件:${Yellow} /etc/wireguard/wg_${host}_$i.conf ${Font}"
  354. cat /etc/wireguard/wg_${host}_$i.conf
  355. }
  356. wg_clients_menu(){
  357. echo -e "${RedBG} 添加/删除 WireGuard Peer 客户端管理 ${Font}"
  358. echo -e "${Green}> 1. 添加一个 WireGuard Peer 客户端配置"
  359. echo -e "> 2. 删除末尾 WireGuard Peer 客户端配置"
  360. echo -e "> 3. 指定删除 WireGuard Peer 客户端配置"
  361. echo "------------------------------------------------------"
  362. echo -e "${SkyBlue}> 4. 退出"
  363. echo -e "> 5.${RedBG} 重置 WireGuard 客户端 Peer 数量 ${Font}"
  364. echo
  365. read -p "请输入数字(1-5):" num_x
  366. case "$num_x" in
  367. 1)
  368. add_peer
  369. ;;
  370. 2)
  371. del_last_peer
  372. ;;
  373. 3)
  374. del_peer
  375. ;;
  376. 4)
  377. display_peer
  378. exit 1
  379. ;;
  380. 5)
  381. wg_clients
  382. ;;
  383. *)
  384. ;;
  385. esac
  386. }
  387. # 设置菜单
  388. start_menu(){
  389. clear
  390. echo -e "${RedBG} 一键安装 WireGuard 脚本 For Debian_9 Ubuntu Centos_7 ${Font}"
  391. echo -e "${GreenBG} 开源项目: https://github.com/hongwenjun/vps_setup ${Font}"
  392. echo -e "${Green}> 1. 显示客户端配置和二维码 (手机支持纯IPV6,稳定性有待测试)"
  393. echo -e "> 2. 修改 WireGuard 服务器端 MTU 值"
  394. echo -e "> 3. 修改 WireGuard 端口号"
  395. echo -e "> 4. 安装 WireGuard+Speeder+Udp2Raw 和 SS+Kcp+Udp2RAW 一键脚本"
  396. echo "----------------------------------------------------------"
  397. echo -e "${SkyBlue}> 5. 添加/删除 WireGuard Peer 客户端管理"
  398. echo -e "> 6. 更新/卸载 WireGuard服务端和Udp2Raw"
  399. echo -e "> 7. Vps_Setup 一键脚本 藏经阁"
  400. echo -e "> 8. ${RedBG} IPTABLES 防火墙设置脚本 ${Font}"
  401. echo
  402. echo_SkyBlue "Usage: ${GreenBG} bash wgmtu ${SkyBlue} [ setup | remove | vps | bench | -U ] "
  403. echo_SkyBlue " [ v2ray | vnstat | log | trace | -h ] "
  404. echo
  405. read -p "请输入数字(1-8):" num
  406. case "$num" in
  407. 1)
  408. conf_QRcode
  409. ;;
  410. 2)
  411. setmtu
  412. ;;
  413. 3)
  414. setport
  415. ;;
  416. 4)
  417. ss_kcp_udp2raw_wg_speed
  418. ;;
  419. 5)
  420. wg_clients_menu
  421. ;;
  422. 6)
  423. update_remove_menu
  424. update_self
  425. exit 1
  426. ;;
  427. 7)
  428. onekey_plus
  429. ;;
  430. 8)
  431. safe_iptables
  432. ;;
  433. # 菜单输入 管理命令 bash wgmtu 命令行参数
  434. setup)
  435. ss_kcp_udp2raw_wg_speed
  436. ;;
  437. remove)
  438. wireguard_remove
  439. rc-local_remove
  440. ;;
  441. 88)
  442. scp_conf
  443. ;;
  444. 9999)
  445. bash <(curl -L -s https://git.io/fpnQt) 9999
  446. ;;
  447. -U)
  448. update_self
  449. ;;
  450. -h)
  451. wgmtu_help
  452. ;;
  453. vps)
  454. bash <(curl -L -s https://git.io/vps.sh)
  455. ;;
  456. vnstat)
  457. wget -qO- git.io/fxxlb | bash
  458. ;;
  459. bench)
  460. wget -qO- git.io/superbench.sh | bash
  461. ;;
  462. trace)
  463. wget -qO- git.io/fp5lf | bash
  464. ;;
  465. v2ray)
  466. bash <(curl -L -s https://git.io/v2ray.ss)
  467. ;;
  468. log)
  469. cat vps_setup.log
  470. ;;
  471. *)
  472. display_peer
  473. ;;
  474. esac
  475. }
  476. wgmtu_help(){
  477. echo_SkyBlue "Usage: ${GreenBG} bash wgmtu ${SkyBlue} [ setup | remove | vps | bench | -U ] "
  478. echo_SkyBlue " [ v2ray | vnstat | log | trace | -h ] "
  479. echo
  480. echo_Yellow "[setup 惊喜 | remove 卸载 | vps 脚本 | bench 基准测试 | -U 更新]"
  481. echo_Yellow "[v2ray 你懂 | vnstat 流量 | log 信息 | trace 网络回程 | -h 帮助]"
  482. }
  483. # WireGuard 管理命令 bash wgmtu 命令行参数
  484. if [[ $# > 0 ]]; then
  485. key="$1"
  486. case $key in
  487. setup)
  488. ss_kcp_udp2raw_wg_speed
  489. ;;
  490. remove)
  491. wireguard_remove
  492. rc-local_remove
  493. ;;
  494. 88)
  495. scp_conf
  496. ;;
  497. 9999)
  498. bash <(curl -L -s https://git.io/fpnQt) 9999
  499. ;;
  500. -U)
  501. update_self
  502. ;;
  503. -h)
  504. wgmtu_help
  505. ;;
  506. vps)
  507. bash <(curl -L -s https://git.io/vps.sh)
  508. ;;
  509. vnstat)
  510. wget -qO- git.io/fxxlb | bash
  511. ;;
  512. bench)
  513. wget -qO- git.io/superbench.sh | bash
  514. ;;
  515. trace)
  516. wget -qO- git.io/fp5lf | bash
  517. ;;
  518. v2ray)
  519. bash <(curl -L -s https://git.io/v2ray.ss)
  520. ;;
  521. log)
  522. cat vps_setup.log
  523. ;;
  524. esac
  525. else
  526. start_menu
  527. fi