feat(脚本): 更新

pull/534/merge
mack-a 2020-09-01 17:38:48 +08:00
parent 6c44365385
commit d6de9bde05
1 changed files with 158 additions and 252 deletions

View File

@ -1,6 +1,6 @@
#!/usr/bin/env bash #!/usr/bin/env bash
installType='yum -y install' installType='yum -y install --nobest'
removeType='yum -y remove' removeType='yum -y remove'
upgrade="yum -y update" upgrade="yum -y update"
echoType='echo -e' echoType='echo -e'
@ -12,6 +12,8 @@ centosVersion=0
installProgress=0 installProgress=0
totalProgress=20 totalProgress=20
iplc=$1 iplc=$1
uuidws=
uuidtcp=
trap 'onCtrlC' INT trap 'onCtrlC' INT
function onCtrlC () { function onCtrlC () {
@ -57,18 +59,12 @@ echoContent(){
} }
# 新建目录 # 新建目录
mkdirTools(){ mkdirTools(){
mkdir -p /etc/v2ray/ mkdir -p /etc/v2ray-agent/tls
mkdir -p /etc/v2ray-agent/v2ray
mkdir -p /etc/systemd/system/ mkdir -p /etc/systemd/system/
mkdir -p /etc/nginx/v2ray-agent-https/
mkdir -p /usr/bin/v2ray/
mkdir -p /tmp/v2ray/
mkdir -p /tmp/tls/
} }
# 安装工具包 # 安装工具包
installTools(){ installTools(){
# echo "export LC_ALL=en_US.UTF-8" >> /etc/profile
# source /etc/profile
# kill lock
if [[ "${release}" = "centos" ]] if [[ "${release}" = "centos" ]]
then then
progressTools "yellow" "检查安装jq、nginx epel源、yum-utils--->" 0 progressTools "yellow" "检查安装jq、nginx epel源、yum-utils--->" 0
@ -91,9 +87,9 @@ installTools(){
nginxEpel="http://nginx.org/packages/centos/8/x86_64/RPMS/nginx-1.18.0-1.el8.ngx.x86_64.rpm" nginxEpel="http://nginx.org/packages/centos/8/x86_64/RPMS/nginx-1.18.0-1.el8.ngx.x86_64.rpm"
fi fi
# nginx epel源 # nginx epel源
rpm -ivh ${nginxEpel} > /dev/null 2>&1 rpm -ivh ${nginxEpel} > /etc/v2ray-agent/error.log 2>&1
# yum-utils # yum-utils
yum install yum-utils -y > /dev/null 2>&1 yum install yum-utils --nobest -y > /etc/v2ray-agent/error.log 2>&1
fi fi
# 修复ubuntu个别系统问题 # 修复ubuntu个别系统问题
if [[ "${release}" = "ubuntu" ]] if [[ "${release}" = "ubuntu" ]]
@ -105,44 +101,49 @@ installTools(){
then then
ps -ef|grep -v grep|grep apt|awk '{print $2}'|xargs kill -9 ps -ef|grep -v grep|grep apt|awk '{print $2}'|xargs kill -9
fi fi
progressTools "yellow" "卸载Nginx--->" 1
# echoContent yellow "删除Nginx、V2Ray请等待--->"
if [[ ! -z `find /usr/sbin/ -name nginx` ]]
then
if [[ ! -z `ps -ef|grep nginx|grep -v grep` ]]
then
ps -ef|grep nginx|grep -v grep|awk '{print $2}'|xargs kill -9
fi
if [[ "${release}" = "ubuntu" ]] || [[ "${release}" = "debian" ]] # 卸载V2Ray
then # progressTools "yellow" "卸载Nginx--->" 1
dpkg --get-selections | grep nginx|awk '{print $1}'|xargs sudo apt --purge remove -y > /dev/null # echoContent yellow "删除Nginx、V2Ray请等待--->"
else # if [[ ! -z `find /usr/sbin/ -name nginx` ]]
removeLog=`${removeType} nginx` # then
fi # if [[ ! -z `ps -ef|grep nginx|grep -v grep` ]]
rm -rf /etc/nginx/nginx.conf # then
rm -rf /usr/share/nginx/html.zip # ps -ef|grep nginx|grep -v grep|awk '{print $2}'|xargs kill -9
fi # fi
#
# if [[ "${release}" = "ubuntu" ]] || [[ "${release}" = "debian" ]]
# then
# dpkg --get-selections | grep nginx|awk '{print $1}'|xargs sudo apt --purge remove -y > /dev/null
# else
# removeLog=`${removeType} nginx`
# fi
# rm -rf /etc/nginx/nginx.conf
# rm -rf /usr/share/nginx/html.zip
# fi
progressTools "yellow" "卸载V2Ray--->" 2 # 卸载V2Ray
if [[ ! -z `find /usr/bin/ -name "v2ray*"` ]] # progressTools "yellow" "卸载V2Ray--->" 2
then # if [[ ! -z `find /usr/bin/ -name "v2ray*"` ]]
if [[ ! -z `ps -ef|grep v2ray|grep -v grep` ]] # then
then # if [[ ! -z `ps -ef|grep v2ray|grep -v grep` ]]
ps -ef|grep v2ray|grep -v grep|awk '{print $2}'|xargs kill -9 # then
fi # ps -ef|grep v2ray|grep -v grep|awk '{print $2}'|xargs kill -9
rm -rf /usr/bin/v2ray # fi
fi # rm -rf /usr/bin/v2ray
# fi
progressTools "yellow" "卸载V2Ray开机自启--->" 3 # 卸载V2Ray开机自启
rm -rf /etc/systemd/system/v2ray.service # progressTools "yellow" "卸载V2Ray开机自启--->" 3
if [[ ! -z `find /bin /usr/bin -name "systemctl"` ]] # rm -rf /etc/systemd/system/v2ray.service
then # if [[ ! -z `find /bin /usr/bin -name "systemctl"` ]]
systemctl daemon-reload # then
else # systemctl daemon-reload
echo # else
fi # echo
# fi
# 卸载acme.sh
# progressTools "yellow" "卸载acme.sh--->" 4 # progressTools "yellow" "卸载acme.sh--->" 4
# rm -rf ~/.acme.sh > /dev/null # rm -rf ~/.acme.sh > /dev/null
# if [[ ! -z `cat /root/.bashrc|grep -n acme` ]] # if [[ ! -z `cat /root/.bashrc|grep -n acme` ]]
@ -158,10 +159,13 @@ installTools(){
# yum-complete-transaction --cleanup-only # yum-complete-transaction --cleanup-only
# fi # fi
${upgrade} > /dev/null ${upgrade} > /dev/null
if [[ "${release}" = "centos" ]]
# yum要删除pid then
rm -rf /var/run/yum.pid rm -rf /var/run/yum.pid
fi
# yum要删除pid
progressTools "yellow" "检查、安装wget--->" 6 progressTools "yellow" "检查、安装wget--->" 6
${installType} wget > /dev/null ${installType} wget > /dev/null
@ -191,26 +195,25 @@ installTools(){
# echoContent skyBlue "检查、安装bind-utils--->" # echoContent skyBlue "检查、安装bind-utils--->"
# # progressTool bind-utils # # progressTool bind-utils
# 关闭防火墙 # todo 关闭防火墙
# 安装nginx # 安装nginx
progressTools "yellow" "检查、安装Nginx--->" 12 progressTools "yellow" "检查、安装Nginx--->" 12
# progressTool nginx &
${installType} nginx > /dev/null ${installType} nginx > /dev/null
if [[ ! -z `ps -ef|grep -v grep|grep nginx` ]] if [[ ! -z `ps -ef|grep -v grep|grep nginx` ]]
then then
nginx -s stop nginx -s stop
fi fi
progressTools "yellow" "检查、安装binutils--->" 13 progressTools "yellow" "检查、安装binutils--->" 13
# progressTool nginx &
${installType} binutils > /dev/null ${installType} binutils > /dev/null
# 新建所需目录 # 新建所需目录
mkdirTools # mkdirTools
progressTools "yellow" "检查、安装acme--->" 14 progressTools "yellow" "检查、安装acme--->" 14
mkdir -p /etc/tls/ mkdir -p /etc/tls/
curl -s https://get.acme.sh | sh > /etc/tls/acme.log curl -s https://get.acme.sh | sh > /etc/tls/acme.log
if [[ -z `find ~/.acme.sh -name "acme.sh"` ]] if [[ ! -d "~/.acme.sh" ]]
then then
echoContent red " acme安装失败--->" echoContent red " acme安装失败--->"
echoContent yellow "错误排查:" echoContent yellow "错误排查:"
@ -223,8 +226,10 @@ installTools(){
} }
# 初始化Nginx申请证书配置 # 初始化Nginx申请证书配置
initTLSNginxConfig(){ initTLSNginxConfig(){
handleNginx stop
killSleep > /dev/null 2>&1 killSleep > /dev/null 2>&1
killSleep > /dev/null 2>&1 killSleep > /dev/null 2>&1
echoContent green "初始化Nginx申请证书配置 --->"
echoContent yellow "请输入要配置的域名 例blog.v2ray-agent.com --->" echoContent yellow "请输入要配置的域名 例blog.v2ray-agent.com --->"
read -p "域名:" domain read -p "域名:" domain
if [[ -z ${domain} ]] if [[ -z ${domain} ]]
@ -237,13 +242,13 @@ initTLSNginxConfig(){
touch /etc/nginx/conf.d/alone.conf touch /etc/nginx/conf.d/alone.conf
echo "server {listen 80;server_name ${domain};root /usr/share/nginx/html;location ~ /.well-known {allow all;}location /test {return 200 'fjkvymb6len';}}" > /etc/nginx/conf.d/alone.conf echo "server {listen 80;server_name ${domain};root /usr/share/nginx/html;location ~ /.well-known {allow all;}location /test {return 200 'fjkvymb6len';}}" > /etc/nginx/conf.d/alone.conf
# 启动nginx # 启动nginx
nginx handleNginx start
# 测试nginx # 测试nginx
progressTools "yellow" "检查Nginx是否正常访问--->" 16 progressTools "yellow" "检查Nginx是否正常访问--->" 16
domainResult=`curl -s ${domain}/test|grep fjkvymb6len` domainResult=`curl -s ${domain}/test|grep fjkvymb6len`
if [[ ! -z ${domainResult} ]] if [[ ! -z ${domainResult} ]]
then then
ps -ef|grep nginx|grep -v grep|awk '{print $2}'|xargs kill -9 handleNginx stop
progressTools "green" "Nginx配置成功--->" progressTools "green" "Nginx配置成功--->"
else else
echoContent red " 无法正常访问服务器请检测域名是否正确、域名的DNS解析以及防火墙设置是否正确--->" echoContent red " 无法正常访问服务器请检测域名是否正确、域名的DNS解析以及防火墙设置是否正确--->"
@ -254,31 +259,26 @@ initTLSNginxConfig(){
} }
# 安装TLS # 安装TLS
installTLS(){ installTLS(){
mkdir -p /etc/nginx/v2ray-agent-https/ progressTools "yellow" "申请TLS证书" 17
mkdir -p /etc/v2ray-agent/tls/
touch /etc/nginx/v2ray-agent-https/config
if [[ -z `find /etc/v2ray-agent/tls/ -name "${domain}*"` ]] if [[ -z `find /etc/v2ray-agent/tls/ -name "${domain}*"` ]]
then then
progressTools "yellow" "检查、安装TLS证书--->" 17 progressTools "yellow" "检查、安装TLS证书--->" 17
sudo ~/.acme.sh/acme.sh --issue -d ${domain} --standalone -k ec-256 >/dev/null sudo ~/.acme.sh/acme.sh --issue -d ${domain} --standalone -k ec-256 >/dev/null
~/.acme.sh/acme.sh --installcert -d ${domain} --fullchainpath /etc/nginx/v2ray-agent-https/${domain}.crt --keypath /etc/nginx/v2ray-agent-https/${domain}.key --ecc >/dev/null ~/.acme.sh/acme.sh --installcert -d ${domain} --fullchainpath /etc/v2ray-agent/tls/${domain}.crt --keypath /etc/v2ray-agent/tls/${domain}.key --ecc >/dev/null
if [[ -z `cat /etc/nginx/v2ray-agent-https/${domain}.crt` ]] if [[ -z `cat /etc/v2ray-agent/tls/${domain}.crt` ]]
then then
progressTools "yellow" " TLS安装失败请检查acme日志--->" progressTools "yellow" " TLS安装失败请检查acme日志--->"
exit 0 exit 0
elif [[ -z `cat /etc/nginx/v2ray-agent-https/${domain}.key` ]] elif [[ -z `cat /etc/v2ray-agent/tls/${domain}.key` ]]
then then
progressTools "yellow" " TLS安装失败请检查acme日志--->" progressTools "yellow" " TLS安装失败请检查acme日志--->"
exit 0 exit 0
fi fi
progressTools "green" " TLS生成成功--->>" progressTools "green" " TLS生成成功--->>"
echo ${domain} `date +%s` > /etc/nginx/v2ray-agent-https/config echo ${domain} `date +%s` > /etc/v2ray-agent/tls/config
cp -R /etc/nginx/v2ray-agent-https/config /etc/v2ray-agent/tls/config
cp -R /etc/nginx/v2ray-agent-https/${domain}.crt /etc/v2ray-agent/tls/${domain}.crt
cp -R /etc/nginx/v2ray-agent-https/${domain}.key /etc/v2ray-agent/tls/${domain}.key
progressTools "yellow" " TLS证书备份成功证书位置/etc/v2ray-agent/tls--->" progressTools "yellow" " TLS证书备份成功证书位置/etc/v2ray-agent/tls--->"
elif [[ -z `cat /etc/v2ray-agent/tls/${domain}.crt` ]] || [[ -z `cat /etc/v2ray-agent/tls/${domain}.key` ]] elif [[ -z `cat /etc/v2ray-agent/tls/${domain}.crt` ]] || [[ -z `cat /etc/v2ray-agent/tls/${domain}.key` ]]
then then
@ -286,14 +286,12 @@ installTLS(){
rm -rf /etc/v2ray-agent/tls/ rm -rf /etc/v2ray-agent/tls/
installTLS installTLS
else else
progressTools "yellow" "检测到备份证书,使用--->" progressTools "yellow" "检测到证书,自动使用--->"
cp -R /etc/v2ray-agent/tls/${domain}.crt /etc/nginx/v2ray-agent-https/${domain}.crt
cp -R /etc/v2ray-agent/tls/${domain}.key /etc/nginx/v2ray-agent-https/${domain}.key
cp -R /etc/v2ray-agent/tls/config /etc/nginx/v2ray-agent-https/config
fi fi
} }
# 安装Nginx科学上网配置 # 安装Nginx科学上网配置
initNginxConfig(){ initNginxConfig(){
echoContent green "配置Nginx"
installType=$1 installType=$1
if [[ "${installType}" = "wss" ]] if [[ "${installType}" = "wss" ]]
then then
@ -302,7 +300,7 @@ initNginxConfig(){
listen 443 ssl; listen 443 ssl;
server_name ${domain}; server_name ${domain};
root /usr/share/nginx/html; root /usr/share/nginx/html;
ssl_certificate /etc/nginx/v2ray-agent-https/${domain}.crt;ssl_certificate_key /etc/nginx/v2ray-agent-https/${domain}.key; ssl_certificate /etc/v2ray-agent/tls/${domain}.crt;ssl_certificate_key /etc/v2ray-agent/tls/${domain}.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_prefer_server_ciphers on; ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;ssl_prefer_server_ciphers on;
location / {} location / {}
@ -344,29 +342,22 @@ EOF
} }
# 自定义/随机路径 # 自定义/随机路径
randomPathFunction(){ randomPathFunction(){
progressTools "yellow" "请输入自定义路径Vmess[例: alone],不需要斜杠,[回车]随机路径VLESS则为随机路径" progressTools "yellow" "请输入自定义路径[例: alone],不需要斜杠,[回车]随机路径"
read customPath read -p '路径:' customPath
if [[ ! -z "${customPath}" ]] if [[ -z "${customPath}" ]]
then then
sed -i "s/alone/${customPath}/g" `grep alone -rl /etc/nginx/conf.d/alone.conf`
sed -i "s/vlesspath/${customPath}vld/g" `grep vlesspath -rl /etc/nginx/conf.d/alone.conf`
else
customPath=`head -n 50 /dev/urandom|sed 's/[^a-z]//g'|strings -n 4|tr 'A-Z' 'a-z'|head -1` customPath=`head -n 50 /dev/urandom|sed 's/[^a-z]//g'|strings -n 4|tr 'A-Z' 'a-z'|head -1`
if [[ ! -z "${customPath}" ]]
then
sed -i "s/alone/${customPath}/g" `grep alone -rl /etc/nginx/conf.d/alone.conf`
sed -i "s/vlesspath/${customPath}vld/g" `grep vlesspath -rl /etc/nginx/conf.d/alone.conf`
fi
fi fi
echoContent yellow "path${customPath}" echoContent yellow "path${customPath}"
echoContent yellow "vlessPath${customPath}vld"
} }
# Nginx伪装博客 # Nginx伪装博客
nginxBlog(){ nginxBlog(){
echoContent yellow "添加伪装博客--->"
rm -rf /usr/share/nginx/html rm -rf /usr/share/nginx/html
wget -q -P /usr/share/nginx https://raw.githubusercontent.com/mack-a/v2ray-agent/master/blog/unable/html.zip >> /dev/null wget -q -P /usr/share/nginx https://raw.githubusercontent.com/mack-a/v2ray-agent/master/blog/unable/html.zip > /dev/null
unzip /usr/share/nginx/html.zip -d /usr/share/nginx/html > /dev/null unzip /usr/share/nginx/html.zip -d /usr/share/nginx/html > /dev/null
echoContent yellow "添加伪装博客成功--->"
} }
# 操作Nginx # 操作Nginx
handleNginx(){ handleNginx(){
@ -386,24 +377,21 @@ handleNginx(){
# 定时任务更新tls证书 # 定时任务更新tls证书
installCronTLS(){ installCronTLS(){
progressTools "yellow" "检查、添加定时维护证书--->" 19 progressTools "yellow" "检查、添加定时维护证书--->" 19
touch /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh
touch /etc/nginx/v2ray-agent-https/backup_crontab.cron
touch /etc/v2ray-agent/tls/tls.log
if [[ -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]] if [[ -z `crontab -l|grep -v grep|grep 'reloadInstallTLS'` ]]
then then
crontab -l >> /etc/nginx/v2ray-agent-https/backup_crontab.cron crontab -l >> /etc/v2ray-agent/backup_crontab.cron
# 定时任务 # 定时任务
echo "30 1 * * * /bin/bash /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh" >> /etc/nginx/v2ray-agent-https/backup_crontab.cron echo "30 1 * * * /bin/bash /etc/v2ray-agent/reloadInstallTLS.sh" >> /etc/v2ray-agent/backup_crontab.cron
crontab /etc/nginx/v2ray-agent-https/backup_crontab.cron crontab /etc/v2ray-agent/backup_crontab.cron
fi fi
# 备份 # 备份
cat << EOF > /etc/nginx/v2ray-agent-https/reloadInstallTLS.sh cat << EOF > /etc/v2ray-agent/reloadInstallTLS.sh
domain=${domain} domain=${domain}
eccPath=\`find ~/.acme.sh -name "\${domain}_ecc"|head -1\` eccPath=\`find ~/.acme.sh -name "\${domain}_ecc"|head -1\`
mkdir -p /etc/v2ray-agent/tls # mkdir -p /etc/v2ray-agent/tls
touch /etc/v2ray-agent/tls/tls.log # touch /etc/v2ray-agent/tls/tls.log
touch /etc/v2ray-agent/tls/acme.log # touch /etc/v2ray-agent/tls/acme.log
if [[ ! -z \${eccPath} ]] if [[ ! -z \${eccPath} ]]
then then
modifyTime=\`stat \${eccPath}/\${domain}.key|sed -n '6,6p'|awk '{print \$2" "\$3" "\$4" "\$5}'\` modifyTime=\`stat \${eccPath}/\${domain}.key|sed -n '6,6p'|awk '{print \$2" "\$3" "\$4" "\$5}'\`
@ -416,7 +404,7 @@ installCronTLS(){
if [[ ! -z \${modifyTime} ]] && [[ ! -z \${currentTime} ]] && [[ ! -z \${stampDiff} ]] && [[ ! -z \${minutes} ]] && [[ \${minutes} -lt '120' ]] if [[ ! -z \${modifyTime} ]] && [[ ! -z \${currentTime} ]] && [[ ! -z \${stampDiff} ]] && [[ ! -z \${minutes} ]] && [[ \${minutes} -lt '120' ]]
then then
nginx -s stop nginx -s stop
~/.acme.sh/acme.sh --installcert -d \${domain} --fullchainpath /etc/nginx/v2ray-agent-https/\${domain}.crt --keypath /etc/nginx/v2ray-agent-https/\${domain}.key --ecc >> /tmp/tls/acme.log ~/.acme.sh/acme.sh --installcert -d \${domain} --fullchainpath /etc/v2ray-agent/tls/\${domain}.crt --keypath /etc/v2ray-agent/tls/\${domain}.key --ecc >> /etc/v2ray-agent/tls/acme.log
nginx nginx
reloadTime=\`date -d @\${currentTime} +"%F %H:%M:%S"\` reloadTime=\`date -d @\${currentTime} +"%F %H:%M:%S"\`
fi fi
@ -430,20 +418,18 @@ EOF
then then
progressTools "green" " 添加定时维护证书成功" progressTools "green" " 添加定时维护证书成功"
else else
crontab -l >> /etc/nginx/v2ray-agent-https/backup_crontab.cron crontab -l >> /etc/v2ray-agent/backup_crontab.cron
# 定时任务 # 定时任务
crontab /etc/nginx/v2ray-agent-https/backup_crontab.cron crontab /etc/v2ray-agent/backup_crontab.cron
progressTools "green" " 检测到已添加定时任务" progressTools "green" " 检测到已添加定时任务"
fi fi
} }
# 安装V2Ray # 安装V2Ray
installV2Ray(){ installV2Ray(){
# ls -F /usr/bin/v2ray/|grep "v2ray" # ls -F /usr/bin/v2ray/|grep "v2ray"
mkdir -p /usr/bin/v2ray/ # mkdir -p /usr/bin/v2ray/
mkdir -p /etc/v2ray-agent/v2ray/ # mkdir -p /etc/v2ray-agent/v2ray/
if [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ctl"` ]] if [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep "v2ctl"` ]]
then
if [[ -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]] || [[ -z `ls -F /usr/bin/v2ray/|grep "v2ctl"` ]]
then then
progressTools "yellow" "检查、安装V2Ray--->" 20 progressTools "yellow" "检查、安装V2Ray--->" 20
version=`curl -s https://github.com/v2fly/v2ray-core/releases|grep /v2ray-core/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'` version=`curl -s https://github.com/v2fly/v2ray-core/releases|grep /v2ray-core/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'`
@ -451,27 +437,10 @@ installV2Ray(){
wget -q -P /etc/v2ray-agent/v2ray https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip wget -q -P /etc/v2ray-agent/v2ray https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip
unzip /etc/v2ray-agent/v2ray/v2ray-linux-64.zip -d /etc/v2ray-agent/v2ray > /dev/null unzip /etc/v2ray-agent/v2ray/v2ray-linux-64.zip -d /etc/v2ray-agent/v2ray > /dev/null
cp /etc/v2ray-agent/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /etc/v2ray-agent/v2ray/v2ctl /usr/bin/v2ray/v2ctl
rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip
fi
else else
progressTools "green" " v2ray-core版本:`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1`" progressTools "green" " v2ray-core版本:`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1`"
cp /etc/v2ray-agent/v2ray/v2ray /usr/bin/v2ray/v2ray && cp /etc/v2ray-agent/v2ray/v2ctl /usr/bin/v2ray/v2ctl
fi fi
# todo
# echoContent yellow "V2Ray日志目录"
# echoContent green " access: /etc/v2ray/v2ray_access_ws_tls.log"
# echoContent green " error: /etc/v2ray/v2ray_error_ws_tls.log"
# qrEncode $1 $2
# progressTools "yellow" "安装完毕[100%]--->"
# echoContent yellow "============================成功分界线============================="
# progressTools "yellow" "监听V2Ray日志中请使用上方生成的vmess访问如有日志出现则证明线路可用退出监听也无妨Ctrl+c退出监听日志--->"
# echo '' > /etc/v2ray/v2ray_access_ws_tls.log
# killSleep > /dev/null 2>&1
# tail -f /etc/v2ray/v2ray_access_ws_tls.log
} }
# 验证整个服务是否可用 # 验证整个服务是否可用
checkGFWStatue(){ checkGFWStatue(){
@ -491,16 +460,16 @@ checkGFWStatue(){
fi fi
elif [[ "${globalType}" = "tcp" ]] elif [[ "${globalType}" = "tcp" ]]
then then
echo '' > /etc/v2ray/v2ray_access_ws_tls.log echo '' > /etc/v2ray-agent/v2ray/v2ray_access_ws_tls.log
curl --connect-time 3 --max-time 1 --url https://${domain} > /dev/null 2>&1 curl --connect-time 3 --max-time 1 --url https://${domain} > /dev/null 2>&1
sleep 0.1 sleep 0.1
if [[ ! -z `cat /etc/v2ray/v2ray_access_ws_tls.log|grep -v grep|grep "Not Found"` ]] if [[ ! -z `cat /etc/v2ray-agent/v2ray/v2ray_access_ws_tls.log|grep -v grep|grep "Not Found"` ]]
then then
progressTools "green" " 服务可用--->" progressTools "green" " 服务可用--->"
else else
progressTools "red" " 服务不可用" progressTools "red" " 服务不可用"
progressTools "red" " 1.请检查云朵是否关闭" progressTools "red" " 1.请检查云朵是否关闭"
progressTools "red" " 2.请手动尝试使用账号并观察日志,日志路径[/etc/v2ray/v2ray_access_ws_tls.log]" progressTools "red" " 2.请手动尝试使用账号并观察日志,日志路径[/etc/v2ray-agent/v2ray/v2ray_access_ws_tls.log]"
exit 0 exit 0
fi fi
elif [[ "${globalType}" = "vlesstcpws" ]] elif [[ "${globalType}" = "vlesstcpws" ]]
@ -515,9 +484,6 @@ checkGFWStatue(){
exit 0 exit 0
fi fi
fi fi
} }
# 开机自启 # 开机自启
installV2RayService(){ installV2RayService(){
@ -539,7 +505,7 @@ installV2RayService(){
User=root User=root
CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_RAW CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_NET_RAW
NoNewPrivileges=yes NoNewPrivileges=yes
ExecStart=/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json ExecStart=/etc/v2ray-agent/v2ray/v2ray -config /etc/v2ray-agent/v2ray/config.json
Restart=on-failure Restart=on-failure
RestartPreventExitStatus=23 RestartPreventExitStatus=23
@ -567,7 +533,7 @@ handleV2Ray(){
then then
if [[ -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ "$1" = "start" ]] if [[ -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ "$1" = "start" ]]
then then
/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json & > /dev/null 2>&1 /usr/bin/v2ray/v2ray -config /etc/v2ray-agent/v2ray/config.json & > /dev/null 2>&1
elif [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ "$1" = "stop" ]] elif [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ "$1" = "stop" ]]
then then
ps -ef|grep -v grep|grep v2ray|awk '{print $2}'|xargs kill -9 ps -ef|grep -v grep|grep v2ray|awk '{print $2}'|xargs kill -9
@ -580,7 +546,7 @@ handleV2Ray(){
echoContent green "V2Ray启动成功" no echoContent green "V2Ray启动成功" no
else else
echoContent red "V2Ray启动失败" no echoContent red "V2Ray启动失败" no
echoContent red "请手动执行【/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json】,查看错误日志" no echoContent red "请手动执行【/usr/bin/v2ray/v2ray -config /etc/v2ray-agent/v2ray/config.json】,查看错误日志" no
exit 0; exit 0;
fi fi
elif [[ "$1" = "stop" ]] elif [[ "$1" = "stop" ]]
@ -598,17 +564,17 @@ handleV2Ray(){
# 初始化V2Ray 配置文件 # 初始化V2Ray 配置文件
initV2RayConfig(){ initV2RayConfig(){
touch /etc/v2ray/config.json uuidtcp=`/etc/v2ray-agent/v2ray/v2ctl uuid`
uuid=`/usr/bin/v2ray/v2ctl uuid` uuidws=`/etc/v2ray-agent/v2ray/v2ctl uuid`
# 自定义IPLC端口 # 自定义IPLC端口
if [[ ! -z ${iplc} ]] if [[ ! -z ${iplc} ]]
then then
cat << EOF > /etc/v2ray/config.json cat << EOF > /etc/v2ray-agent/v2ray/config.json
{ {
"log":{ "log":{
"access":"/etc/v2ray/v2ray_access_ws_tls.log", "access":"/etc/v2ray-agent/v2ray/v2ray_access_ws_tls.log",
"error":"/etc/v2ray/v2ray_error_ws_tls.log", "error":"/etc/v2ray-agent/v2ray/v2ray_error_ws_tls.log",
"loglevel":"debug" "loglevel":"debug"
}, },
"stats":{ "stats":{
@ -648,7 +614,7 @@ initV2RayConfig(){
"settings":{ "settings":{
"clients":[ "clients":[
{ {
"id":"${uuid}", "id":"${uuidws}",
"alterId":64, "alterId":64,
"level":1, "level":1,
"email":"test@v2ray.com" "email":"test@v2ray.com"
@ -739,11 +705,12 @@ initV2RayConfig(){
EOF EOF
elif [[ "$1" = "wss" ]] elif [[ "$1" = "wss" ]]
then then
cat << EOF > /etc/v2ray/config.json # todo vless 废弃
cat << EOF > /etc/v2ray-agent/v2ray/config.json
{ {
"log":{ "log":{
"access":"/etc/v2ray/v2ray_access_ws_tls.log", "access":"/etc/v2ray-agent/v2ray/v2ray_access_ws_tls.log",
"error":"/etc/v2ray/v2ray_error_ws_tls.log", "error":"/etc/v2ray-agent/v2ray/v2ray_error_ws_tls.log",
"loglevel":"debug" "loglevel":"debug"
}, },
"allocate":{ "allocate":{
@ -758,7 +725,7 @@ EOF
"settings":{ "settings":{
"clients":[ "clients":[
{ {
"id":"${uuid}", "id":"${uuidws}",
"alterId":0, "alterId":0,
"level":1, "level":1,
"email":"test@v2ray.com" "email":"test@v2ray.com"
@ -816,11 +783,11 @@ EOF
EOF EOF
elif [[ "$1" = "tcp" ]] elif [[ "$1" = "tcp" ]]
then then
cat << EOF > /etc/v2ray/config.json cat << EOF > /etc/v2ray-agent/v2ray/config.json
{ {
"log":{ "log":{
"access":"/etc/v2ray/v2ray_access_ws_tls.log", "access":"/etc/v2ray-agent/v2ray/v2ray_access_ws_tls.log",
"error":"/etc/v2ray/v2ray_error_ws_tls.log", "error":"/etc/v2ray-agent/v2ray/v2ray_error_ws_tls.log",
"loglevel":"debug" "loglevel":"debug"
}, },
"inbounds": [ "inbounds": [
@ -830,7 +797,7 @@ EOF
"settings": { "settings": {
"clients": [ "clients": [
{ {
"id": "${uuid}", "id": "${uuidtcp}",
"alterId": 0, "alterId": 0,
"email":"test@v2ray.com" "email":"test@v2ray.com"
} }
@ -842,8 +809,8 @@ EOF
"tlsSettings": { "tlsSettings": {
"certificates": [ "certificates": [
{ {
"certificateFile": "/etc/nginx/v2ray-agent-https/${domain}.crt", "certificateFile": "/etc/v2ray-agent/tls/${domain}.crt",
"keyFile": "/etc/nginx/v2ray-agent-https/${domain}.key" "keyFile": "/etc/v2ray-agent/tls/${domain}.key"
} }
] ]
} }
@ -867,11 +834,11 @@ EOF
EOF EOF
elif [[ "$1" = "vlesstcpws" ]] elif [[ "$1" = "vlesstcpws" ]]
then then
cat << EOF > /etc/v2ray/config.json cat << EOF > /etc/v2ray-agent/v2ray/config.json
{ {
"log": { "log": {
"access": "/etc/v2ray/v2ray_access_ws_tls.log", "access":"/etc/v2ray-agent/v2ray/v2ray_access_ws_tls.log",
"error": "/etc/v2ray/v2ray_error_ws_tls.log", "error":"/etc/v2ray-agent/v2ray/v2ray_error_ws_tls.log",
"loglevel": "debug" "loglevel": "debug"
}, },
"inbounds": [ "inbounds": [
@ -881,7 +848,7 @@ EOF
"settings": { "settings": {
"clients": [ "clients": [
{ {
"id": "${uuid}", "id": "${uuidtcp}",
"alterId": 0, "alterId": 0,
"email": "test@v2ray.com" "email": "test@v2ray.com"
} }
@ -889,7 +856,8 @@ EOF
"decryption": "none", "decryption": "none",
"fallbacks": [ "fallbacks": [
{ {
"dest": 80 "dest": 80,
"xver": 1
}, },
{ {
"path": "/${customPath}", "path": "/${customPath}",
@ -907,8 +875,8 @@ EOF
], ],
"certificates": [ "certificates": [
{ {
"certificateFile": "/etc/nginx/v2ray-agent-https/${domain}.crt", "certificateFile": "/etc/v2ray-agent/tls/${domain}.crt",
"keyFile": "/etc/nginx/v2ray-agent-https/${domain}.key" "keyFile": "/etc/v2ray-agent/tls/${domain}.key"
} }
] ]
} }
@ -920,7 +888,7 @@ EOF
"settings": { "settings": {
"clients": [ "clients": [
{ {
"id": "${uuid}", "id": "${uuidws}",
"alterId": 0, "alterId": 0,
"level": 1, "level": 1,
"email": "test@v2ray.com" "email": "test@v2ray.com"
@ -957,14 +925,13 @@ EOF
} }
# 自定义CDN IP # 自定义CDN IP
customCDNIP(){ customCDNIP(){
echoContent green "是否使用DNS智能解析进行自定义CDN IP" echoContent yellow "是否使用DNS智能解析进行自定义CDN IP"
echoContent yellow " 智能DNS提供一下自定义CDN IP会根据运营商自动切换ip测试结果请查看[https://github.com/mack-a/v2ray-agent/blob/master/optimize_V2Ray.md]" "no" echoContent skyBlue "智能DNS根据运营商自动切换CDN IP详情请查看[https://github.com/mack-a/v2ray-agent/blob/master/optimize_V2Ray.md]" "no"
echoContent yellow " 移动:104.19.16.102" "no" echoContent yellow " 移动:104.19.41.56" "no"
echoContent yellow " 联通:104.16.160.136" "no" echoContent yellow " 联通:104.16.160.136" "no"
echoContent yellow " 电信:104.16.160.136" "no" echoContent yellow " 电信:104.16.160.136"
echoContent green "输入[y]使用,[任意]不使用" "no" read -n1 -p '[y]使用,[回车]不使用:' dnsProxy
read dnsProxy
if [[ "${dnsProxy}" = "y" ]] if [[ "${dnsProxy}" = "y" ]]
then then
add="domain08.qiu4.ml" add="domain08.qiu4.ml"
@ -972,7 +939,7 @@ customCDNIP(){
} }
# 生成账号base64链接 # 生成账号base64链接
buildAccounts(){ buildAccounts(){
user=`cat /etc/v2ray/config.json|jq .inbounds[0]` user=`cat /etc/v2ray-agent/v2ray/config.json|jq .inbounds[0]`
ps="${domain}" ps="${domain}"
id=`echo ${user}|jq .settings.clients[0].id` id=`echo ${user}|jq .settings.clients[0].id`
aid=`echo ${user}|jq .settings.clients[0].alterId` aid=`echo ${user}|jq .settings.clients[0].alterId`
@ -1005,8 +972,8 @@ defaultBase64Code(){
# 通用Vmess # 通用Vmess
echoContent red "通用vmess(tcp+tls)链接--->" "no" echoContent red "通用vmess(tcp+tls)链接--->" "no"
echoContent green " vmess://${qrCodeBase64Default}\n" echoContent green " vmess://${qrCodeBase64Default}\n"
echo "通用vmess(tcp+tls)链接: " > /etc/v2ray/usersv2ray.conf echo "通用vmess(tcp+tls)链接: " > /etc/v2ray-agent/v2ray/usersv2ray.conf
echo " vmess://${qrCodeBase64Default}" >> /etc/v2ray/usersv2ray.conf echo " vmess://${qrCodeBase64Default}" >> /etc/v2ray-agent/v2ray/usersv2ray.conf
elif [[ ${globalType} = "wss" ]] elif [[ ${globalType} = "wss" ]]
then then
qrCodeBase64Default=`echo -n '{"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":'${path}',"net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'"}'|sed 's#/#\\\/#g'|base64` qrCodeBase64Default=`echo -n '{"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":'${path}',"net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'"}'|sed 's#/#\\\/#g'|base64`
@ -1015,8 +982,8 @@ defaultBase64Code(){
echoContent green ' {"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":'${path}',"net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'"}\n' echoContent green ' {"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":'${path}',"net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'"}\n'
echoContent red "通用vmess(ws+tls)链接--->" "no" echoContent red "通用vmess(ws+tls)链接--->" "no"
echoContent green " vmess://${qrCodeBase64Default}\n" echoContent green " vmess://${qrCodeBase64Default}\n"
echo "通用vmess(ws+tls)链接: " > /etc/v2ray/usersv2ray.conf echo "通用vmess(ws+tls)链接: " > /etc/v2ray-agent/v2ray/usersv2ray.conf
echo " vmess://${qrCodeBase64Default}" >> /etc/v2ray/usersv2ray.conf echo " vmess://${qrCodeBase64Default}" >> /etc/v2ray-agent/v2ray/usersv2ray.conf
elif [[ "${globalType}" = "h2" ]] elif [[ "${globalType}" = "h2" ]]
then then
qrCodeBase64Default=`echo -n '{"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":'${path}',"net":"h2","add":"'${add}'","allowInsecure":0,"method":"none","peer":""}'|sed 's#/#\\\/#g'|base64` qrCodeBase64Default=`echo -n '{"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":'${path}',"net":"h2","add":"'${add}'","allowInsecure":0,"method":"none","peer":""}'|sed 's#/#\\\/#g'|base64`
@ -1032,8 +999,8 @@ defaultBase64Code(){
echoContent green ' {"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":'${path}',"net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'"}\n' echoContent green ' {"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"aid":"0","v":"2","host":"'${host}'","type":"none","path":'${path}',"net":"ws","add":"'${add}'","allowInsecure":0,"method":"none","peer":"'${host}'"}\n'
echoContent red "通用vmess(ws+tls)链接--->" "no" echoContent red "通用vmess(ws+tls)链接--->" "no"
echoContent green " vmess://${qrCodeBase64Default}\n" echoContent green " vmess://${qrCodeBase64Default}\n"
echo "通用vmess(ws+tls)链接: " > /etc/v2ray/usersv2ray.conf echo "通用vmess(ws+tls)链接: " > /etc/v2ray-agent/v2ray/usersv2ray.conf
echo " vmess://${qrCodeBase64Default}" >> /etc/v2ray/usersv2ray.conf echo " vmess://${qrCodeBase64Default}" >> /etc/v2ray-agent/v2ray/usersv2ray.conf
echoContent red "通用json(VLESS+tcp+tls)--->" "no" echoContent red "通用json(VLESS+tcp+tls)--->" "no"
echoContent green ' {"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"host":"'${host}'","type":"none","net":"tcp","add":"'${host}'","allowInsecure":0,"method":"none","peer":""}\n' echoContent green ' {"port":"443","ps":"'${ps}'","tls":"tls","id":'"${id}"',"host":"'${host}'","type":"none","net":"tcp","add":"'${host}'","allowInsecure":0,"method":"none","peer":""}\n'
@ -1052,9 +1019,9 @@ quanMultBase64Code(){
qrCodeBase64Quanmult=`echo ${qrCodeBase64Quanmult}|sed 's/ //g'` qrCodeBase64Quanmult=`echo ${qrCodeBase64Quanmult}|sed 's/ //g'`
echoContent red "Quantumult vmess--->" "no" echoContent red "Quantumult vmess--->" "no"
echoContent green " vmess://${qrCodeBase64Quanmult}\n" echoContent green " vmess://${qrCodeBase64Quanmult}\n"
echo '' >> /etc/v2ray/usersv2ray.conf echo '' >> /etc/v2ray-agent/v2ray/usersv2ray.conf
echo "Quantumult:" >> /etc/v2ray/usersv2ray.conf echo "Quantumult:" >> /etc/v2ray-agent/v2ray/usersv2ray.conf
echo " vmess://${qrCodeBase64Quanmult}" >> /etc/v2ray/usersv2ray.conf echo " vmess://${qrCodeBase64Quanmult}" >> /etc/v2ray-agent/v2ray/usersv2ray.conf
echoContent red "Quantumult 明文--->" "no" echoContent red "Quantumult 明文--->" "no"
echoContent green ' '${ps}' = vmess, '${add}', 443, aes-128-cfb, '${id}', over-tls=true, tls-host='${host}', certificate=1, obfs=ws, obfs-path='${path}', obfs-header="Host: '${host}'[Rr][Nn]User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Mobile/15D100"' echoContent green ' '${ps}' = vmess, '${add}', 443, aes-128-cfb, '${id}', over-tls=true, tls-host='${host}', certificate=1, obfs=ws, obfs-path='${path}', obfs-header="Host: '${host}'[Rr][Nn]User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 11_2_6 like Mac OS X) AppleWebKit/604.5.6 (KHTML, like Gecko) Mobile/15D100"'
} }
@ -1137,91 +1104,29 @@ menu(){
mkdirTools mkdirTools
cd cd
echoContent red "==============================================================" "no" echoContent red "==============================================================" "no"
echoContent green "V2Ray+wss+Nginx+Web/TLS+TCP+V2Ray/VLESS+TCP+V2Ray+Web一键脚本" "no"
echoContent green "作者mack-a" no echoContent green "作者mack-a" no
echoContent green "Versionv1.0.9" no echoContent green "Versionv1.0.9" no
echoContent red "==============================================================" "no" echoContent red "==============================================================" "no"
echoContent yellow "1.V2Ray+WS+TLS+Nginx+Web" "no" echoContent yellow "1.V2Ray+VLESS+TLS+TCP+Web/V2Ray+Vmess+TLS+WS+Web[CDN 云朵必须为灰色]" "no"
echoContent yellow "2.V2Ray+TCP+TLS" "no" # echoContent yellow "2.V2Ray+TCP+TLS" "no"
echoContent yellow "3.V2Ray+VLESS+TLS+TCP+Web/V2Ray+Vmess+TLS+WS+Web[CDN 云朵必须为灰色]" "no" echoContent red "==============================================================" "no"
# echoContent yellow "4.状态展示" "no" echoContent yellow "4.更新V2Ray[todo]" "no"
# echoContent yellow "5.安装BBR" "no" echoContent yellow "5.状态展示[todo]" "no"
# echoContent yellow "6.卸载脚本" "no" echoContent yellow "6.安装BBR[todo]" "no"
echoContent yellow "7.卸载脚本[todo]" "no"
echoContent red "==============================================================" "no" echoContent red "==============================================================" "no"
read -n1 -p "请选择:" selectInstallType read -n1 -p "请选择:" selectInstallType
case ${selectInstallType} in case ${selectInstallType} in
1) 1)
installV2RayVmessWSSNginxWeb
;;
2)
installV2RayVmessTCPTLS
;;
3)
installV2RayVLESSTCPWSTLS installV2RayVLESSTCPWSTLS
;; ;;
# 2)
# installV2RayVmessTCPTLS
# ;;
esac esac
echoContent red "未实现"
exit 0; exit 0;
# ===============
# todo 这里判断每次安装的内容
installSelect=0
if [[ ${tlsStatus} = "1" ]] && [[ ${v2rayStatus} = "1" ]]
then
echoContent green "检测到已使用本脚本安装" "no"
echoContent yellow " 1.重新安装【使用缓存的文件TLS证书、V2Ray】" "no"
echoContent yellow " 2.完全重装【会清理tmp缓存文件TLS证书、V2Ray】" "no"
else
echoContent green "未监测到使用本脚本安装" "no"
echoContent yellow " 1.安装【未安装】" "no"
echoContent yellow " 2.完全安装【会清理tmp缓存文件TLS证书、V2Ray】" "no"
fi
echoContent yellow " 3.BBR安装[推荐BBR+FQ 或者 BBR+Cake]" "no"
echoContent yellow " 4.完全卸载[清理Nginx、TLS证书、V2Ray、acme.sh]" "no"
echoContent red "==============================================================" "no"
echoContent green "请输入上列数字,[任意]结束:" "no"
read installStatus
if [[ "${installStatus}" = "1" ]]
then
rm -rf /etc/v2ray/usersv2ray.conf
installTools
installNginx
elif [[ "${installStatus}" = "2" ]]
then
rm -rf /usr/bin/v2ray
rm -rf /etc/v2ray-agent/v2ray
rm -rf /etc/v2ray-agent/tls
rm -rf /etc/v2ray
installTools
installNginx
elif [[ "${installStatus}" = "3" ]]
then
echoContent red "==============================================================" "no"
echoContent green "BBR脚本用的[ylx2016]的成熟作品,地址[https://github.com/ylx2016/Linux-NetSpeed/releases/download/sh/tcp.sh],请熟知" "no"
echoContent red " 1.安装" "no"
echoContent red " 2.回退主目录" "no"
echoContent red "==============================================================" "no"
echoContent green "请输入[1]安装,[2]回到上层目录" "no"
read installBBRStatus
if [[ "${installBBRStatus}" = "1" ]]
then
wget -N --no-check-certificate "https://github.com/ylx2016/Linux-NetSpeed/releases/download/sh/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
else
init
fi
elif [[ "${installStatus}" = "4" ]]
then
removeInstall
echoContent yellow "卸载完成" "no"
killSleep > /dev/null 2>&1
exit 0;
else
echoContent yellow "欢迎下次使用--->" "no"
killSleep > /dev/null 2>&1
exit 0;
fi
} }
# 安装V2Ray+wss+Nginx+Web # 安装V2Ray+wss+Nginx+Web
installV2RayVmessWSSNginxWeb(){ installV2RayVmessWSSNginxWeb(){
@ -1263,8 +1168,9 @@ installV2RayVmessTCPTLS(){
progressTools "yellow" "安装完毕[100%]--->" progressTools "yellow" "安装完毕[100%]--->"
} }
installV2RayVLESSTCPWSTLS(){ installV2RayVLESSTCPWSTLS(){
mkdirTools
globalType=vlesstcpws globalType=vlesstcpws
installTools # installTools
# 申请tls # 申请tls
initTLSNginxConfig initTLSNginxConfig
installTLS installTLS
@ -1305,25 +1211,25 @@ errorMessage(){
state(){ state(){
echoContent red "状态展示" echoContent red "状态展示"
echoContent green "已安装账号:" echoContent green "已安装账号:"
if [[ ! -z `find /etc|grep usersv2ray.conf` ]] && [[ ! -z `cat /etc/v2ray/usersv2ray.conf` ]] if [[ ! -z `find /etc|grep usersv2ray.conf` ]] && [[ ! -z `cat /etc/v2ray-agent/v2ray/usersv2ray.conf` ]]
then then
cat /etc/v2ray/usersv2ray.conf cat /etc/v2ray-agent/v2ray/usersv2ray.conf
else else
echoContent yellow " 暂无配置" echoContent yellow " 暂无配置"
fi fi
echoContent green "\nV2Ray信息" echoContent green "\nV2Ray信息"
v2rayStatus=0 v2rayStatus=0
if [[ ! -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]] && [[ ! -z `find /etc/v2ray/ -name "config.json"` ]] if [[ ! -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]] && [[ ! -z `find /etc/v2ray-agent/v2ray/ -name "config.json"` ]]
then then
v2rayVersion=`/usr/bin/v2ray/v2ray -version|awk '{print $2}'|head -1` v2rayVersion=`/usr/bin/v2ray/v2ray -version|awk '{print $2}'|head -1`
v2rayStatus=1 v2rayStatus=1
echoContent yellow " version${v2rayVersion}" echoContent yellow " version${v2rayVersion}"
echoContent yellow " 安装路径:/usr/bin/v2ray/" echoContent yellow " 安装路径:/usr/bin/v2ray/"
echoContent yellow " 配置文件:/etc/v2ray/config.json" echoContent yellow " 配置文件:/etc/v2ray-agent/v2ray/config.json"
echoContent yellow " 日志路径:" echoContent yellow " 日志路径:"
echoContent yellow " access: /etc/v2ray/v2ray_access_ws_tls.log" echoContent yellow " access: /etc/v2ray-agent/v2ray/v2ray_access_ws_tls.log"
echoContent yellow " error: /etc/v2ray/v2ray_error_ws_tls.log" echoContent yellow " error: /etc/v2ray-agent/v2ray/v2ray_error_ws_tls.log"
else else
echoContent yellow " 暂未安装" echoContent yellow " 暂未安装"
fi fi
@ -1373,7 +1279,7 @@ state(){
echoContent yellow " V2Ray:【运行中】" echoContent yellow " V2Ray:【运行中】"
elif [[ ! -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]] elif [[ ! -z `ls -F /usr/bin/v2ray/|grep "v2ray"` ]]
then then
echoContent yellow " V2Ray:【未运行】,执行【/usr/bin/v2ray/v2ray -config /etc/v2ray/config.json &】运行" echoContent yellow " V2Ray:【未运行】,执行【/usr/bin/v2ray/v2ray -config /etc/v2ray-agent/v2ray/config.json &】运行"
else else
echoContent yellow " V2Ray:【未安装】" echoContent yellow " V2Ray:【未安装】"
fi fi