feat(脚本): 兼容个性化安装、修改log打印、修改许可证、修改xray-core->Xray-core
parent
b19e5f1478
commit
b4e9b7f99f
214
install.sh
214
install.sh
|
@ -58,7 +58,7 @@ initVar(){
|
|||
# 2.个性化安装
|
||||
v2rayAgentInstallType=
|
||||
|
||||
# 当前的个性化安装方式
|
||||
# 当前的个性化安装方式 01234
|
||||
currentCustomInstallType=
|
||||
|
||||
# 选择的个性化安装方式
|
||||
|
@ -147,7 +147,7 @@ readInstallType(){
|
|||
coreInstallType=1
|
||||
fi
|
||||
|
||||
elif [[ -d "/etc/v2ray-agent/v2ray/conf" && -f "/etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json" ]]
|
||||
elif [[ -d "/etc/v2ray-agent/xray/conf" && -f "/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" ]]
|
||||
then
|
||||
xrayCoreConfigFilePath=/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
|
||||
v2rayAgentInstallType=2
|
||||
|
@ -164,15 +164,15 @@ readInstallType(){
|
|||
# 检测个性化安装的方式
|
||||
readCustomInstallType(){
|
||||
customConf=
|
||||
currentCustomInstallType=
|
||||
if [[ "${v2rayAgentInstallType}" = "2" ]]
|
||||
then
|
||||
# currentCustomInstallType
|
||||
local customConf=
|
||||
if [[ "${coreInstallType}" = "1" ]]
|
||||
then
|
||||
customConf="ls /etc/v2ray-agent/xray/conf|grep -v grep|grep inbounds.json|awk -F "[.]" '{print $1}'"
|
||||
customConf="/etc/v2ray-agent/xray/conf"
|
||||
else
|
||||
customConf="ls /etc/v2ray-agent/v2ray/conf|grep -v grep|grep inbounds.json|awk -F "[.]" '{print $1}'"
|
||||
customConf="/etc/v2ray-agent/v2ray/conf"
|
||||
fi
|
||||
|
||||
while read row
|
||||
|
@ -193,7 +193,7 @@ readCustomInstallType(){
|
|||
then
|
||||
currentCustomInstallType=${currentCustomInstallType}'3'
|
||||
fi
|
||||
done < <(echo ``)
|
||||
done < <(echo `ls ${customConf}|grep -v grep|grep inbounds.json|awk -F "[.]" '{print $1}'`)
|
||||
fi
|
||||
}
|
||||
|
||||
|
@ -1113,7 +1113,7 @@ installV2RayService(){
|
|||
rm -rf /etc/systemd/system/v2ray.service
|
||||
touch /etc/systemd/system/v2ray.service
|
||||
execStart='/etc/v2ray-agent/v2ray/v2ray -config /etc/v2ray-agent/v2ray/config_full.json'
|
||||
if [[ ! -z ${customInstallType} ]]
|
||||
if [[ ! -z ${selectCustomInstallType} ]]
|
||||
then
|
||||
execStart='/etc/v2ray-agent/v2ray/v2ray -confdir /etc/v2ray-agent/v2ray/conf'
|
||||
fi
|
||||
|
@ -1151,7 +1151,7 @@ installXrayService(){
|
|||
rm -rf /etc/systemd/system/xray.service
|
||||
touch /etc/systemd/system/xray.service
|
||||
execStart='/etc/v2ray-agent/xray/xray run -config /etc/v2ray-agent/xray/config_full.json'
|
||||
if [[ ! -z ${customInstallType} ]]
|
||||
if [[ ! -z ${selectCustomInstallType} ]]
|
||||
then
|
||||
execStart='/etc/v2ray-agent/xray/xray run -confdir /etc/v2ray-agent/xray/conf'
|
||||
fi
|
||||
|
@ -1744,13 +1744,13 @@ EOF
|
|||
# 没有path则回落到此端口
|
||||
local fallbacksList='{"dest":31296,"xver":0}'
|
||||
|
||||
if [[ -z `echo ${customInstallType}|grep 4` ]]
|
||||
if [[ -z `echo ${selectCustomInstallType}|grep 4` ]]
|
||||
then
|
||||
fallbacksList='{"dest":80,"xver":0}'
|
||||
fi
|
||||
|
||||
# VLESS_WS_TLS
|
||||
if [[ ! -z `echo ${customInstallType}|grep 1` ]]
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 1` ]]
|
||||
then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'ws","dest":31297,"xver":1}'
|
||||
cat << EOF > /etc/v2ray-agent/v2ray/conf/03_VLESS_WS_inbounds.json
|
||||
|
@ -1784,7 +1784,7 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
# VMess_TCP
|
||||
if [[ ! -z `echo ${customInstallType}|grep 2` ]]
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 2` ]]
|
||||
then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'tcp","dest":31298,"xver":1}'
|
||||
cat << EOF > /etc/v2ray-agent/v2ray/conf/04_VMess_TCP_inbounds.json
|
||||
|
@ -1826,7 +1826,7 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
# VMess_WS
|
||||
if [[ ! -z `echo ${customInstallType}|grep 3` ]]
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 3` ]]
|
||||
then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'","dest":31299,"xver":1}'
|
||||
cat << EOF > /etc/v2ray-agent/v2ray/conf/05_VMess_WS_inbounds.json
|
||||
|
@ -2000,8 +2000,8 @@ initXrayConfig(){
|
|||
cat << EOF > /etc/v2ray-agent/xray/config_full.json
|
||||
{
|
||||
"log": {
|
||||
"access": "/etc/v2ray-agent/v2ray/v2ray_access.log",
|
||||
"error": "/etc/v2ray-agent/v2ray/v2ray_error.log",
|
||||
"access": "/etc/v2ray-agent/xray/xray_access.log",
|
||||
"error": "/etc/v2ray-agent/xray/xray_error.log",
|
||||
"loglevel": "debug"
|
||||
},
|
||||
"inbounds": [
|
||||
|
@ -2199,13 +2199,13 @@ EOF
|
|||
# 没有path则回落到此端口
|
||||
local fallbacksList='{"dest":31296,"xver":0}'
|
||||
|
||||
if [[ -z `echo ${customInstallType}|grep 4` ]]
|
||||
if [[ -z `echo ${selectCustomInstallType}|grep 4` ]]
|
||||
then
|
||||
fallbacksList='{"dest":80,"xver":0}'
|
||||
fi
|
||||
|
||||
# VLESS_WS_TLS
|
||||
if [[ ! -z `echo ${customInstallType}|grep 1` ]]
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 1` ]]
|
||||
then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'ws","dest":31297,"xver":1}'
|
||||
cat << EOF > /etc/v2ray-agent/xray/conf/03_VLESS_WS_inbounds.json
|
||||
|
@ -2239,7 +2239,7 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
# VMess_TCP
|
||||
if [[ ! -z `echo ${customInstallType}|grep 2` ]]
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 2` ]]
|
||||
then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'tcp","dest":31298,"xver":1}'
|
||||
cat << EOF > /etc/v2ray-agent/xray/conf/04_VMess_TCP_inbounds.json
|
||||
|
@ -2281,7 +2281,7 @@ EOF
|
|||
EOF
|
||||
fi
|
||||
# VMess_WS
|
||||
if [[ ! -z `echo ${customInstallType}|grep 3` ]]
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 3` ]]
|
||||
then
|
||||
fallbacksList=${fallbacksList}',{"path":"/'${customPath}'","dest":31299,"xver":1}'
|
||||
cat << EOF > /etc/v2ray-agent/xray/conf/05_VMess_WS_inbounds.json
|
||||
|
@ -2315,52 +2315,10 @@ EOF
|
|||
}
|
||||
EOF
|
||||
fi
|
||||
# VLESS_TCP
|
||||
if [[ "${selectCoreType}" = "2" ]]
|
||||
then
|
||||
cat << EOF > /etc/v2ray-agent/xray/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": "tls",
|
||||
"tlsSettings": {
|
||||
"alpn": [
|
||||
"http/1.1"
|
||||
],
|
||||
"certificates": [
|
||||
{
|
||||
"certificateFile": "/etc/v2ray-agent/tls/${domain}.crt",
|
||||
"keyFile": "/etc/v2ray-agent/tls/${domain}.key"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
EOF
|
||||
elif [[ "${selectCoreType}" = "3" ]]
|
||||
then
|
||||
|
||||
cat << EOF > /etc/v2ray-agent/v2ray/xray/02_VLESS_TCP_inbounds.json
|
||||
# VLESS_TCP
|
||||
|
||||
cat << EOF > /etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
|
||||
{
|
||||
"inbounds":[
|
||||
{
|
||||
|
@ -2405,10 +2363,8 @@ EOF
|
|||
]
|
||||
}
|
||||
EOF
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
}
|
||||
# 初始化Trojan-Go配置
|
||||
initTrojanGoConfig(){
|
||||
|
@ -2525,7 +2481,7 @@ defaultBase64Code(){
|
|||
echo " vmess://${qrCodeBase64Default}" >> /etc/v2ray-agent/v2ray/usersv2ray.conf
|
||||
echoContent yellow " ---> 通用json(VLESS+TCP+TLS)"
|
||||
echoContent green ' {"port":"'${port}'","ps":"'${ps}'","tls":"tls","id":'"${id}"',"host":"'${host}'","type":"none","net":"tcp","add":"'${host}'","allowInsecure":0,"method":"none","peer":""}\n'
|
||||
echoContent green ' V2Ray v4.27.4+ 目前无通用订阅,需要手动配置,VLESS TCP、XTLS和TCP大部分一样,其余内容不变,请注意手动输入的流控flow类型,v4.32.1之后不支持XTLS\n'
|
||||
echoContent green ' V2Ray v4.27.4+ 目前无通用订阅,需要手动配置,VLESS TCP、XTLS和TCP大部分一样,其余内容不变,请注意手动输入的流控flow类型,v2ray-core v4.32.1之后不支持XTLS,Xray-core支持,建议使用Xray-core\n'
|
||||
|
||||
elif [[ "${type}" = "vmessws" ]]
|
||||
then
|
||||
|
@ -2580,6 +2536,7 @@ defaultBase64Code(){
|
|||
showAccounts(){
|
||||
readInstallType
|
||||
readConfigHostPathUUID
|
||||
readCustomInstallType
|
||||
showStatus=
|
||||
echoContent skyBlue "\n进度 $1/${totalProgress} : 账号"
|
||||
|
||||
|
@ -2624,6 +2581,7 @@ showAccounts(){
|
|||
local vmessTCPID=`echo ${vmessTCP}|jq .settings.clients[0].id`
|
||||
local vmessTCPEmail="`echo ${vmessTCP}|jq .settings.clients[0].email|awk -F '["]' '{print $2}'`"
|
||||
local vmessTCPath=`echo ${vmessTCP}|jq .streamSettings.tcpSettings.header.request.path[0]`
|
||||
|
||||
if [[ "${coreInstallType}" = "3" || "${coreInstallType}" = "1" ]]
|
||||
then
|
||||
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-origin ==========================="
|
||||
|
@ -2671,7 +2629,7 @@ showAccounts(){
|
|||
local tcpIDirect=`echo ${tcp}|jq .settings.clients[1].id`
|
||||
local tcpDirectEmail="`echo ${tcp}|jq .settings.clients[1].email|awk -F '["]' '{print $2}'`"
|
||||
|
||||
if [[ "${coreInstallType}" = "3" ]]
|
||||
if [[ "${coreInstallType}" = "3" || "${coreInstallType}" = "1" ]]
|
||||
then
|
||||
echoContent skyBlue "\n============================ VLESS TCP TLS/XTLS-origin ==========================="
|
||||
defaultBase64Code vlesstcp ${tcpEmail} "${tcpID}" "${currentHost}:${port}" ${add}
|
||||
|
@ -3106,23 +3064,30 @@ aliasInstall(){
|
|||
fi
|
||||
}
|
||||
|
||||
# 个性化安装
|
||||
customInstall(){
|
||||
# v2ray-core个性化安装
|
||||
customV2RayInstall(){
|
||||
echoContent skyBlue "\n========================个性化安装============================"
|
||||
echoContent yellow "VLESS前置,默认安装0,如果只需要安装0,则只选择0即可"
|
||||
if [[ "${selectCoreType}" = "2" ]]
|
||||
then
|
||||
echoContent yellow "0.VLESS+TLS+TCP"
|
||||
else
|
||||
echoContent yellow "0.VLESS+TLS/XTLS+TCP"
|
||||
fi
|
||||
|
||||
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
|
||||
read -p "请选择[多选],[例如:123]:" selectCustomInstallType
|
||||
echoContent skyBlue "--------------------------------------------------------------"
|
||||
if [[ -z ${customInstallType} ]]
|
||||
if [[ -z ${selectCustomInstallType} ]]
|
||||
then
|
||||
echoContent red " ---> 不可为空"
|
||||
customInstall
|
||||
elif [[ "${customInstallType}" =~ ^[0-4]+$ ]]
|
||||
customV2RayInstall
|
||||
elif [[ "${selectCustomInstallType}" =~ ^[0-4]+$ ]]
|
||||
then
|
||||
cleanUp xrayClean
|
||||
totalProgress=17
|
||||
installTools 1
|
||||
# 申请tls
|
||||
|
@ -3131,7 +3096,7 @@ customInstall(){
|
|||
handleNginx stop
|
||||
initNginxConfig 4
|
||||
# 随机path
|
||||
if [[ ! -z `echo ${customInstallType}|grep 1` ]] || [[ ! -z `echo ${customInstallType}|grep 3` ]] || [[ ! -z `echo ${customInstallType}|grep 4` ]]
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 1` ]] || [[ ! -z `echo ${selectCustomInstallType}|grep 3` ]] || [[ ! -z `echo ${selectCustomInstallType}|grep 4` ]]
|
||||
then
|
||||
randomPathFunction 5
|
||||
customCDNIP 6
|
||||
|
@ -3143,7 +3108,8 @@ customInstall(){
|
|||
installV2Ray 8
|
||||
installV2RayService 9
|
||||
initV2RayConfig custom 10
|
||||
if [[ ! -z `echo ${customInstallType}|grep 4` ]]
|
||||
cleanUp xrayDel
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 4` ]]
|
||||
then
|
||||
installTrojanGo 11
|
||||
installTrojanService 12
|
||||
|
@ -3161,16 +3127,76 @@ customInstall(){
|
|||
handleV2Ray start
|
||||
# 生成账号
|
||||
checkGFWStatue 15
|
||||
readInstallType
|
||||
readConfigHostPathUUID
|
||||
readCustomInstallType
|
||||
showAccounts 16
|
||||
else
|
||||
echoContent red " ---> 输入不合法"
|
||||
customInstall
|
||||
customV2RayInstall
|
||||
fi
|
||||
}
|
||||
|
||||
# Xray-core个性化安装
|
||||
customXrayInstall(){
|
||||
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]:" selectCustomInstallType
|
||||
echoContent skyBlue "--------------------------------------------------------------"
|
||||
if [[ -z ${selectCustomInstallType} ]]
|
||||
then
|
||||
echoContent red " ---> 不可为空"
|
||||
customXrayInstall
|
||||
elif [[ "${selectCustomInstallType}" =~ ^[0-4]+$ ]]
|
||||
then
|
||||
cleanUp v2rayClean
|
||||
totalProgress=17
|
||||
installTools 1
|
||||
# 申请tls
|
||||
initTLSNginxConfig 2
|
||||
installTLS 3
|
||||
handleNginx stop
|
||||
initNginxConfig 4
|
||||
# 随机path
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 1` ]] || [[ ! -z `echo ${selectCustomInstallType}|grep 3` ]] || [[ ! -z `echo ${selectCustomInstallType}|grep 4` ]]
|
||||
then
|
||||
randomPathFunction 5
|
||||
customCDNIP 6
|
||||
fi
|
||||
nginxBlog 7
|
||||
handleNginx start
|
||||
|
||||
# 安装V2Ray
|
||||
installXray 8
|
||||
installXrayService 9
|
||||
initXrayConfig custom 10
|
||||
cleanUp v2rayDel
|
||||
if [[ ! -z `echo ${selectCustomInstallType}|grep 4` ]]
|
||||
then
|
||||
installTrojanGo 11
|
||||
installTrojanService 12
|
||||
initTrojanGoConfig 13
|
||||
handleTrojanGo stop
|
||||
handleTrojanGo start
|
||||
else
|
||||
# 这里需要删除trojan的服务
|
||||
handleTrojanGo stop
|
||||
rm -rf /etc/v2ray-agent/trojan/*
|
||||
rm -rf /etc/systemd/system/trojan-go.service
|
||||
fi
|
||||
installCronTLS 14
|
||||
handleXray stop
|
||||
handleXray start
|
||||
# 生成账号
|
||||
checkGFWStatue 15
|
||||
showAccounts 16
|
||||
else
|
||||
echoContent red " ---> 输入不合法"
|
||||
customXrayInstall
|
||||
fi
|
||||
}
|
||||
# 选择核心安装---v2ray-core、xray-core、锁定版本的v2ray-core[xtls]
|
||||
selectCoreInstall(){
|
||||
echoContent skyBlue "\n功能 1/${totalProgress} : 选择核心安装"
|
||||
|
@ -3182,13 +3208,19 @@ selectCoreInstall(){
|
|||
read -p "请选择:" selectCoreType
|
||||
case ${selectCoreType} in
|
||||
1)
|
||||
|
||||
if [[ "${selectInstallType}" = "2" ]]
|
||||
then
|
||||
customXrayInstall
|
||||
else
|
||||
xrayCoreInstall
|
||||
fi
|
||||
;;
|
||||
2)
|
||||
v2rayCoreVersion=
|
||||
if [[ "${selectInstallType}" = "2" ]]
|
||||
then
|
||||
customInstall
|
||||
customV2RayInstall
|
||||
else
|
||||
v2rayCoreInstall
|
||||
fi
|
||||
|
@ -3197,7 +3229,7 @@ selectCoreInstall(){
|
|||
v2rayCoreVersion=v4.32.1
|
||||
if [[ "${selectInstallType}" = "2" ]]
|
||||
then
|
||||
customInstall
|
||||
customV2RayInstall
|
||||
else
|
||||
v2rayCoreInstall
|
||||
fi
|
||||
|
@ -3213,7 +3245,7 @@ selectCoreInstall(){
|
|||
# v2ray-core 安装
|
||||
v2rayCoreInstall(){
|
||||
cleanUp xrayClean
|
||||
customInstallType=
|
||||
selectCustomInstallType=
|
||||
totalProgress=17
|
||||
installTools 2
|
||||
# 申请tls
|
||||
|
@ -3242,15 +3274,12 @@ v2rayCoreInstall(){
|
|||
handleTrojanGo start
|
||||
# 生成账号
|
||||
checkGFWStatue 16
|
||||
readInstallType
|
||||
readConfigHostPathUUID
|
||||
readCustomInstallType
|
||||
showAccounts 17
|
||||
}
|
||||
|
||||
# xray-core 安装
|
||||
xrayCoreInstall(){
|
||||
customInstallType=
|
||||
selectCustomInstallType=
|
||||
cleanUp v2rayClean
|
||||
|
||||
totalProgress=17
|
||||
|
@ -3283,9 +3312,6 @@ xrayCoreInstall(){
|
|||
handleTrojanGo start
|
||||
# 生成账号
|
||||
checkGFWStatue 16
|
||||
readInstallType
|
||||
readConfigHostPathUUID
|
||||
readCustomInstallType
|
||||
showAccounts 17
|
||||
}
|
||||
# 主菜单
|
||||
|
@ -3293,12 +3319,12 @@ menu(){
|
|||
cd
|
||||
echoContent red "\n=============================================================="
|
||||
echoContent green "作者:mack-a"
|
||||
echoContent green "当前版本:v2.1.12"
|
||||
echoContent green "当前版本:v2.1.13"
|
||||
echoContent green "Github:https://github.com/mack-a/v2ray-agent"
|
||||
echoContent green "描述:七合一共存脚本"
|
||||
echoContent red "=============================================================="
|
||||
echoContent yellow "1.安装"
|
||||
echoContent yellow "2.任意组合安装[临时屏蔽]"
|
||||
echoContent yellow "2.任意组合安装"
|
||||
echoContent skyBlue "-------------------------工具管理-----------------------------"
|
||||
echoContent yellow "3.查看账号"
|
||||
echoContent yellow "4.自动排错 [已废弃]"
|
||||
|
@ -3322,9 +3348,9 @@ menu(){
|
|||
selectCoreInstall
|
||||
;;
|
||||
2)
|
||||
echoContent red " ---> 暂不开放"
|
||||
exit 0;
|
||||
# selectCoreInstall
|
||||
# echoContent red " ---> 暂不开放"
|
||||
# exit 0;
|
||||
selectCoreInstall
|
||||
;;
|
||||
3)
|
||||
showAccounts 1
|
||||
|
|
Loading…
Reference in New Issue