@@ -126,7 +126,7 @@ initVar() {
126126
127127 # 1.xray-core安装
128128 # 2.v2ray-core 安装
129- # 3.v2ray-core[xtls] 安装
129+ # 3.xray-core预览版安装
130130 coreInstallType=
131131
132132 # 核心安装path
@@ -197,6 +197,9 @@ initVar() {
197197 # 是否为预览版
198198 prereleaseStatus=false
199199
200+ # xtls是否使用vision
201+ xtlsRprxVision=
202+
200203 # ssl类型
201204 sslType=
202205
@@ -270,31 +273,30 @@ readInstallType() {
270273 # 不带XTLS的v2ray-core
271274 coreInstallType=2
272275 ctlPath=/etc/v2ray-agent/v2ray/v2ctl
273- elif grep < /etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json -q ' "security": "xtls"' ; then
274- # 带XTLS的v2ray-core
275- ctlPath=/etc/v2ray-agent/v2ray/v2ctl
276- coreInstallType=3
277276 fi
278277 fi
279278 fi
280-
281- if [[ -d " /etc/v2ray-agent/xray" && -f " /etc/v2ray-agent/xray/xray" ]]; then
282- # 这里检测xray-core
283- if [[ -d " /etc/v2ray-agent/xray/conf" ]] && [[ -f " /etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" || -f " /etc/v2ray-agent/xray/conf/02_trojan_TCP_inbounds.json" ]]; then
284- # xray-core
285- configPath=/etc/v2ray-agent/xray/conf/
286- ctlPath=/etc/v2ray-agent/xray/xray
279+ fi
280+
281+ if [[ -d " /etc/v2ray-agent/xray" && -f " /etc/v2ray-agent/xray/xray" ]]; then
282+ # 这里检测xray-core
283+ if [[ -d " /etc/v2ray-agent/xray/conf" ]] && [[ -f " /etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" || -f " /etc/v2ray-agent/xray/conf/02_trojan_TCP_inbounds.json" ]]; then
284+ # xray-core
285+ configPath=/etc/v2ray-agent/xray/conf/
286+ ctlPath=/etc/v2ray-agent/xray/xray
287+ if grep < /etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json -q ' "security": "xtls"' ; then
287288 coreInstallType=1
289+ elif grep < /etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json -q ' "security": "tls"' ; then
290+ coreInstallType=3
288291 fi
289292 fi
293+ fi
290294
291- if [[ -d " /etc/v2ray-agent/hysteria" && -f " /etc/v2ray-agent/hysteria/hysteria" ]]; then
292- # 这里检测 hysteria
293- if [[ -d " /etc/v2ray-agent/hysteria/conf" ]] && [[ -f " /etc/v2ray-agent/hysteria/conf/config.json" ]] && [[ -f " /etc/v2ray-agent/hysteria/conf/client_network.json" ]]; then
294- hysteriaConfigPath=/etc/v2ray-agent/hysteria/conf/
295- fi
295+ if [[ -d " /etc/v2ray-agent/hysteria" && -f " /etc/v2ray-agent/hysteria/hysteria" ]]; then
296+ # 这里检测 hysteria
297+ if [[ -d " /etc/v2ray-agent/hysteria/conf" ]] && [[ -f " /etc/v2ray-agent/hysteria/conf/config.json" ]] && [[ -f " /etc/v2ray-agent/hysteria/conf/client_network.json" ]]; then
298+ hysteriaConfigPath=/etc/v2ray-agent/hysteria/conf/
296299 fi
297-
298300 fi
299301}
300302
@@ -480,24 +482,22 @@ readConfigHostPathUUID() {
480482 fi
481483
482484 fi
483- if [[ " ${coreInstallType} " == " 1" ]]; then
484- currentHost=$( jq -r .inbounds[0].streamSettings.xtlsSettings.certificates[0].certificateFile ${configPath}${frontingType} .json | awk -F ' [t][l][s][/]' ' {print $2}' | awk -F ' [.][c][r][t]' ' {print $1}' )
485+ if [[ " ${coreInstallType} " == " 1" || " ${coreInstallType} " == " 3" ]]; then
486+ if [[ " ${coreInstallType} " == " 3" ]]; then
487+ currentHost=$( jq -r .inbounds[0].streamSettings.tlsSettings.certificates[0].certificateFile ${configPath}${frontingType} .json | awk -F ' [t][l][s][/]' ' {print $2}' | awk -F ' [.][c][r][t]' ' {print $1}' )
488+ else
489+ currentHost=$( jq -r .inbounds[0].streamSettings.xtlsSettings.certificates[0].certificateFile ${configPath}${frontingType} .json | awk -F ' [t][l][s][/]' ' {print $2}' | awk -F ' [.][c][r][t]' ' {print $1}' )
490+ fi
485491 currentUUID=$( jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType} .json)
486492 currentAdd=$( jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType} .json)
487493 if [[ " ${currentAdd} " == " null" ]]; then
488494 currentAdd=${currentHost}
489495 fi
490496 currentPort=$( jq .inbounds[0].port ${configPath}${frontingType} .json)
491497
492- elif [[ " ${coreInstallType} " == " 2" || " ${coreInstallType} " == " 3" ]]; then
493- if [[ " ${coreInstallType} " == " 3" ]]; then
494-
495- currentHost=$( jq -r .inbounds[0].streamSettings.xtlsSettings.certificates[0].certificateFile ${configPath}${frontingType} .json | awk -F ' [t][l][s][/]' ' {print $2}' | awk -F ' [.][c][r][t]' ' {print $1}' )
496- else
497- currentHost=$( jq -r .inbounds[0].streamSettings.tlsSettings.certificates[0].certificateFile ${configPath}${frontingType} .json | awk -F ' [t][l][s][/]' ' {print $2}' | awk -F ' [.][c][r][t]' ' {print $1}' )
498- fi
498+ elif [[ " ${coreInstallType} " == " 2" ]]; then
499+ currentHost=$( jq -r .inbounds[0].streamSettings.tlsSettings.certificates[0].certificateFile ${configPath}${frontingType} .json | awk -F ' [t][l][s][/]' ' {print $2}' | awk -F ' [.][c][r][t]' ' {print $1}' )
499500 currentAdd=$( jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType} .json)
500-
501501 if [[ " ${currentAdd} " == " null" ]]; then
502502 currentAdd=${currentHost}
503503 fi
@@ -509,14 +509,14 @@ readConfigHostPathUUID() {
509509# 状态展示
510510showInstallStatus () {
511511 if [[ -n " ${coreInstallType} " ]]; then
512- if [[ " ${coreInstallType} " == 1 ]]; then
512+ if [[ " ${coreInstallType} " == 1 || " ${coreInstallType} " == 3 ]]; then
513513 if [[ -n $( pgrep -f xray/xray) ]]; then
514514 echoContent yellow " \n核心: Xray-core[运行中]"
515515 else
516516 echoContent yellow " \n核心: Xray-core[未运行]"
517517 fi
518518
519- elif [[ " ${coreInstallType} " == 2 || " ${coreInstallType} " == 3 ]]; then
519+ elif [[ " ${coreInstallType} " == 2 ]]; then
520520 if [[ -n $( pgrep -f v2ray/v2ray) ]]; then
521521 echoContent yellow " \n核心: v2ray-core[运行中]"
522522 else
@@ -858,8 +858,9 @@ initTLSNginxConfig() {
858858 handleNginx stop
859859 echoContent skyBlue " \n进度 $1 /${totalProgress} : 初始化Nginx申请证书配置"
860860 if [[ -n " ${currentHost} " ]]; then
861+ echo " 读取到上次安装记录,上次安装时的域名: ${currentHost} "
861862 echo
862- read -r -p " 读取到上次安装记录 ,是否使用上次安装时的域名 ?[y/n]:" historyDomainStatus
863+ read -r -p " 请注意检测正确性 ,是否使用上次安装时的域名 ?[y/n]:" historyDomainStatus
863864 if [[ " ${historyDomainStatus} " == " y" ]]; then
864865 domain=${currentHost}
865866 echoContent yellow " \n ---> 域名: ${domain} "
@@ -1656,7 +1657,7 @@ installXray() {
16561657
16571658 if [[ " ${coreInstallType} " != " 1" ]]; then
16581659
1659- version=$( curl -s https://api.github.com/repos/XTLS/Xray-core/releases | jq -r ' .[]|select (.prerelease==false )|.tag_name' | head -1)
1660+ version=$( curl -s https://api.github.com/repos/XTLS/Xray-core/releases | jq -r " .[]|select (.prerelease==${prereleaseStatus} )|.tag_name" | head -1)
16601661
16611662 echoContent green " ---> Xray-core版本:${version} "
16621663 if wget --help | grep -q show-progress; then
@@ -1810,9 +1811,9 @@ updateV2Ray() {
18101811 if [[ -n " $1 " ]]; then
18111812 read -r -p " 回退版本为${version} ,是否继续?[y/n]:" rollbackV2RayStatus
18121813 if [[ " ${rollbackV2RayStatus} " == " y" ]]; then
1813- if [[ " ${coreInstallType} " == " 2" || " ${coreInstallType} " == " 3 " ]]; then
1814+ if [[ " ${coreInstallType} " == " 2" ]]; then
18141815 echoContent green " ---> 当前v2ray-core版本:$( /etc/v2ray-agent/v2ray/v2ray --version | awk ' {print $2}' | head -1) "
1815- elif [[ " ${coreInstallType} " == " 1" ]]; then
1816+ elif [[ " ${coreInstallType} " == " 1" || " ${coreInstallType} " == " 3 " ]]; then
18161817 echoContent green " ---> 当前Xray-core版本:$( /etc/v2ray-agent/xray/xray --version | awk ' {print $2}' | head -1) "
18171818 fi
18181819
@@ -1917,9 +1918,9 @@ updateXray() {
19171918checkGFWStatue () {
19181919 readInstallType
19191920 echoContent skyBlue " \n进度 $1 /${totalProgress} : 验证服务启动状态"
1920- if [[ " ${coreInstallType} " == " 1" ]] && [[ -n $( pgrep -f xray/xray) ]]; then
1921+ if [[ " ${coreInstallType} " == " 1" || " ${coreInstallType} " == " 3 " ]] && [[ -n $( pgrep -f xray/xray) ]]; then
19211922 echoContent green " ---> 服务启动成功"
1922- elif [[ " ${coreInstallType} " == " 2" || " ${coreInstallType} " == " 3 " ]] && [[ -n $( pgrep -f v2ray/v2ray) ]]; then
1923+ elif [[ " ${coreInstallType} " == " 2" ]] && [[ -n $( pgrep -f v2ray/v2ray) ]]; then
19231924 echoContent green " ---> 服务启动成功"
19241925 else
19251926 echoContent red " ---> 服务启动失败,请检查终端是否有日志打印"
@@ -2701,30 +2702,27 @@ initXrayConfig() {
27012702 if [[ -n " ${currentUUID} " ]]; then
27022703 read -r -p " 读取到上次安装记录,是否使用上次安装时的UUID ?[y/n]:" historyUUIDStatus
27032704 if [[ " ${historyUUIDStatus} " == " y" ]]; then
2704- addClientsStatus=true
27052705 uuid=${currentUUID}
27062706 echoContent green " \n ---> 使用成功"
27072707 fi
2708- fi
2708+ else
2709+ if [[ -z " ${uuid} " ]]; then
2710+ echoContent yellow " 请输入自定义UUID[需合法],[回车]随机UUID"
2711+ read -r -p ' UUID:' customUUID
27092712
2710- if [[ -z " ${uuid} " ]]; then
2711- echoContent yellow " 请输入自定义UUID[需合法],[回车]随机UUID"
2712- read -r -p ' UUID:' customUUID
2713+ if [[ -n ${customUUID} ]]; then
2714+ uuid=${customUUID}
2715+ else
2716+ uuid=$( /etc/v2ray-agent/xray/xray uuid)
2717+ fi
27132718
2714- if [[ -n ${customUUID} ]]; then
2715- uuid=${customUUID}
2716- else
2717- uuid=$( /etc/v2ray-agent/xray/xray uuid)
27182719 fi
27192720
2720- fi
2721-
2722- if [[ -z " ${uuid} " ]]; then
2723- addClientsStatus=
2724- echoContent red " \n ---> uuid读取错误,重新生成"
2725- uuid=$( /etc/v2ray-agent/xray/xray uuid)
2726- fi
2727-
2721+ if [[ -z " ${uuid} " ]]; then
2722+ echoContent red " \n ---> uuid读取错误,重新生成"
2723+ uuid=$( /etc/v2ray-agent/xray/xray uuid)
2724+ fi
2725+ fi
27282726 echoContent yellow " \n ${uuid} "
27292727
27302728 movePreviousConfig
@@ -2785,7 +2783,7 @@ EOF
27852783{
27862784 "dns": {
27872785 "servers": [
2788- "localhost "
2786+ "8.8.8.8 "
27892787 ]
27902788 }
27912789}
@@ -2985,8 +2983,53 @@ EOF
29852983 if [[ -n " ${customPort} " ]]; then
29862984 defaultPort=${customPort}
29872985 fi
2988-
2989- cat << EOF >/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
2986+ if [ " $xtlsRprxVision " == true ]; then
2987+ cat << EOF >/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
2988+ {
2989+ "inbounds":[
2990+ {
2991+ "port": ${defaultPort} ,
2992+ "protocol": "vless",
2993+ "tag":"VLESSTCP",
2994+ "settings": {
2995+ "clients": [
2996+ {
2997+ "id": "${uuid} ",
2998+ "add":"${add} ",
2999+ "flow":"xtls-rprx-vision",
3000+ "email": "${domain} _${uuid} "
3001+ }
3002+ ],
3003+ "decryption": "none",
3004+ "fallbacks": [
3005+ ${fallbacksList}
3006+ ]
3007+ },
3008+ "streamSettings": {
3009+ "network": "tcp",
3010+ "security": "tls",
3011+ "tlsSettings": {
3012+ "minVersion": "1.2",
3013+ "alpn": [
3014+ "http/1.1",
3015+ "h2"
3016+ ],
3017+ "certificates": [
3018+ {
3019+ "certificateFile": "/etc/v2ray-agent/tls/${domain} .crt",
3020+ "keyFile": "/etc/v2ray-agent/tls/${domain} .key",
3021+ "ocspStapling": 3600,
3022+ "usage":"encipherment"
3023+ }
3024+ ]
3025+ }
3026+ }
3027+ }
3028+ ]
3029+ }
3030+ EOF
3031+ else
3032+ cat << EOF >/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json
29903033{
29913034"inbounds":[
29923035{
@@ -3030,6 +3073,7 @@ EOF
30303073]
30313074}
30323075EOF
3076+ fi
30333077 addClients " /etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" " ${addClientsStatus} "
30343078}
30353079
@@ -3136,7 +3180,7 @@ EOF
31363180 echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-splice)"
31373181 echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id} %40${currentHost} %3A${currentDefaultPort} %3Fencryption%3Dnone%26security%3Dxtls%26type%3Dtcp%26${currentHost} %3D${currentHost} %26headerType%3Dnone%26sni%3D${currentHost} %26flow%3Dxtls-rprx-splice%23${email/ direct/ splice} \n"
31383182
3139- elif [[ " ${coreInstallType} " == 2 || " ${coreInstallType} " == " 3 " ]]; then
3183+ elif [[ " ${coreInstallType} " == 2 ]]; then
31403184 echoContent yellow " ---> 通用格式(VLESS+TCP+TLS)"
31413185 echoContent green " vless://${id} @${currentHost} :${currentDefaultPort} ?security=tls&encryption=none&host=${currentHost} &headerType=none&type=tcp#${email} \n"
31423186
@@ -3148,6 +3192,19 @@ vless://${id}@${currentHost}:${currentDefaultPort}?security=tls&encryption=none&
31483192EOF
31493193 echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS)"
31503194 echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3a%2f%2f${id} %40${currentHost} %3a${currentDefaultPort} %3fsecurity%3dtls%26encryption%3dnone%26host%3d${currentHost} %26headerType%3dnone%26type%3dtcp%23${email} \n"
3195+
3196+ elif [[ " ${coreInstallType} " == 3 ]] && echo " ${currentInstallProtocolType} " | grep -q 0; then
3197+ echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-vision)"
3198+ echoContent green " vless://${id} @${currentHost} :${currentDefaultPort} ?encryption=none&security=tls&type=tcp&host=${currentHost} &headerType=none&sni=${currentHost} &flow=xtls-rprx-vision#${email/ direct/ splice} \n"
3199+
3200+ echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-vision)"
3201+ echoContent green " 协议类型:VLESS,地址:${currentHost} ,端口:${currentDefaultPort} ,用户ID:${id} ,安全:tls,传输方式:tcp,flow:xtls-rprx-vision,账户名:${email/ direct/ splice} \n"
3202+
3203+ cat << EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount} "
3204+ vless://${id} @${currentHost} :${currentDefaultPort} ?security=tls&encryption=none&host=${currentHost} &headerType=none&type=tcp#${email}
3205+ EOF
3206+ echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS)"
3207+ echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vless%3A%2F%2F${id} %40${currentHost} %3A${currentDefaultPort} %3Fencryption%3Dnone%26security%3Dtls%26type%3Dtcp%26${currentHost} %3D${currentHost} %26headerType%3Dnone%26sni%3D${currentHost} %26flow%3Dxtls-rprx-vision%23${email/ direct/ splice} \n"
31513208 fi
31523209
31533210 elif [[ " ${type} " == " trojanTCPXTLS" ]]; then
@@ -3291,7 +3348,7 @@ showAccounts() {
32913348 done
32923349
32933350 else
3294- echoContent skyBlue " ===================== VLESS TCP TLS/XTLS-direct/XTLS-splice ====== ================\n"
3351+ echoContent skyBlue " ================ VLESS TCP TLS/XTLS-direct/XTLS-splice/XTLS-vision ================\n"
32953352 jq .inbounds[0].settings.clients ${configPath} 02_VLESS_TCP_inbounds.json | jq -c ' .[]' | while read -r user; do
32963353 local email=
32973354 email=$( echo " ${user} " | jq -r .email)
@@ -3985,7 +4042,7 @@ updateV2RayAgent() {
39854042 else
39864043 updateV2RayAgent
39874044 fi
3988-
4045+
39894046 echoContent skyBlue " \n进度 $1 /${totalProgress} : 更新v2ray-agent脚本"
39904047 rm -rf /etc/v2ray-agent/install.sh
39914048 if wget --help | grep -q show-progress; then
@@ -4911,10 +4968,10 @@ removeVMessWSTLSUnblockStreamingMedia() {
49114968
49124969# 重启核心
49134970reloadCore () {
4914- if [[ " ${coreInstallType} " == " 1" ]]; then
4971+ if [[ " ${coreInstallType} " == " 1" || " ${coreInstallType} " == " 3 " ]]; then
49154972 handleXray stop
49164973 handleXray start
4917- elif [[ " ${coreInstallType} " == " 2" || " ${coreInstallType} " == " 3 " ]]; then
4974+ elif [[ " ${coreInstallType} " == " 2" ]]; then
49184975 handleV2Ray stop
49194976 handleV2Ray start
49204977 fi
@@ -5150,6 +5207,7 @@ selectCoreInstall() {
51505207 echoContent red " \n=============================================================="
51515208 echoContent yellow " 1.Xray-core"
51525209 echoContent yellow " 2.v2ray-core"
5210+ echoContent yellow " 3.Xray-core预览版(tcp默认使用xtls-rprx-vision)"
51535211 echoContent red " =============================================================="
51545212 read -r -p " 请选择:" selectCoreType
51555213 case ${selectCoreType} in
@@ -5169,11 +5227,12 @@ selectCoreInstall() {
51695227 fi
51705228 ;;
51715229 3)
5172- v2rayCoreVersion=v4.32.1
5230+ prereleaseStatus=true
5231+ xtlsRprxVision=true
51735232 if [[ " ${selectInstallType} " == " 2" ]]; then
5174- customV2RayInstall
5233+ customXrayInstall
51755234 else
5176- v2rayCoreInstall
5235+ xrayCoreInstall
51775236 fi
51785237 ;;
51795238 * )
@@ -5289,15 +5348,11 @@ coreVersionManageMenu() {
52895348 menu
52905349 exit 0
52915350 fi
5292- if [[ " ${coreInstallType} " == " 1" ]]; then
5351+ if [[ " ${coreInstallType} " == " 1" || " ${coreInstallType} " == " 3 " ]]; then
52935352 xrayVersionManageMenu 1
52945353 elif [[ " ${coreInstallType} " == " 2" ]]; then
52955354 v2rayCoreVersion=
52965355 v2rayVersionManageMenu 1
5297-
5298- elif [[ " ${coreInstallType} " == " 3" ]]; then
5299- v2rayCoreVersion=v4.32.1
5300- v2rayVersionManageMenu 1
53015356 fi
53025357}
53035358# 定时任务检查证书
@@ -5447,7 +5502,7 @@ menu() {
54475502 echoContent red " \n=============================================================="
54485503 echoContent green " 作者:Reece"
54495504 echoContent green " 原作者:mack-a"
5450- echoContent green " 当前版本:v2.6.15 "
5505+ echoContent green " 当前版本:v2.7.0 "
54515506 echoContent green " Github:https://github.com/reeceyng/v2ray-agent"
54525507 echoContent green " 描述:八合一共存脚本\c"
54535508 showInstallStatus
0 commit comments