mirror of https://github.com/mack-a/v2ray-agent
Merge branch 'dev'
commit
14fafed4d7
609
install.sh
609
install.sh
|
@ -5,6 +5,8 @@ removeType='yum -y remove'
|
||||||
upgrade="yum -y update"
|
upgrade="yum -y update"
|
||||||
echoType='echo -e'
|
echoType='echo -e'
|
||||||
branch=master
|
branch=master
|
||||||
|
v2rayCoreVersion=
|
||||||
|
coreType=
|
||||||
domain=
|
domain=
|
||||||
add=
|
add=
|
||||||
globalType=
|
globalType=
|
||||||
|
@ -60,9 +62,11 @@ mkdirTools(){
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 创建文件夹"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 创建文件夹"
|
||||||
mkdir -p /etc/v2ray-agent/tls
|
mkdir -p /etc/v2ray-agent/tls
|
||||||
mkdir -p /etc/v2ray-agent/v2ray/conf
|
mkdir -p /etc/v2ray-agent/v2ray/conf
|
||||||
|
mkdir -p /etc/v2ray-agent/xray
|
||||||
mkdir -p /etc/v2ray-agent/trojan
|
mkdir -p /etc/v2ray-agent/trojan
|
||||||
mkdir -p /etc/systemd/system/
|
mkdir -p /etc/systemd/system/
|
||||||
mkdir -p /tmp/v2ray-agent-tls/
|
mkdir -p /tmp/v2ray-agent-tls/
|
||||||
|
echoContent red ${coreType}
|
||||||
}
|
}
|
||||||
# 创建基础的文件目录
|
# 创建基础的文件目录
|
||||||
mkdirBaseDIR(){
|
mkdirBaseDIR(){
|
||||||
|
@ -326,11 +330,9 @@ installTLS(){
|
||||||
}
|
}
|
||||||
# 配置伪装博客
|
# 配置伪装博客
|
||||||
initNginxConfig(){
|
initNginxConfig(){
|
||||||
echoContent skyBlue "\n进度 $2/${totalProgress} : 配置Nginx"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 配置Nginx"
|
||||||
installType=$1
|
installType=$1
|
||||||
|
|
||||||
if [[ "${installType}" = "vlesstcpws" ]]
|
|
||||||
then
|
|
||||||
cat << EOF > /etc/nginx/conf.d/alone.conf
|
cat << EOF > /etc/nginx/conf.d/alone.conf
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
|
@ -340,7 +342,6 @@ server {
|
||||||
location /test {return 200 'fjkvymb6len';}
|
location /test {return 200 'fjkvymb6len';}
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
# 自定义/随机路径
|
# 自定义/随机路径
|
||||||
randomPathFunction(){
|
randomPathFunction(){
|
||||||
|
@ -548,13 +549,13 @@ renewalTLS(){
|
||||||
echoContent red " ---> 无法找到相应路径,请使用脚本重新安装"
|
echoContent red " ---> 无法找到相应路径,请使用脚本重新安装"
|
||||||
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/
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 安装V2Ray"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 安装V2Ray"
|
||||||
|
# echoContent red ${coreType},${v2rayCoreVersion}
|
||||||
# 首先要卸载掉其余途径安装的V2Ray
|
# 首先要卸载掉其余途径安装的V2Ray
|
||||||
if [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ -z `ps -ef|grep -v grep|grep v2ray|grep v2ray-agent` ]]
|
if [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]] && [[ -z `ps -ef|grep -v grep|grep v2ray|grep v2ray-agent` ]]
|
||||||
then
|
then
|
||||||
|
@ -562,8 +563,14 @@ installV2Ray(){
|
||||||
ps -ef|grep -v grep|grep v2ray|awk '{print $2}'|xargs kill -9 > /dev/null 2>&1
|
ps -ef|grep -v grep|grep v2ray|awk '{print $2}'|xargs kill -9 > /dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
if [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep -w "v2ray"` ]] || [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep -w "v2ctl"` ]]
|
if [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep -w "v2ray"` ]] || [[ -z `ls -F /etc/v2ray-agent/v2ray/|grep -w "v2ctl"` ]]
|
||||||
|
then
|
||||||
|
if [[ "${coreType}" = "2" ]]
|
||||||
then
|
then
|
||||||
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}'`
|
||||||
|
else
|
||||||
|
version=${v2rayCoreVersion}
|
||||||
|
fi
|
||||||
|
|
||||||
# version="v4.27.4"
|
# version="v4.27.4"
|
||||||
echoContent green " ---> v2ray-core版本:${version}"
|
echoContent green " ---> v2ray-core版本:${version}"
|
||||||
# echoContent green " ---> 下载v2ray-core核心中"
|
# echoContent green " ---> 下载v2ray-core核心中"
|
||||||
|
@ -579,9 +586,17 @@ installV2Ray(){
|
||||||
# echoContent green " ---> 解压完毕,删除压缩包"
|
# echoContent green " ---> 解压完毕,删除压缩包"
|
||||||
rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip
|
rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip
|
||||||
else
|
else
|
||||||
|
|
||||||
|
if [[ ! -z "${v2rayCoreVersion}" ]] && [[ "${coreType}" = "3" ]]
|
||||||
|
then
|
||||||
|
echoContent green " ---> 锁定v2ray-core版本为v4.32.1"
|
||||||
|
rm -f /etc/v2ray-agent/v2ray/v2ray
|
||||||
|
rm -f /etc/v2ray-agent/v2ray/v2ctl
|
||||||
|
installV2Ray $1
|
||||||
|
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`"
|
||||||
echoContent green " ---> v2ray-core版本:`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1`"
|
echoContent green " ---> v2ray-core版本:`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|head -1`"
|
||||||
read -p "是否重新安装?[y/n]:" reInstalV2RayStatus
|
read -p "是否更新、升级?[y/n]:" reInstalV2RayStatus
|
||||||
if [[ "${reInstalV2RayStatus}" = "y" ]]
|
if [[ "${reInstalV2RayStatus}" = "y" ]]
|
||||||
then
|
then
|
||||||
rm -f /etc/v2ray-agent/v2ray/v2ray
|
rm -f /etc/v2ray-agent/v2ray/v2ray
|
||||||
|
@ -589,6 +604,7 @@ installV2Ray(){
|
||||||
installV2Ray $1
|
installV2Ray $1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
# 安装Trojan-go
|
# 安装Trojan-go
|
||||||
installTrojanGo(){
|
installTrojanGo(){
|
||||||
|
@ -596,7 +612,6 @@ installTrojanGo(){
|
||||||
if [[ -z `ls -F /etc/v2ray-agent/trojan/|grep -w "trojan-go"` ]]
|
if [[ -z `ls -F /etc/v2ray-agent/trojan/|grep -w "trojan-go"` ]]
|
||||||
then
|
then
|
||||||
version=`curl -s https://github.com/p4gefau1t/trojan-go/releases|grep /trojan-go/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'`
|
version=`curl -s https://github.com/p4gefau1t/trojan-go/releases|grep /trojan-go/releases/tag/|head -1|awk -F "[/]" '{print $6}'|awk -F "[>]" '{print $2}'|awk -F "[<]" '{print $1}'`
|
||||||
# version="v4.27.4"
|
|
||||||
echoContent green " ---> Trojan-Go版本:${version}"
|
echoContent green " ---> Trojan-Go版本:${version}"
|
||||||
if [[ ! -z `wget --help|grep show-progress` ]]
|
if [[ ! -z `wget --help|grep show-progress` ]]
|
||||||
then
|
then
|
||||||
|
@ -666,8 +681,11 @@ updateV2Ray(){
|
||||||
else
|
else
|
||||||
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}'`
|
||||||
fi
|
fi
|
||||||
|
if [[ ! -z "${v2rayCoreVersion}" ]]
|
||||||
|
then
|
||||||
|
version=${v2rayCoreVersion}
|
||||||
|
fi
|
||||||
echoContent green " ---> v2ray-core版本:${version}"
|
echoContent green " ---> v2ray-core版本:${version}"
|
||||||
# echoContent green " ---> 下载v2ray-core核心中"
|
|
||||||
|
|
||||||
if [[ ! -z `wget --help|grep show-progress` ]]
|
if [[ ! -z `wget --help|grep show-progress` ]]
|
||||||
then
|
then
|
||||||
|
@ -676,9 +694,7 @@ updateV2Ray(){
|
||||||
wget -c -P /etc/v2ray-agent/v2ray/ https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip
|
wget -c -P /etc/v2ray-agent/v2ray/ https://github.com/v2fly/v2ray-core/releases/download/${version}/v2ray-linux-64.zip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# echoContent green " ---> 下载完毕,解压中"
|
|
||||||
unzip -o /etc/v2ray-agent/v2ray/v2ray-linux-64.zip -d /etc/v2ray-agent/v2ray > /dev/null
|
unzip -o /etc/v2ray-agent/v2ray/v2ray-linux-64.zip -d /etc/v2ray-agent/v2ray > /dev/null
|
||||||
# echoContent green " ---> 解压完毕,删除压缩包"
|
|
||||||
rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip
|
rm -rf /etc/v2ray-agent/v2ray/v2ray-linux-64.zip
|
||||||
handleV2Ray stop
|
handleV2Ray stop
|
||||||
handleV2Ray start
|
handleV2Ray start
|
||||||
|
@ -693,6 +709,10 @@ updateV2Ray(){
|
||||||
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}'`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [[ ! -z "${v2rayCoreVersion}" ]]
|
||||||
|
then
|
||||||
|
version=${v2rayCoreVersion}
|
||||||
|
fi
|
||||||
if [[ ! -z "$1" ]]
|
if [[ ! -z "$1" ]]
|
||||||
then
|
then
|
||||||
read -p "回退版本为${version},是否继续?[y/n]:" rollbackV2RayStatus
|
read -p "回退版本为${version},是否继续?[y/n]:" rollbackV2RayStatus
|
||||||
|
@ -856,8 +876,6 @@ checkGFWStatue(){
|
||||||
# 验证整个服务是否可用
|
# 验证整个服务是否可用
|
||||||
# progressTools "yellow" "验证服务是否可用--->"
|
# progressTools "yellow" "验证服务是否可用--->"
|
||||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 验证服务是否可用"
|
echoContent skyBlue "\n进度 $1/${totalProgress} : 验证服务是否可用"
|
||||||
if [[ "${globalType}" = "vlesstcpws" ]]
|
|
||||||
then
|
|
||||||
if [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]]
|
if [[ ! -z `ps -ef|grep -v grep|grep v2ray` ]]
|
||||||
then
|
then
|
||||||
echoContent green " ---> 服务启动成功"
|
echoContent green " ---> 服务启动成功"
|
||||||
|
@ -865,7 +883,6 @@ checkGFWStatue(){
|
||||||
echoContent red " ---> 服务不可用,请检查终端是否有日志打印"
|
echoContent red " ---> 服务不可用,请检查终端是否有日志打印"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
# V2Ray开机自启
|
# V2Ray开机自启
|
||||||
installV2RayService(){
|
installV2RayService(){
|
||||||
|
@ -1036,9 +1053,16 @@ initV2RayConfig(){
|
||||||
if [[ "${historyUUIDStatus}" = "y" ]]
|
if [[ "${historyUUIDStatus}" = "y" ]]
|
||||||
then
|
then
|
||||||
if [[ -f "/etc/v2ray-agent/v2ray/config_full.json" ]]
|
if [[ -f "/etc/v2ray-agent/v2ray/config_full.json" ]]
|
||||||
|
then
|
||||||
|
if [[ "${coreType}" = "3" ]]
|
||||||
then
|
then
|
||||||
uuid=`cat /etc/v2ray-agent/v2ray/config_full.json|jq .inbounds[0].settings.clients[0].id|awk -F '["]' '{print $2}'`
|
uuid=`cat /etc/v2ray-agent/v2ray/config_full.json|jq .inbounds[0].settings.clients[0].id|awk -F '["]' '{print $2}'`
|
||||||
uuidDirect=`cat /etc/v2ray-agent/v2ray/config_full.json|jq .inbounds[0].settings.clients[1].id|awk -F '["]' '{print $2}'`
|
uuidDirect=`cat /etc/v2ray-agent/v2ray/config_full.json|jq .inbounds[0].settings.clients[1].id|awk -F '["]' '{print $2}'`
|
||||||
|
elif [[ "${coreType}" = "2" ]]
|
||||||
|
then
|
||||||
|
uuid=`cat /etc/v2ray-agent/v2ray/config_full.json|jq .inbounds[0].settings.clients[0].id|awk -F '["]' '{print $2}'`
|
||||||
|
fi
|
||||||
|
|
||||||
elif [[ -f "/etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json" ]]
|
elif [[ -f "/etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json" ]]
|
||||||
then
|
then
|
||||||
|
|
||||||
|
@ -1050,10 +1074,15 @@ initV2RayConfig(){
|
||||||
uuid=`/etc/v2ray-agent/v2ray/v2ctl uuid`
|
uuid=`/etc/v2ray-agent/v2ray/v2ctl uuid`
|
||||||
uuidDirect=`/etc/v2ray-agent/v2ray/v2ctl uuid`
|
uuidDirect=`/etc/v2ray-agent/v2ray/v2ctl uuid`
|
||||||
fi
|
fi
|
||||||
if [[ -z "${uuid}" ]] || [[ -z "${uuidDirect}" ]]
|
if [[ -z "${uuid}" ]]
|
||||||
then
|
then
|
||||||
echoContent red "\n ---> uuid读取错误,重新生成"
|
echoContent red "\n ---> uuid读取错误,重新生成"
|
||||||
uuid=`/etc/v2ray-agent/v2ray/v2ctl uuid`
|
uuid=`/etc/v2ray-agent/v2ray/v2ctl uuid`
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "${uuidDirect}" ]] && [[ "${coreType}" = "3" ]]
|
||||||
|
then
|
||||||
|
echoContent red "\n ---> uuid XTLS-direct读取错误,重新生成"
|
||||||
uuidDirect=`/etc/v2ray-agent/v2ray/v2ctl uuid`
|
uuidDirect=`/etc/v2ray-agent/v2ray/v2ctl uuid`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1067,8 +1096,165 @@ initV2RayConfig(){
|
||||||
|
|
||||||
rm -rf /etc/v2ray-agent/v2ray/conf/*
|
rm -rf /etc/v2ray-agent/v2ray/conf/*
|
||||||
rm -rf /etc/v2ray-agent/v2ray/config_full.json
|
rm -rf /etc/v2ray-agent/v2ray/config_full.json
|
||||||
if [[ "$1" = "vlesstcpws" ]]
|
if [[ "$1" = "all" ]] && [[ "${coreType}" = "2" ]]
|
||||||
then
|
then
|
||||||
|
# default v2ray-core
|
||||||
|
cat << EOF > /etc/v2ray-agent/v2ray/config_full.json
|
||||||
|
{
|
||||||
|
"log": {
|
||||||
|
"access": "/etc/v2ray-agent/v2ray/v2ray_access.log",
|
||||||
|
"error": "/etc/v2ray-agent/v2ray/v2ray_error.log",
|
||||||
|
"loglevel": "debug"
|
||||||
|
},
|
||||||
|
"inbounds": [
|
||||||
|
{
|
||||||
|
"port": 443,
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "${uuid}",
|
||||||
|
"add": "${add}",
|
||||||
|
"email": "${domain}_VLESS_TLS_TCP"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none",
|
||||||
|
"fallbacks": [
|
||||||
|
{
|
||||||
|
"dest": 31296,
|
||||||
|
"xver": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/${customPath}",
|
||||||
|
"dest": 31299,
|
||||||
|
"xver": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/${customPath}tcp",
|
||||||
|
"dest": 31298,
|
||||||
|
"xver": 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"path": "/${customPath}ws",
|
||||||
|
"dest": 31297,
|
||||||
|
"xver": 1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "tcp",
|
||||||
|
"security": "tls",
|
||||||
|
"tlsSettings": {
|
||||||
|
"alpn": [
|
||||||
|
"http/1.1"
|
||||||
|
],
|
||||||
|
"certificates": [
|
||||||
|
{
|
||||||
|
"certificateFile": "/etc/v2ray-agent/tls/${domain}.crt",
|
||||||
|
"keyFile": "/etc/v2ray-agent/tls/${domain}.key"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"port": 31299,
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "${uuid}",
|
||||||
|
"alterId": 1,
|
||||||
|
"level": 0,
|
||||||
|
"email": "${domain}_vmess_ws"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "ws",
|
||||||
|
"security": "none",
|
||||||
|
"wsSettings": {
|
||||||
|
"acceptProxyProtocol": true,
|
||||||
|
"path": "/${customPath}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"port": 31298,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vmess",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "${uuid}",
|
||||||
|
"level": 0,
|
||||||
|
"alterId": 1,
|
||||||
|
"email": "${domain}_vmess_tcp"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "tcp",
|
||||||
|
"security": "none",
|
||||||
|
"tcpSettings": {
|
||||||
|
"acceptProxyProtocol": true,
|
||||||
|
"header": {
|
||||||
|
"type": "http",
|
||||||
|
"request": {
|
||||||
|
"path": [
|
||||||
|
"/${customPath}tcp"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"port": 31297,
|
||||||
|
"listen": "127.0.0.1",
|
||||||
|
"protocol": "vless",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "${uuid}",
|
||||||
|
"level": 0,
|
||||||
|
"email": "${domain}_vless_ws"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none"
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "ws",
|
||||||
|
"security": "none",
|
||||||
|
"wsSettings": {
|
||||||
|
"acceptProxyProtocol": true,
|
||||||
|
"path": "/${customPath}ws"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"outbounds": [
|
||||||
|
{
|
||||||
|
"protocol": "freedom",
|
||||||
|
"settings": {
|
||||||
|
"domainStrategy": "UseIPv4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"dns": {
|
||||||
|
"servers": [
|
||||||
|
"74.82.42.42",
|
||||||
|
"8.8.8.8",
|
||||||
|
"8.8.4.4",
|
||||||
|
"1.1.1.1",
|
||||||
|
"localhost"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
elif [[ "$1" = "all" ]] && [[ "${coreType}" = "3" ]]
|
||||||
|
then
|
||||||
|
# 需锁定4.32.1
|
||||||
cat << EOF > /etc/v2ray-agent/v2ray/config_full.json
|
cat << EOF > /etc/v2ray-agent/v2ray/config_full.json
|
||||||
{
|
{
|
||||||
"log": {
|
"log": {
|
||||||
|
@ -1230,7 +1416,7 @@ initV2RayConfig(){
|
||||||
EOF
|
EOF
|
||||||
elif [[ "$1" = "custom" ]]
|
elif [[ "$1" = "custom" ]]
|
||||||
then
|
then
|
||||||
# log
|
# custom v2ray-core
|
||||||
cat << EOF > /etc/v2ray-agent/v2ray/conf/00_log.json
|
cat << EOF > /etc/v2ray-agent/v2ray/conf/00_log.json
|
||||||
{
|
{
|
||||||
"log": {
|
"log": {
|
||||||
|
@ -1390,6 +1576,50 @@ EOF
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
# VLESS_TCP
|
# VLESS_TCP
|
||||||
|
if [[ "${coreType}" = "2" ]]
|
||||||
|
then
|
||||||
|
cat << EOF > /etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json
|
||||||
|
{
|
||||||
|
"inbounds":[
|
||||||
|
{
|
||||||
|
"port": 443,
|
||||||
|
"protocol": "vless",
|
||||||
|
"tag":"VLESSTCP",
|
||||||
|
"settings": {
|
||||||
|
"clients": [
|
||||||
|
{
|
||||||
|
"id": "${uuid}",
|
||||||
|
"add": "${add}",
|
||||||
|
"email": "${domain}_VLESS_TLS_TCP"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"decryption": "none",
|
||||||
|
"fallbacks": [
|
||||||
|
${fallbacksList}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"streamSettings": {
|
||||||
|
"network": "tcp",
|
||||||
|
"security": "xtls",
|
||||||
|
"xtlsSettings": {
|
||||||
|
"alpn": [
|
||||||
|
"http/1.1"
|
||||||
|
],
|
||||||
|
"certificates": [
|
||||||
|
{
|
||||||
|
"certificateFile": "/etc/v2ray-agent/tls/${domain}.crt",
|
||||||
|
"keyFile": "/etc/v2ray-agent/tls/${domain}.key"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
elif [[ "${coreType}" = "3" ]]
|
||||||
|
then
|
||||||
|
|
||||||
cat << EOF > /etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json
|
cat << EOF > /etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json
|
||||||
{
|
{
|
||||||
"inbounds":[
|
"inbounds":[
|
||||||
|
@ -1436,6 +1666,8 @@ EOF
|
||||||
}
|
}
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
# 初始化Trojan-Go配置
|
# 初始化Trojan-Go配置
|
||||||
initTrojanGoConfig(){
|
initTrojanGoConfig(){
|
||||||
|
@ -1671,10 +1903,11 @@ showAccounts(){
|
||||||
local tcpID=`echo ${tcp}|jq .settings.clients[0].id`
|
local tcpID=`echo ${tcp}|jq .settings.clients[0].id`
|
||||||
local tcpEmail="`echo ${tcp}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
|
local tcpEmail="`echo ${tcp}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
|
||||||
local CDNADD=`echo ${tcp}|jq .settings.clients[0].add|awk -F '["]' '{print $2}'`
|
local CDNADD=`echo ${tcp}|jq .settings.clients[0].add|awk -F '["]' '{print $2}'`
|
||||||
|
|
||||||
# XTLS Direct
|
# XTLS Direct
|
||||||
local tcpIDirect=`echo ${tcp}|jq .settings.clients[1].id`
|
local tcpIDirect=`echo ${tcp}|jq .settings.clients[1].id`
|
||||||
local tcpDirectEmail="`echo ${tcp}|jq .settings.clients[1].email|awk -F '["]' '{print $2}'`"
|
local tcpDirectEmail="`echo ${tcp}|jq .settings.clients[1].email|awk -F '["]' '{print $2}'`"
|
||||||
host=`echo ${tcp}|jq .streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
|
||||||
|
|
||||||
# VLESS ws
|
# VLESS ws
|
||||||
local vlessWS=`cat /etc/v2ray-agent/v2ray/config_full.json|jq .inbounds[3]`
|
local vlessWS=`cat /etc/v2ray-agent/v2ray/config_full.json|jq .inbounds[3]`
|
||||||
|
@ -1694,13 +1927,22 @@ showAccounts(){
|
||||||
local vmessTCPEmail="`echo ${vmessTCP}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
|
local vmessTCPEmail="`echo ${vmessTCP}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
|
||||||
local vmessTCPath=`echo ${vmessTCP}|jq .streamSettings.tcpSettings.header.request.path[0]`
|
local vmessTCPath=`echo ${vmessTCP}|jq .streamSettings.tcpSettings.header.request.path[0]`
|
||||||
|
|
||||||
|
if [[ "${coreType}" = "3" ]]
|
||||||
|
then
|
||||||
|
host=`echo ${tcp}|jq .streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
||||||
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-origin ==========================="
|
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-origin ==========================="
|
||||||
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${host}:${port}" ${add}
|
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${host}:${port}" ${add}
|
||||||
|
|
||||||
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-direct ==========================="
|
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-direct ==========================="
|
||||||
defaultBase64Code vlesstcp ${tcpDirectEmail} "${tcpIDirect}" "${host}:${port}" ${add}
|
defaultBase64Code vlesstcp ${tcpDirectEmail} "${tcpIDirect}" "${host}:${port}" ${add}
|
||||||
|
|
||||||
|
elif [[ "${coreType}" = "2" ]]
|
||||||
|
then
|
||||||
|
host=`echo ${tcp}|jq .streamSettings.tlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
||||||
|
echoContent skyBlue "\n============================ VLESS TCP TLS ======================================="
|
||||||
|
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${host}:${port}" ${add}
|
||||||
|
fi
|
||||||
|
|
||||||
echoContent skyBlue "\n================================ VLESS WS TLS CDN ================================"
|
echoContent skyBlue "\n================================ VLESS WS TLS CDN ================================"
|
||||||
defaultBase64Code vlessws ${vlessWSEmail} "${vlessWSID}" "${host}:${port}" "${vlessWSPath}" ${CDNADD}
|
defaultBase64Code vlessws ${vlessWSEmail} "${vlessWSID}" "${host}:${port}" "${vlessWSPath}" ${CDNADD}
|
||||||
|
|
||||||
|
@ -1726,12 +1968,20 @@ showAccounts(){
|
||||||
local tcpDirectEmail="`echo ${tcp}|jq .settings.clients[1].email|awk -F '["]' '{print $2}'`"
|
local tcpDirectEmail="`echo ${tcp}|jq .settings.clients[1].email|awk -F '["]' '{print $2}'`"
|
||||||
host=`echo ${tcp}|jq .streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
host=`echo ${tcp}|jq .streamSettings.xtlsSettings.certificates[0].certificateFile|awk -F '[t][l][s][/]' '{print $2}'|awk -F '["]' '{print $1}'|awk -F '[.][c][r][t]' '{print $1}'`
|
||||||
|
|
||||||
|
if [[ "${coreType}" = "3" ]]
|
||||||
|
then
|
||||||
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-origin ==========================="
|
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-origin ==========================="
|
||||||
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${host}:${port}" ${add}
|
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${host}:${port}" ${add}
|
||||||
|
|
||||||
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-direct ==========================="
|
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-direct ==========================="
|
||||||
defaultBase64Code vlesstcp ${tcpDirectEmail} "${tcpIDirect}" "${host}:${port}" ${add}
|
defaultBase64Code vlesstcp ${tcpDirectEmail} "${tcpIDirect}" "${host}:${port}" ${add}
|
||||||
|
|
||||||
|
elif [[ "${coreType}" = "2" ]]
|
||||||
|
then
|
||||||
|
echoContent skyBlue "\n============================ VLESS TCP TLS ======================================="
|
||||||
|
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${host}:${port}" ${add}
|
||||||
|
fi
|
||||||
|
|
||||||
if [[ ! -z "${customInstallType}" ]]
|
if [[ ! -z "${customInstallType}" ]]
|
||||||
then
|
then
|
||||||
if [[ ! -z `echo ${customInstallType}|grep 1` ]]
|
if [[ ! -z `echo ${customInstallType}|grep 1` ]]
|
||||||
|
@ -2179,105 +2429,18 @@ resetUUID(){
|
||||||
showAccounts 1
|
showAccounts 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# 个性化安装
|
|
||||||
customInstall(){
|
|
||||||
echoContent skyBlue "\n========================个性化安装============================"
|
|
||||||
echoContent yellow "VLESS前置,默认安装0,如果只需要安装0,则只选择0即可"
|
|
||||||
echoContent yellow "0.VLESS+TLS/XTLS+TCP"
|
|
||||||
echoContent yellow "1.VLESS+TLS+WS[CDN]"
|
|
||||||
echoContent yellow "2.VMess+TLS+TCP"
|
|
||||||
echoContent yellow "3.VMess+TLS+WS[CDN]"
|
|
||||||
echoContent yellow "4.Trojan、Trojan+WS[CDN]"
|
|
||||||
read -p "请选择[多选],[例如:123]:" customInstallType
|
|
||||||
echoContent skyBlue "--------------------------------------------------------------"
|
|
||||||
if [[ -z ${customInstallType} ]]
|
|
||||||
then
|
|
||||||
echoContent red " ---> 不可为空"
|
|
||||||
customInstall
|
|
||||||
elif [[ "${customInstallType}" =~ ^[0-4]+$ ]]
|
|
||||||
then
|
|
||||||
totalProgress=17
|
|
||||||
globalType=vlesstcpws
|
|
||||||
mkdirTools 1
|
|
||||||
installTools 2
|
|
||||||
# 申请tls
|
|
||||||
initTLSNginxConfig 3
|
|
||||||
installTLS 4
|
|
||||||
handleNginx stop
|
|
||||||
initNginxConfig vlesstcpws 5
|
|
||||||
# 随机path
|
|
||||||
if [[ ! -z `echo ${customInstallType}|grep 1` ]] || [[ ! -z `echo ${customInstallType}|grep 3` ]] || [[ ! -z `echo ${customInstallType}|grep 4` ]]
|
|
||||||
then
|
|
||||||
randomPathFunction 6
|
|
||||||
customCDNIP 7
|
|
||||||
fi
|
|
||||||
nginxBlog 8
|
|
||||||
handleNginx start
|
|
||||||
|
|
||||||
# 安装V2Ray
|
|
||||||
installV2Ray 9
|
|
||||||
installV2RayService 10
|
|
||||||
initV2RayConfig custom 11
|
|
||||||
if [[ ! -z `echo ${customInstallType}|grep 4` ]]
|
|
||||||
then
|
|
||||||
installTrojanGo 12
|
|
||||||
installTrojanService 13
|
|
||||||
initTrojanGoConfig 14
|
|
||||||
handleTrojanGo stop
|
|
||||||
handleTrojanGo start
|
|
||||||
else
|
|
||||||
# 这里需要删除trojan的服务
|
|
||||||
handleTrojanGo stop
|
|
||||||
rm -rf /etc/v2ray-agent/trojan/*
|
|
||||||
rm -rf /etc/systemd/system/trojan-go.service
|
|
||||||
fi
|
|
||||||
installCronTLS 15
|
|
||||||
handleV2Ray stop
|
|
||||||
handleV2Ray start
|
|
||||||
# 生成账号
|
|
||||||
checkGFWStatue 16
|
|
||||||
showAccounts 17
|
|
||||||
else
|
|
||||||
echoContent red " ---> 输入不合法"
|
|
||||||
customInstall
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
# 初始化个性化安装类型
|
|
||||||
initCustomInstallType(){
|
|
||||||
if [[ -d "/etc/v2ray-agent/" ]] && [[ -d "/etc/v2ray-agent/v2ray/" ]] && [[ -d "/etc/v2ray-agent/v2ray/conf" ]]
|
|
||||||
then
|
|
||||||
while read row
|
|
||||||
do
|
|
||||||
if [[ ! -z `echo ${row}|grep VLESS_TCP_inbounds` ]]
|
|
||||||
then
|
|
||||||
customInstallType=${customInstallType}'0'
|
|
||||||
fi
|
|
||||||
if [[ ! -z `echo ${row}|grep VLESS_WS_inbounds` ]]
|
|
||||||
then
|
|
||||||
customInstallType=${customInstallType}'1'
|
|
||||||
fi
|
|
||||||
if [[ ! -z `echo ${row}|grep VMess_TCP_inbounds` ]]
|
|
||||||
then
|
|
||||||
customInstallType=${customInstallType}'2'
|
|
||||||
fi
|
|
||||||
if [[ ! -z `echo ${row}|grep VMess_WS_inbounds` ]]
|
|
||||||
then
|
|
||||||
customInstallType=${customInstallType}'3'
|
|
||||||
fi
|
|
||||||
done < <(echo `ls /etc/v2ray-agent/v2ray/conf|grep -v grep|grep inbounds.json|awk -F "[.]" '{print $1}'`)
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
# 主菜单
|
# 主菜单
|
||||||
menu(){
|
menu(){
|
||||||
cd
|
cd
|
||||||
echoContent red "\n=============================================================="
|
echoContent red "\n=============================================================="
|
||||||
echoContent green "作者:mack-a"
|
echoContent green "作者:mack-a"
|
||||||
echoContent green "当前版本:v2.1.8"
|
echoContent green "当前版本:v2.1.9"
|
||||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||||
echoContent green "描述:七合一共存脚本"
|
echoContent green "描述:七合一共存脚本"
|
||||||
echoContent red "=============================================================="
|
echoContent red "=============================================================="
|
||||||
echoContent yellow "1.安装"
|
echoContent yellow "1.安装"
|
||||||
echoContent yellow "2.任意组合安装"
|
echoContent yellow "2.任意组合安装[临时屏蔽]"
|
||||||
echoContent skyBlue "-------------------------工具管理-----------------------------"
|
echoContent skyBlue "-------------------------工具管理-----------------------------"
|
||||||
echoContent yellow "3.查看账号"
|
echoContent yellow "3.查看账号"
|
||||||
echoContent yellow "4.自动排错 [仅V2Ray]"
|
echoContent yellow "4.自动排错 [仅V2Ray]"
|
||||||
|
@ -2297,13 +2460,16 @@ menu(){
|
||||||
initCustomInstallType
|
initCustomInstallType
|
||||||
mkdirBaseDIR
|
mkdirBaseDIR
|
||||||
aliasInstall
|
aliasInstall
|
||||||
|
judgeCoreType
|
||||||
read -p "请选择:" selectInstallType
|
read -p "请选择:" selectInstallType
|
||||||
case ${selectInstallType} in
|
case ${selectInstallType} in
|
||||||
1)
|
1)
|
||||||
defaultInstall
|
selectCoreInstall
|
||||||
;;
|
;;
|
||||||
2)
|
2)
|
||||||
customInstall
|
echoContent red " ---> 临时屏蔽,请等待更新"
|
||||||
|
exit 0;
|
||||||
|
# customInstall
|
||||||
;;
|
;;
|
||||||
3)
|
3)
|
||||||
showAccounts 1
|
showAccounts 1
|
||||||
|
@ -2431,18 +2597,36 @@ aliasInstall(){
|
||||||
echoContent green "快捷方式创建成功,可执行[vasma]重新打开脚本"
|
echoContent green "快捷方式创建成功,可执行[vasma]重新打开脚本"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
# 默认安装
|
# 如果v2ray-core核心低于4.33则不允许升级v2ray-core
|
||||||
defaultInstall(){
|
judgeCoreType(){
|
||||||
|
if [[ -d '/etc/v2ray-agent' ]] && [[ -d '/etc/v2ray-agent/v2ray' ]] && [[ -f '/etc/v2ray-agent/v2ray/v2ray' ]] && [[ -f '/etc/v2ray-agent/v2ray/v2ctl' ]]
|
||||||
|
then
|
||||||
|
# 所属v2ray-core
|
||||||
|
local version=`/etc/v2ray-agent/v2ray/v2ray --version|awk '{print $2}'|awk -F "[.]" '{print $2}'|head -1`
|
||||||
|
if [[ ${version} -lt 33 ]]
|
||||||
|
then
|
||||||
|
coreType=3;
|
||||||
|
v2rayCoreVersion=v4.32.1
|
||||||
|
else
|
||||||
|
coreType=2;
|
||||||
|
fi
|
||||||
|
elif [[ -d '/etc/v2ray-agent' ]] && [[ -d '/etc/v2ray-agent/xray' ]] && [[ -f '/etc/v2ray-agent/xray/xray' ]]
|
||||||
|
then
|
||||||
|
coreType=0
|
||||||
|
fi
|
||||||
|
# echoContent red "${coreType}"
|
||||||
|
}
|
||||||
|
# v2ray-core 安装
|
||||||
|
v2rayCoreInstall(){
|
||||||
customInstallType=
|
customInstallType=
|
||||||
totalProgress=17
|
totalProgress=17
|
||||||
globalType=vlesstcpws
|
|
||||||
mkdirTools 1
|
mkdirTools 1
|
||||||
installTools 2
|
installTools 2
|
||||||
# 申请tls
|
# 申请tls
|
||||||
initTLSNginxConfig 3
|
initTLSNginxConfig 3
|
||||||
installTLS 4
|
installTLS 4
|
||||||
handleNginx stop
|
handleNginx stop
|
||||||
initNginxConfig vlesstcpws 5
|
initNginxConfig 5
|
||||||
randomPathFunction 6
|
randomPathFunction 6
|
||||||
# 安装V2Ray
|
# 安装V2Ray
|
||||||
installV2Ray 7
|
installV2Ray 7
|
||||||
|
@ -2450,7 +2634,75 @@ defaultInstall(){
|
||||||
installTrojanGo 9
|
installTrojanGo 9
|
||||||
installTrojanService 10
|
installTrojanService 10
|
||||||
customCDNIP 11
|
customCDNIP 11
|
||||||
initV2RayConfig vlesstcpws 12
|
initV2RayConfig all 12
|
||||||
|
initTrojanGoConfig 13
|
||||||
|
installCronTLS 14
|
||||||
|
nginxBlog 15
|
||||||
|
handleV2Ray stop
|
||||||
|
sleep 2
|
||||||
|
handleV2Ray start
|
||||||
|
handleNginx start
|
||||||
|
handleTrojanGo stop
|
||||||
|
sleep 1
|
||||||
|
handleTrojanGo start
|
||||||
|
# 生成账号
|
||||||
|
checkGFWStatue 16
|
||||||
|
showAccounts 17
|
||||||
|
}
|
||||||
|
|
||||||
|
# 最后一次支持XTLS的v2ray-core
|
||||||
|
xtlsV2rayCoreInstall(){
|
||||||
|
v2rayCoreVersion=v4.32.1
|
||||||
|
customInstallType=
|
||||||
|
totalProgress=17
|
||||||
|
mkdirTools 1
|
||||||
|
installTools 2
|
||||||
|
# 申请tls
|
||||||
|
initTLSNginxConfig 3
|
||||||
|
installTLS 4
|
||||||
|
handleNginx stop
|
||||||
|
initNginxConfig 5
|
||||||
|
randomPathFunction 6
|
||||||
|
# 安装V2Ray
|
||||||
|
installV2Ray 7
|
||||||
|
installV2RayService 8
|
||||||
|
installTrojanGo 9
|
||||||
|
installTrojanService 10
|
||||||
|
customCDNIP 11
|
||||||
|
initV2RayConfig all 12
|
||||||
|
initTrojanGoConfig 13
|
||||||
|
installCronTLS 14
|
||||||
|
nginxBlog 15
|
||||||
|
handleV2Ray stop
|
||||||
|
sleep 2
|
||||||
|
handleV2Ray start
|
||||||
|
handleNginx start
|
||||||
|
handleTrojanGo stop
|
||||||
|
sleep 1
|
||||||
|
handleTrojanGo start
|
||||||
|
# 生成账号
|
||||||
|
checkGFWStatue 16
|
||||||
|
showAccounts 17
|
||||||
|
}
|
||||||
|
# xray-core 安装
|
||||||
|
xrayCoreInstall(){
|
||||||
|
customInstallType=
|
||||||
|
totalProgress=17
|
||||||
|
mkdirTools 1
|
||||||
|
installTools 2
|
||||||
|
# 申请tls
|
||||||
|
initTLSNginxConfig 3
|
||||||
|
installTLS 4
|
||||||
|
handleNginx stop
|
||||||
|
initNginxConfig 5
|
||||||
|
randomPathFunction 6
|
||||||
|
# 安装V2Ray
|
||||||
|
installV2Ray 7
|
||||||
|
installV2RayService 8
|
||||||
|
installTrojanGo 9
|
||||||
|
installTrojanService 10
|
||||||
|
customCDNIP 11
|
||||||
|
initV2RayConfig all 12
|
||||||
initTrojanGoConfig 13
|
initTrojanGoConfig 13
|
||||||
installCronTLS 14
|
installCronTLS 14
|
||||||
nginxBlog 15
|
nginxBlog 15
|
||||||
|
@ -2466,14 +2718,131 @@ defaultInstall(){
|
||||||
checkGFWStatue 16
|
checkGFWStatue 16
|
||||||
showAccounts 17
|
showAccounts 17
|
||||||
}
|
}
|
||||||
# 杀死sleep
|
# 个性化安装
|
||||||
killSleep(){
|
customInstall(){
|
||||||
if [[ ! -z `ps -ef|grep -v grep|grep sleep` ]]
|
echoContent skyBlue "\n========================个性化安装============================"
|
||||||
|
echoContent yellow "VLESS前置,默认安装0,如果只需要安装0,则只选择0即可"
|
||||||
|
echoContent yellow "0.VLESS+TLS/XTLS+TCP"
|
||||||
|
echoContent yellow "1.VLESS+TLS+WS[CDN]"
|
||||||
|
echoContent yellow "2.VMess+TLS+TCP"
|
||||||
|
echoContent yellow "3.VMess+TLS+WS[CDN]"
|
||||||
|
echoContent yellow "4.Trojan、Trojan+WS[CDN]"
|
||||||
|
read -p "请选择[多选],[例如:123]:" customInstallType
|
||||||
|
echoContent skyBlue "--------------------------------------------------------------"
|
||||||
|
if [[ -z ${customInstallType} ]]
|
||||||
then
|
then
|
||||||
ps -ef|grep -v grep|grep sleep|awk '{print $3}'|xargs kill -9 > /dev/null 2>&1
|
echoContent red " ---> 不可为空"
|
||||||
killSleep > /dev/null 2>&1
|
customInstall
|
||||||
|
elif [[ "${customInstallType}" =~ ^[0-4]+$ ]]
|
||||||
|
then
|
||||||
|
totalProgress=17
|
||||||
|
mkdirTools 1
|
||||||
|
installTools 2
|
||||||
|
# 申请tls
|
||||||
|
initTLSNginxConfig 3
|
||||||
|
installTLS 4
|
||||||
|
handleNginx stop
|
||||||
|
initNginxConfig 5
|
||||||
|
# 随机path
|
||||||
|
if [[ ! -z `echo ${customInstallType}|grep 1` ]] || [[ ! -z `echo ${customInstallType}|grep 3` ]] || [[ ! -z `echo ${customInstallType}|grep 4` ]]
|
||||||
|
then
|
||||||
|
randomPathFunction 6
|
||||||
|
customCDNIP 7
|
||||||
|
fi
|
||||||
|
nginxBlog 8
|
||||||
|
handleNginx start
|
||||||
|
|
||||||
|
# 安装V2Ray
|
||||||
|
installV2Ray 9
|
||||||
|
installV2RayService 10
|
||||||
|
initV2RayConfig custom 11
|
||||||
|
if [[ ! -z `echo ${customInstallType}|grep 4` ]]
|
||||||
|
then
|
||||||
|
installTrojanGo 12
|
||||||
|
installTrojanService 13
|
||||||
|
initTrojanGoConfig 14
|
||||||
|
handleTrojanGo stop
|
||||||
|
handleTrojanGo start
|
||||||
|
else
|
||||||
|
# 这里需要删除trojan的服务
|
||||||
|
handleTrojanGo stop
|
||||||
|
rm -rf /etc/v2ray-agent/trojan/*
|
||||||
|
rm -rf /etc/systemd/system/trojan-go.service
|
||||||
|
fi
|
||||||
|
installCronTLS 15
|
||||||
|
handleV2Ray stop
|
||||||
|
handleV2Ray start
|
||||||
|
# 生成账号
|
||||||
|
checkGFWStatue 16
|
||||||
|
showAccounts 17
|
||||||
|
else
|
||||||
|
echoContent red " ---> 输入不合法"
|
||||||
|
customInstall
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
# 初始化个性化安装类型
|
||||||
|
initCustomInstallType(){
|
||||||
|
if [[ -d "/etc/v2ray-agent/" ]] && [[ -d "/etc/v2ray-agent/v2ray/" ]] && [[ -d "/etc/v2ray-agent/v2ray/conf" ]]
|
||||||
|
then
|
||||||
|
while read row
|
||||||
|
do
|
||||||
|
if [[ ! -z `echo ${row}|grep VLESS_TCP_inbounds` ]]
|
||||||
|
then
|
||||||
|
customInstallType=${customInstallType}'0'
|
||||||
|
fi
|
||||||
|
if [[ ! -z `echo ${row}|grep VLESS_WS_inbounds` ]]
|
||||||
|
then
|
||||||
|
customInstallType=${customInstallType}'1'
|
||||||
|
fi
|
||||||
|
if [[ ! -z `echo ${row}|grep VMess_TCP_inbounds` ]]
|
||||||
|
then
|
||||||
|
customInstallType=${customInstallType}'2'
|
||||||
|
fi
|
||||||
|
if [[ ! -z `echo ${row}|grep VMess_WS_inbounds` ]]
|
||||||
|
then
|
||||||
|
customInstallType=${customInstallType}'3'
|
||||||
|
fi
|
||||||
|
done < <(echo `ls /etc/v2ray-agent/v2ray/conf|grep -v grep|grep inbounds.json|awk -F "[.]" '{print $1}'`)
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# 选择核心安装
|
||||||
|
# v2ray-core、xray-core、锁定版本的v2ray-core[xtls]
|
||||||
|
selectCoreInstall(){
|
||||||
|
echoContent skyBlue "\n功能 1/${totalProgress} : 选择核心安装"
|
||||||
|
echoContent red "\n=============================================================="
|
||||||
|
echoContent yellow "1.xray-core"
|
||||||
|
echoContent yellow "2.v2ray-core"
|
||||||
|
echoContent yellow "3.v2ray-core[XTLS]"
|
||||||
|
echoContent red "=============================================================="
|
||||||
|
read -p "请选择:" coreType
|
||||||
|
case ${coreType} in
|
||||||
|
1)
|
||||||
|
echoContent red ' ---> 暂无'
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
v2rayCoreInstall
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
xtlsV2rayCoreInstall
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echoContent red ' ---> 选择错误,重新选择'
|
||||||
|
selectCoreInstall
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
}
|
||||||
|
# 杀死sleep
|
||||||
|
# killSleep(){
|
||||||
|
# if [[ ! -z `ps -ef|grep -v grep|grep sleep` ]]
|
||||||
|
# then
|
||||||
|
# ps -ef|grep -v grep|grep sleep|awk '{print $3}'|xargs kill -9 > /dev/null 2>&1
|
||||||
|
# killSleep > /dev/null 2>&1
|
||||||
|
# fi
|
||||||
|
# }
|
||||||
|
|
||||||
# 检查系统
|
# 检查系统
|
||||||
checkSystem(){
|
checkSystem(){
|
||||||
if [[ ! -z `find /etc -name "redhat-release"` ]] || [[ ! -z `cat /proc/version | grep -i "centos" | grep -v grep ` ]]
|
if [[ ! -z `find /etc -name "redhat-release"` ]] || [[ ! -z `cat /proc/version | grep -i "centos" | grep -v grep ` ]]
|
||||||
|
|
Loading…
Reference in New Issue