From 7501cf651e86549cd6b44184bf6241285e1f3193 Mon Sep 17 00:00:00 2001 From: 233boy Date: Fri, 1 Mar 2019 16:46:46 +0800 Subject: [PATCH] bugs fix --- config/backup.conf | 2 +- install.sh | 157 ++++++++++++++++++++++++++------------------- src/backup.sh | 31 ++++++++- src/ss-info.sh | 8 +-- src/v2ray-info.sh | 4 +- v2ray.sh | 94 ++++++++++++++------------- 6 files changed, 176 insertions(+), 120 deletions(-) diff --git a/config/backup.conf b/config/backup.conf index 949592d..e64f4b4 100644 --- a/config/backup.conf +++ b/config/backup.conf @@ -21,7 +21,7 @@ v2ray_transport=1 v2ray_port=2333 #---- UUID ----- -v2ray_id=e55c8d17-2cf3-b21a-bcf1-eeacb011ed79 +v2ray_id=uuid #---- alterId ----- alterId=233 diff --git a/install.sh b/install.sh index c230243..e4b4212 100644 --- a/install.sh +++ b/install.sh @@ -48,7 +48,6 @@ else fi uuid=$(cat /proc/sys/kernel/random/uuid) -old_id="e55c8d17-2cf3-b21a-bcf1-eeacb011ed79" v2ray_server_config="/etc/v2ray/config.json" v2ray_client_config="/etc/v2ray/233blog_v2ray_config.json" backup="/etc/v2ray/233blog_v2ray_backup.conf" @@ -56,6 +55,9 @@ _v2ray_sh="/usr/local/sbin/v2ray" systemd=true # _test=true +# site +_site="ddog.xyz" + transport=( TCP TCP_HTTP @@ -126,13 +128,13 @@ v2ray_config() { echo "备注1: 含有 [dynamicPort] 的即启用动态端口.." echo "备注2: [utp | srtp | wechat-video | dtls | wireguard] 分别伪装成 [BT下载 | 视频通话 | 微信视频通话 | DTLS 1.2 数据包 | WireGuard 数据包]" echo - read -p "$(echo -e "(默认协议: ${cyan}TCP$none)"):" v2ray_transport - [ -z "$v2ray_transport" ] && v2ray_transport=1 - case $v2ray_transport in + read -p "$(echo -e "(默认协议: ${cyan}TCP$none)"):" new_v2ray_transport + [ -z "$new_v2ray_transport" ] && new_v2ray_transport=1 + case $new_v2ray_transport in [1-9] | [1-2][0-9] | 3[0-2]) echo echo - echo -e "$yellow V2Ray 传输协议 = $cyan${transport[$v2ray_transport - 1]}$none" + echo -e "$yellow V2Ray 传输协议 = $cyan${transport[$new_v2ray_transport - 1]}$none" echo "----------------------------------------------------------------" echo break @@ -142,10 +144,10 @@ v2ray_config() { ;; esac done - v2ray_port_config + new_v2ray_port_config } -v2ray_port_config() { - case $v2ray_transport in +new_v2ray_port_config() { + case $new_v2ray_transport in 4 | 5) tls_config ;; @@ -153,13 +155,13 @@ v2ray_port_config() { local random=$(shuf -i20001-65535 -n1) while :; do echo -e "请输入 "$yellow"V2Ray"$none" 端口 ["$magenta"1-65535"$none"]" - read -p "$(echo -e "(默认端口: ${cyan}${random}$none):")" v2ray_port - [ -z "$v2ray_port" ] && v2ray_port=$random - case $v2ray_port in + read -p "$(echo -e "(默认端口: ${cyan}${random}$none):")" new_v2ray_port + [ -z "$new_v2ray_port" ] && new_v2ray_port=$random + case $new_v2ray_port in [1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) echo echo - echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none" + echo -e "$yellow V2Ray 端口 = $cyan$new_v2ray_port$none" echo "----------------------------------------------------------------" echo break @@ -169,7 +171,7 @@ v2ray_port_config() { ;; esac done - if [[ $v2ray_transport -ge 18 ]]; then + if [[ $new_v2ray_transport -ge 18 ]]; then v2ray_dynamic_port_start fi ;; @@ -183,11 +185,11 @@ v2ray_dynamic_port_start() { read -p "$(echo -e "(默认开始端口: ${cyan}10000$none):")" v2ray_dynamic_port_start_input [ -z $v2ray_dynamic_port_start_input ] && v2ray_dynamic_port_start_input=10000 case $v2ray_dynamic_port_start_input in - $v2ray_port) + $new_v2ray_port) echo echo " 不能和 V2Ray 端口一毛一样...." echo - echo -e " 当前 V2Ray 端口:${cyan}$v2ray_port${none}" + echo -e " 当前 V2Ray 端口:${cyan}$new_v2ray_port${none}" error ;; [1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) @@ -205,8 +207,8 @@ v2ray_dynamic_port_start() { done - if [[ $v2ray_dynamic_port_start_input -lt $v2ray_port ]]; then - lt_v2ray_port=true + if [[ $v2ray_dynamic_port_start_input -lt $new_v2ray_port ]]; then + lt_new_v2ray_port=true fi v2ray_dynamic_port_end @@ -226,11 +228,11 @@ v2ray_dynamic_port_end() { echo echo -e " 当前 V2Ray 动态端口开始:${cyan}$v2ray_dynamic_port_start_input${none}" error - elif [ $lt_v2ray_port ] && [[ ${v2ray_dynamic_port_end_input} -ge $v2ray_port ]]; then + elif [ $lt_new_v2ray_port ] && [[ ${v2ray_dynamic_port_end_input} -ge $new_v2ray_port ]]; then echo echo " V2Ray 动态端口结束范围 不能包括 V2Ray 端口..." echo - echo -e " 当前 V2Ray 端口:${cyan}$v2ray_port${none}" + echo -e " 当前 V2Ray 端口:${cyan}$new_v2ray_port${none}" error else echo @@ -256,9 +258,9 @@ tls_config() { local random=$(shuf -i20001-65535 -n1) while :; do echo -e "请输入 "$yellow"V2Ray"$none" 端口 ["$magenta"1-65535"$none"],不能选择 "$magenta"80"$none" 或 "$magenta"443"$none" 端口" - read -p "$(echo -e "(默认端口: ${cyan}${random}$none):")" v2ray_port - [ -z "$v2ray_port" ] && v2ray_port=$random - case $v2ray_port in + read -p "$(echo -e "(默认端口: ${cyan}${random}$none):")" new_v2ray_port + [ -z "$new_v2ray_port" ] && new_v2ray_port=$random + case $new_v2ray_port in 80) echo echo " ...都说了不能选择 80 端口了咯....." @@ -272,7 +274,7 @@ tls_config() { [1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) echo echo - echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none" + echo -e "$yellow V2Ray 端口 = $cyan$new_v2ray_port$none" echo "----------------------------------------------------------------" echo break @@ -326,7 +328,7 @@ tls_config() { done - if [[ $v2ray_transport -ne 5 ]]; then + if [[ $new_v2ray_transport -ne 5 ]]; then auto_tls_config else caddy=true @@ -527,14 +529,14 @@ shadowsocks_port_config() { read -p "$(echo -e "(默认端口: ${cyan}${random}$none):") " ssport [ -z "$ssport" ] && ssport=$random case $ssport in - $v2ray_port) + $new_v2ray_port) echo echo " 不能和 V2Ray 端口一毛一样...." error ;; [1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) - if [[ $v2ray_transport == [45] ]]; then - local tls=ture + if [[ $new_v2ray_transport == [45] ]]; then + local tls=true fi if [[ $tls && $ssport == "80" ]] || [[ $tls && $ssport == "443" ]]; then echo @@ -635,11 +637,11 @@ install_info() { echo echo "---------- 安装信息 -------------" echo - echo -e "$yellow V2Ray 传输协议 = $cyan${transport[$v2ray_transport - 1]}$none" + echo -e "$yellow V2Ray 传输协议 = $cyan${transport[$new_v2ray_transport - 1]}$none" - if [[ $v2ray_transport == [45] ]]; then + if [[ $new_v2ray_transport == [45] ]]; then echo - echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none" + echo -e "$yellow V2Ray 端口 = $cyan$new_v2ray_port$none" echo echo -e "$yellow 你的域名 = $cyan$domain$none" echo @@ -655,9 +657,9 @@ install_info() { echo echo -e "$yellow 路径分流 = ${cyan}/${path}$none" fi - elif [[ $v2ray_transport -ge 18 ]]; then + elif [[ $new_v2ray_transport -ge 18 ]]; then echo - echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none" + echo -e "$yellow V2Ray 端口 = $cyan$new_v2ray_port$none" echo echo -e "$yellow V2Ray 动态端口范围 = $cyan${v2ray_dynamic_port_start_input} - ${v2ray_dynamic_port_end_input}$none" @@ -667,7 +669,7 @@ install_info() { fi else echo - echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port$none" + echo -e "$yellow V2Ray 端口 = $cyan$new_v2ray_port$none" if [[ $ban_ad ]]; then echo @@ -745,7 +747,7 @@ install_v2ray() { echo echo -e "$red 哎呀呀...安装失败了咯...$none" echo - echo -e " 请确保你有完整的上传 v2ray6.com 的 V2Ray 一键安装脚本 & 管理脚本到当前 ${green}$(pwd) $none目录下" + echo -e " 请确保你有完整的上传 $_site 的 V2Ray 一键安装脚本 & 管理脚本到当前 ${green}$(pwd) $none目录下" echo exit 1 fi @@ -788,10 +790,13 @@ config() { cp -f /etc/v2ray/233boy/v2ray/v2ray.sh $_v2ray_sh chmod +x $_v2ray_sh - v2ray_id=$uuid - alterId=233 ban_bt=true - if [[ $v2ray_transport -ge 18 ]]; then + alterId=233 + v2ray_id=$uuid + v2ray_port=$new_v2ray_port + v2ray_transport=$new_v2ray_transport + + if [[ $new_v2ray_transport -ge 18 ]]; then v2ray_dynamicPort_start=${v2ray_dynamic_port_start_input} v2ray_dynamicPort_end=${v2ray_dynamic_port_end_input} fi @@ -802,15 +807,15 @@ config() { _iptables_save [[ $shadowsocks ]] && open_port $ssport - if [[ $v2ray_transport == [45] ]]; then + if [[ $new_v2ray_transport == [45] ]]; then open_port "80" open_port "443" - open_port $v2ray_port - elif [[ $v2ray_transport -ge 18 ]]; then - open_port $v2ray_port + open_port $new_v2ray_port + elif [[ $new_v2ray_transport -ge 18 ]]; then + open_port $new_v2ray_port open_port "multiport" else - open_port $v2ray_port + open_port $new_v2ray_port fi systemctl restart v2ray backup_config @@ -818,19 +823,41 @@ config() { } backup_config() { - sed -i "18s/=1/=$v2ray_transport/; 21s/=2333/=$v2ray_port/; 24s/=$old_id/=$uuid/" $backup - if [[ $v2ray_transport -ge 18 ]]; then - sed -i "30s/=10000/=$v2ray_dynamic_port_start_input/; 33s/=20000/=$v2ray_dynamic_port_end_input/" $backup + + # load backup script + _load backup.sh + + ## v2ray transport, port, uuid + _first_backup v2ray + + ## dynamic port + if [[ $new_v2ray_transport -ge 18 ]]; then + _first_backup dynamicPort fi + + ## ss if [[ $shadowsocks ]]; then - sed -i "42s/=/=true/; 45s/=6666/=$ssport/; 48s/=233blog.com/=$sspass/; 51s/=chacha20-ietf/=$ssciphers/" $backup + _first_backup +ss fi - [[ $v2ray_transport == [45] ]] && sed -i "36s/=233blog.com/=$domain/" $backup - [[ $caddy ]] && sed -i "39s/=/=true/" $backup - [[ $ban_ad ]] && sed -i "54s/=/=true/" $backup + + ## domain, ws+tls / http2 + if [[ $new_v2ray_transport == [45] ]]; then + _first_backup domain + fi + + ## ws+tls / http2, auto config tls + if [[ $caddy ]]; then + _first_backup caddy + fi + + ## ban ad + if [[ $ban_ad ]]; then + _first_backup +ad + fi + + ## ws+tls / http2, path if [[ $is_path ]]; then - sed -i "57s/=/=true/; 60s/=233blog/=$path/" $backup - sed -i "63s#=https://liyafly.com#=$proxy_site#" $backup + _first_backup +path fi } @@ -902,7 +929,7 @@ _install() { install_info # [[ $caddy ]] && domain_check install_v2ray - if [[ $caddy || $v2ray_port == "80" ]]; then + if [[ $caddy || $new_v2ray_port == "80" ]]; then if [[ $cmd == "yum" ]]; then [[ $(pgrep "httpd") ]] && systemctl stop httpd [[ $(command -v httpd) ]] && yum remove httpd -y @@ -942,21 +969,21 @@ _uninstall() { echo -e " $red 大胸弟...你貌似毛有安装 V2Ray ....卸载个鸡鸡哦...$none - 备注...仅支持卸载使用我 (v2ray6.com) 提供的 V2Ray 一键安装脚本 + 备注...仅支持卸载使用我 ($_site) 提供的 V2Ray 一键安装脚本 " && exit 1 fi } -_disableselinux () { - # Configure SELinux - type selinuxenabled >/dev/null 2>&1 || return 0; - [[ ! -f /etc/selinux/config ]] && return 0; - if selinuxenabled; then - setenforce Permissive - # disable selinux needs reboot, set to Permissive - sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config - fi +_disableselinux() { + # Configure SELinux + type selinuxenabled >/dev/null 2>&1 || return 0 + [[ ! -f /etc/selinux/config ]] && return 0 + if selinuxenabled; then + setenforce Permissive + # disable selinux needs reboot, set to Permissive + sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config + fi } args=$1 @@ -987,11 +1014,11 @@ esac clear while :; do echo - echo "........... V2Ray 一键安装脚本 & 管理脚本 by v2ray6.com .........." + echo "........... V2Ray 一键安装脚本 & 管理脚本 by $_site .........." echo - echo "帮助说明: https://v2ray6.com/post/1/" + echo "帮助说明: https://$_site/post/1/" echo - echo "搭建教程: https://v2ray6.com/post/2/" + echo "搭建教程: https://$_site/post/2/" echo echo " 1. 安装" echo diff --git a/src/backup.sh b/src/backup.sh index 93d3da3..22618ec 100644 --- a/src/backup.sh +++ b/src/backup.sh @@ -3,10 +3,10 @@ _backup() { for keys in $*; do case $keys in v2ray_transport) - sed -i "s/v2ray_transport=$v2ray_transport/v2ray_transport=$v2ray_transport_opt/" $backup + sed -i "s/v2ray_transport=$v2ray_transport/v2ray_transport=$new_v2ray_transport/" $backup ;; v2ray_port) - sed -i "s/v2ray_port=$v2ray_port/v2ray_port=$v2ray_port_opt/" $backup + sed -i "s/v2ray_port=$v2ray_port/v2ray_port=$new_v2ray_port/" $backup ;; uuid) sed -i "s/v2ray_id=$v2ray_id/v2ray_id=$uuid/" $backup @@ -95,3 +95,30 @@ _backup() { esac done } +_first_backup(){ + for keys in $*; do + case $keys in + v2ray) + sed -i "s/v2ray_transport=1/v2ray_transport=$v2ray_transport/; s/v2ray_port=2333/v2ray_port=$v2ray_port/; s/v2ray_id=uuid/v2ray_id=$uuid/" $backup + ;; + dynamicPort) + sed -i "s/v2ray_dynamicPort_start=10000/v2ray_dynamicPort_start=$v2ray_dynamic_port_start_input/; s/v2ray_dynamicPort_end=20000/v2ray_dynamicPort_end=$v2ray_dynamic_port_end_input/" $backup + ;; + domain) + sed -i "s/domain=233blog.com/domain=$domain/" $backup + ;; + caddy) + sed -i "s/caddy=/caddy=true/" $backup + ;; + +ss) + sed -i "s/shadowsocks=/shadowsocks=true/; s/ssport=6666/ssport=$ssport/; s/sspass=233blog.com/sspass=$sspass/; s/ssciphers=chacha20-ietf/ssciphers=$ssciphers/" $backup + ;; + +ad) + sed -i "s/ban_ad=/ban_ad=true/" $backup + ;; + +path) + sed -i "s/path_status=/path_status=true/; s/path=233blog/path=$path/; s#proxy_site=https://liyafly.com#proxy_site=$proxy_site#" $backup + ;; + esac + done +} \ No newline at end of file diff --git a/src/ss-info.sh b/src/ss-info.sh index b5bd971..aa7e10d 100644 --- a/src/ss-info.sh +++ b/src/ss-info.sh @@ -1,12 +1,12 @@ [[ -z $ip ]] && get_ip if [[ $shadowsocks ]]; then - #local ss="ss://$(echo -n "${ssciphers}:${sspass}@${ip}:${ssport}" | base64 -w 0)#v2ray6.com_ss_${ip}" + #local ss="ss://$(echo -n "${ssciphers}:${sspass}@${ip}:${ssport}" | base64 -w 0)#${_site}_ss_${ip}" local cipherstr=$(echo -n ${ssciphers}:${sspass} | base64 -w 0 | sed 's/=*$//') local clientopt=$(echo ${ssrayopt} | sed 's/server;\?//') local opt="?plugin=$(echo "v2ray-plugin;${clientopt}" | sed 's/=/%3d/g; s/;/%3b/g;')" - local ss="ss://${cipherstr}@${ip}:${ssport}#v2ray6.com_ss_${ip}" - local ssplugin="ss://${cipherstr}@${ssray_domain}:${ssrayport}/${opt}#v2ray6.com_ssv2_${ssray_domain}" + local ss="ss://${cipherstr}@${ip}:${ssport}#${_site}_ss_${ip}" + local ssplugin="ss://${cipherstr}@${ssray_domain}:${ssrayport}/${opt}#${_site}_ssv2_${ssray_domain}" echo echo "---------- Shadowsocks 配置信息 -------------" @@ -14,7 +14,7 @@ if [[ $shadowsocks ]]; then echo -e "$yellow 服务器地址 = $cyan${ip}$none" echo if [[ $v6ip ]]; then - local ssv6="ss://${cipherstr}@[${v6ip}]:${ssport}#v2ray6.com_ss_${ip}" + local ssv6="ss://${cipherstr}@[${v6ip}]:${ssport}#${_site}_ss_${ip}" echo -e "$yellow 服务器IPv6地址 = $cyan${v6ip}$none" echo fi diff --git a/src/v2ray-info.sh b/src/v2ray-info.sh index 79f5cc8..fdc1989 100644 --- a/src/v2ray-info.sh +++ b/src/v2ray-info.sh @@ -78,7 +78,7 @@ _v2_info() { if [[ $v2ray_transport == [45] ]]; then if [[ ! $caddy ]]; then echo - echo -e " $red警告!$none$yellow请自行配置 TLS...教程: https://v2ray6.com/post/3/$none" + echo -e " $red警告!$none$yellow请自行配置 TLS...教程: https://${_site}/post/3/$none" fi echo echo -e "$yellow 地址 (Address) = $cyan${domain}$none" @@ -134,7 +134,7 @@ _v2_info() { fi echo "---------- END -------------" echo - echo "V2Ray 客户端使用教程: https://v2ray6.com/post/4/" + echo "V2Ray 客户端使用教程: https://${_site}/post/4/" echo echo -e "提示: 输入$cyan v2ray url $none可生成 vmess URL 链接 / 输入$cyan v2ray qr $none可生成二维码链接" echo diff --git a/v2ray.sh b/v2ray.sh index 44a9820..f55e231 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -61,7 +61,6 @@ fi [[ -f $ssraybackup ]] && source $ssraybackup uuid=$(cat /proc/sys/kernel/random/uuid) -old_id="e55c8d17-2cf3-b21a-bcf1-eeacb011ed79" v2ray_server_config="/etc/v2ray/config.json" v2ray_client_config="/etc/v2ray/233blog_v2ray_config.json" v2ray_pid=$(pgrep -f /usr/bin/v2ray/v2ray) @@ -72,6 +71,9 @@ v2ray_ver="$(/usr/bin/v2ray/v2ray -version | head -n 1 | cut -d " " -f2)" systemd=true # _test=true +# site +_site="ddog.xyz" + if [[ $v2ray_ver != v* ]]; then v2ray_ver="v$v2ray_ver" fi @@ -121,7 +123,7 @@ create_vmess_URL_config() { cat >/etc/v2ray/vmess_qr.json <<-EOF { "v": "2", - "ps": "v2ray6.com_${domain}", + "ps": "${_site}_${domain}", "add": "${domain}", "port": "443", "id": "${v2ray_id}", @@ -138,7 +140,7 @@ create_vmess_URL_config() { cat >/etc/v2ray/vmess_qr.json <<-EOF { "v": "2", - "ps": "v2ray6.com_${ip}", + "ps": "${_site}_${ip}", "add": "${ip}", "port": "${v2ray_port}", "id": "${v2ray_id}", @@ -154,7 +156,7 @@ create_vmess_URL_config() { cat >/etc/v2ray/vmess_qrv6.json <<-EOF { "v": "2", - "ps": "v2ray6.com_${v6ip}", + "ps": "${_site}_${v6ip}", "add": "${ip}", "port": "${v2ray_port}", "id": "${v2ray_id}", @@ -228,7 +230,7 @@ get_shadowsocks_config_qr_link() { echo -e "$green 正在生成链接.... 稍等片刻即可....$none" echo get_ip - local ss="ss://$(echo -n "${ssciphers}:${sspass}@${ip}:${ssport}" | base64 -w 0)#v2ray6.com_ss_${ip}" + local ss="ss://$(echo -n "${ssciphers}:${sspass}@${ip}:${ssport}" | base64 -w 0)#${_site}_ss_${ip}" echo "${ss}" >/tmp/233blog_shadowsocks.txt cat /tmp/233blog_shadowsocks.txt | qrencode -s 50 -o /tmp/233blog_shadowsocks.png @@ -365,7 +367,7 @@ shadowsocks_port_config() { ;; [1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) if [[ $v2ray_transport == [45] ]]; then - local tls=ture + local tls=true fi if [[ $tls && $new_ssport == "80" ]] || [[ $tls && $new_ssport == "443" ]]; then echo @@ -483,7 +485,7 @@ change_shadowsocks_port() { ;; [1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) if [[ $v2ray_transport == [45] ]]; then - local tls=ture + local tls=true fi if [[ $tls && $new_ssport == "80" ]] || [[ $tls && $new_ssport == "443" ]]; then echo @@ -1011,46 +1013,46 @@ change_v2ray_port() { echo while :; do echo -e "请输入 "$yellow"V2Ray"$none" 端口 ["$magenta"1-65535"$none"]" - read -p "$(echo -e "(当前端口: ${cyan}${v2ray_port}$none):")" v2ray_port_opt - [[ -z $v2ray_port_opt ]] && error && continue - case $v2ray_port_opt in + read -p "$(echo -e "(当前端口: ${cyan}${v2ray_port}$none):")" new_v2ray_port + [[ -z $new_v2ray_port ]] && error && continue + case $new_v2ray_port in $v2ray_port) echo echo " 哎呀...跟当前端口一毛一样呀...修改个鸡鸡哦" error ;; [1-9] | [1-9][0-9] | [1-9][0-9][0-9] | [1-9][0-9][0-9][0-9] | [1-5][0-9][0-9][0-9][0-9] | 6[0-4][0-9][0-9][0-9] | 65[0-4][0-9][0-9] | 655[0-3][0-5]) - if [[ $dynamicPort ]] && [[ $v2ray_dynamicPort_start == $v2ray_port_opt || $v2ray_dynamicPort_end == $v2ray_port_opt ]]; then + if [[ $dynamicPort ]] && [[ $v2ray_dynamicPort_start == $new_v2ray_port || $v2ray_dynamicPort_end == $new_v2ray_port ]]; then echo echo -e " 抱歉,此端口和 V2Ray 动态端口 冲突,当前 V2Ray 动态端口范围为:${cyan}$port_range${none}" error - elif [[ $dynamicPort ]] && [[ $v2ray_dynamicPort_start -lt $v2ray_port_opt && $v2ray_port_opt -le $v2ray_dynamicPort_end ]]; then + elif [[ $dynamicPort ]] && [[ $v2ray_dynamicPort_start -lt $new_v2ray_port && $new_v2ray_port -le $v2ray_dynamicPort_end ]]; then echo echo -e " 抱歉,此端口和 V2Ray 动态端口 冲突,当前 V2Ray 动态端口范围为:${cyan}$port_range${none}" error - elif [[ $shadowsocks && $v2ray_port_opt == $ssport ]]; then + elif [[ $shadowsocks && $new_v2ray_port == $ssport ]]; then echo echo -e "抱歉, 此端口跟 Shadowsocks 端口冲突...当前 Shadowsocks 端口: ${cyan}$ssport$none" error - elif [[ $socks && $v2ray_port_opt == $socks_port ]]; then + elif [[ $socks && $new_v2ray_port == $socks_port ]]; then echo echo -e "抱歉, 此端口跟 Socks 端口冲突...当前 Socks 端口: ${cyan}$socks_port$none" error - elif [[ $mtproto && $v2ray_port_opt == $mtproto_port ]]; then + elif [[ $mtproto && $new_v2ray_port == $mtproto_port ]]; then echo echo -e "抱歉, 此端口跟 MTProto 端口冲突...当前 MTProto 端口: ${cyan}$mtproto_port$none" error else echo echo - echo -e "$yellow V2Ray 端口 = $cyan$v2ray_port_opt$none" + echo -e "$yellow V2Ray 端口 = $cyan$new_v2ray_port$none" echo "----------------------------------------------------------------" echo pause backup_config v2ray_port del_port $v2ray_port - open_port $v2ray_port_opt - v2ray_port=$v2ray_port_opt + open_port $new_v2ray_port + v2ray_port=$new_v2ray_port config clear view_v2ray_config_info @@ -1101,11 +1103,11 @@ change_v2ray_transport() { echo "备注1: 含有 [dynamicPort] 的即启用动态端口.." echo "备注2: [utp | srtp | wechat-video | dtls | wireguard] 分别伪装成 [BT下载 | 视频通话 | 微信视频通话 | DTLS 1.2 数据包 | WireGuard 数据包]" echo - read -p "$(echo -e "(当前传输协议: ${cyan}${transport[$v2ray_transport - 1]}$none)"):" v2ray_transport_opt - if [ -z "$v2ray_transport_opt" ]; then + read -p "$(echo -e "(当前传输协议: ${cyan}${transport[$v2ray_transport - 1]}$none)"):" new_v2ray_transport + if [ -z "$new_v2ray_transport" ]; then error else - case $v2ray_transport_opt in + case $new_v2ray_transport in $v2ray_transport) echo echo " 哎呀...跟当前传输协议一毛一样呀...修改个鸡鸡哦" @@ -1114,32 +1116,32 @@ change_v2ray_transport() { 4 | 5) if [[ $v2ray_port == "80" || $v2ray_port == "443" ]]; then echo - echo -e " 抱歉...如果你想要使用${cyan} ${transport[$v2ray_transport_opt - 1]} $none传输协议.. ${red}V2Ray 端口不能为 80 或者 443 ...$none" + echo -e " 抱歉...如果你想要使用${cyan} ${transport[$new_v2ray_transport - 1]} $none传输协议.. ${red}V2Ray 端口不能为 80 或者 443 ...$none" echo echo -e " 当前 V2Ray 端口: ${cyan}$v2ray_port$none" error elif [[ $shadowsocks ]] && [[ $ssport == "80" || $ssport == "443" ]]; then echo - echo -e " 抱歉...如果你想要使用${cyan} ${transport[$v2ray_transport_opt - 1]} $none传输协议.. ${red}Shadowsocks 端口不能为 80 或者 443 ...$none" + echo -e " 抱歉...如果你想要使用${cyan} ${transport[$new_v2ray_transport - 1]} $none传输协议.. ${red}Shadowsocks 端口不能为 80 或者 443 ...$none" echo echo -e " 当前 Shadowsocks 端口: ${cyan}$ssport$none" error elif [[ $socks ]] && [[ $socks_port == "80" || $socks_port == "443" ]]; then echo - echo -e " 抱歉...如果你想要使用${cyan} ${transport[$v2ray_transport_opt - 1]} $none传输协议.. ${red}Socks 端口不能为 80 或者 443 ...$none" + echo -e " 抱歉...如果你想要使用${cyan} ${transport[$new_v2ray_transport - 1]} $none传输协议.. ${red}Socks 端口不能为 80 或者 443 ...$none" echo echo -e " 当前 Socks 端口: ${cyan}$socks_port$none" error elif [[ $mtproto ]] && [[ $mtproto_port == "80" || $mtproto_port == "443" ]]; then echo - echo -e " 抱歉...如果你想要使用${cyan} ${transport[$v2ray_transport_opt - 1]} $none传输协议.. ${red}MTProto 端口不能为 80 或者 443 ...$none" + echo -e " 抱歉...如果你想要使用${cyan} ${transport[$new_v2ray_transport - 1]} $none传输协议.. ${red}MTProto 端口不能为 80 或者 443 ...$none" echo echo -e " 当前 MTProto 端口: ${cyan}$mtproto_port$none" error else echo echo - echo -e "$yellow V2Ray 传输协议 = $cyan${transport[$v2ray_transport_opt - 1]}$none" + echo -e "$yellow V2Ray 传输协议 = $cyan${transport[$new_v2ray_transport - 1]}$none" echo "----------------------------------------------------------------" echo break @@ -1148,7 +1150,7 @@ change_v2ray_transport() { [1-9] | [1-2][0-9] | 3[0-2]) echo echo - echo -e "$yellow V2Ray 传输协议 = $cyan${transport[$v2ray_transport_opt - 1]}$none" + echo -e "$yellow V2Ray 传输协议 = $cyan${transport[$new_v2ray_transport - 1]}$none" echo "----------------------------------------------------------------" echo break @@ -1162,9 +1164,9 @@ change_v2ray_transport() { done pause - if [[ $v2ray_transport_opt == [45] ]]; then + if [[ $new_v2ray_transport == [45] ]]; then tls_config - elif [[ $v2ray_transport_opt -ge 18 ]]; then + elif [[ $new_v2ray_transport -ge 18 ]]; then v2ray_dynamic_port_start v2ray_dynamic_port_end pause @@ -1172,14 +1174,14 @@ change_v2ray_transport() { open_port "multiport" backup_config v2ray_transport v2ray_dynamicPort_start v2ray_dynamicPort_end port_range="${v2ray_dynamic_port_start_input}-${v2ray_dynamic_port_end_input}" - v2ray_transport=$v2ray_transport_opt + v2ray_transport=$new_v2ray_transport config clear view_v2ray_config_info else old_transport backup_config v2ray_transport - v2ray_transport=$v2ray_transport_opt + v2ray_transport=$new_v2ray_transport config clear view_v2ray_config_info @@ -1282,13 +1284,13 @@ tls_config() { else update-rc.d -f caddy defaults >/dev/null 2>&1 fi - v2ray_transport=$v2ray_transport_opt + v2ray_transport=$new_v2ray_transport caddy_config config clear view_v2ray_config_info else - if [[ $v2ray_transport_opt == 5 ]]; then + if [[ $new_v2ray_transport == 5 ]]; then path_config_ask pause domain_check @@ -1306,7 +1308,7 @@ tls_config() { install_caddy open_port "80" open_port "443" - v2ray_transport=$v2ray_transport_opt + v2ray_transport=$new_v2ray_transport caddy_config config caddy=true @@ -1361,7 +1363,7 @@ auto_tls_config() { install_caddy open_port "80" open_port "443" - v2ray_transport=$v2ray_transport_opt + v2ray_transport=$new_v2ray_transport caddy_config config caddy=true @@ -1383,7 +1385,7 @@ auto_tls_config() { domain=$new_domain open_port "80" open_port "443" - v2ray_transport=$v2ray_transport_opt + v2ray_transport=$new_v2ray_transport config clear view_v2ray_config_info @@ -2414,7 +2416,7 @@ get_v2ray_config() { echo echo -e "${yellow} HTTP 监听端口 = ${cyan}6666$none" echo - echo "V2Ray 客户端使用教程: https://v2ray6.com/post/4/" + echo "V2Ray 客户端使用教程: https://${_site}/post/4/" echo break else @@ -2441,7 +2443,7 @@ get_v2ray_config_link() { echo echo -e "${yellow} HTTP 监听端口 = ${cyan}6666$none" echo - echo " V2Ray 客户端使用教程: https://v2ray6.com/post/4/" + echo " V2Ray 客户端使用教程: https://${_site}/post/4/" echo echo "备注...链接将在 14 天后失效" echo @@ -2463,7 +2465,7 @@ create_v2ray_config_text() { if [[ $v2ray_transport == [45] ]]; then if [[ ! $caddy ]]; then echo - echo " 警告!请自行配置 TLS...教程: https://v2ray6.com/post/3/" + echo " 警告!请自行配置 TLS...教程: https://${_site}/post/3/" fi echo echo "地址 (Address) = ${domain}" @@ -2516,7 +2518,7 @@ create_v2ray_config_text() { fi echo "---------- END -------------" echo - echo "V2Ray 客户端使用教程: https://v2ray6.com/post/4/" + echo "V2Ray 客户端使用教程: https://${_site}/post/4/" echo } get_v2ray_config_info_link() { @@ -2532,7 +2534,7 @@ get_v2ray_config_info_link() { echo echo -e "$yellow 链接 = $cyan$link$none" echo - echo -e " V2Ray 客户端使用教程: https://v2ray6.com/post/4/" + echo -e " V2Ray 客户端使用教程: https://${_site}/post/4/" echo echo "备注...链接将在 14 天后失效..." echo @@ -2567,7 +2569,7 @@ get_v2ray_config_qr_link() { echo -e "$red 友情提醒: 请务必核对扫码结果 (V2RayNG 除外) $none" echo echo - echo " V2Ray 客户端使用教程: https://v2ray6.com/post/4/" + echo " V2Ray 客户端使用教程: https://${_site}/post/4/" echo echo "备注...链接将在 14 天后失效" echo @@ -2788,7 +2790,7 @@ do_service() { } _help() { echo - echo "........... V2Ray 管理脚本帮助信息 by v2ray6.com .........." + echo "........... V2Ray 管理脚本帮助信息 by ${_site} .........." echo -e " ${green}v2ray menu $none管理 V2Ray (同等于直接输入 v2ray) @@ -2831,17 +2833,17 @@ menu() { clear while :; do echo - echo "........... V2Ray 管理脚本 $_version by v2ray6.com .........." + echo "........... V2Ray 管理脚本 $_version by ${_site} .........." echo echo -e "## V2Ray 版本: $cyan$v2ray_ver$none / V2Ray 状态: $v2ray_status ##" echo - echo "帮助说明: https://v2ray6.com/post/1/" + echo "帮助说明: https://${_site}/post/1/" echo echo "反馈问题: https://github.com/233boy/v2ray/issues" echo echo "TG 群组: https://t.me/blog233" echo - echo "捐赠脚本作者: https://v2ray6.com/donate/" + echo "捐赠脚本作者: https://${_site}/donate/" echo echo "捐助 V2Ray: https://www.v2ray.com/chapter_00/02_donate.html" echo