@@ -126,7 +126,7 @@ initVar() {
126
126
127
127
# 1.xray-core安装
128
128
# 2.v2ray-core 安装
129
- # 3.v2ray-core[xtls] 安装
129
+ # 3.xray-core预览版安装
130
130
coreInstallType=
131
131
132
132
# 核心安装path
@@ -197,6 +197,9 @@ initVar() {
197
197
# 是否为预览版
198
198
prereleaseStatus=false
199
199
200
+ # xtls是否使用vision
201
+ xtlsRprxVision=
202
+
200
203
# ssl类型
201
204
sslType=
202
205
@@ -270,31 +273,30 @@ readInstallType() {
270
273
# 不带XTLS的v2ray-core
271
274
coreInstallType=2
272
275
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
277
276
fi
278
277
fi
279
278
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
287
288
coreInstallType=1
289
+ elif grep < /etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json -q ' "security": "tls"' ; then
290
+ coreInstallType=3
288
291
fi
289
292
fi
293
+ fi
290
294
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/
296
299
fi
297
-
298
300
fi
299
301
}
300
302
@@ -480,24 +482,22 @@ readConfigHostPathUUID() {
480
482
fi
481
483
482
484
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
485
491
currentUUID=$( jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType} .json)
486
492
currentAdd=$( jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType} .json)
487
493
if [[ " ${currentAdd} " == " null" ]]; then
488
494
currentAdd=${currentHost}
489
495
fi
490
496
currentPort=$( jq .inbounds[0].port ${configPath}${frontingType} .json)
491
497
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}' )
499
500
currentAdd=$( jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType} .json)
500
-
501
501
if [[ " ${currentAdd} " == " null" ]]; then
502
502
currentAdd=${currentHost}
503
503
fi
@@ -509,14 +509,14 @@ readConfigHostPathUUID() {
509
509
# 状态展示
510
510
showInstallStatus () {
511
511
if [[ -n " ${coreInstallType} " ]]; then
512
- if [[ " ${coreInstallType} " == 1 ]]; then
512
+ if [[ " ${coreInstallType} " == 1 || " ${coreInstallType} " == 3 ]]; then
513
513
if [[ -n $( pgrep -f xray/xray) ]]; then
514
514
echoContent yellow " \n核心: Xray-core[运行中]"
515
515
else
516
516
echoContent yellow " \n核心: Xray-core[未运行]"
517
517
fi
518
518
519
- elif [[ " ${coreInstallType} " == 2 || " ${coreInstallType} " == 3 ]]; then
519
+ elif [[ " ${coreInstallType} " == 2 ]]; then
520
520
if [[ -n $( pgrep -f v2ray/v2ray) ]]; then
521
521
echoContent yellow " \n核心: v2ray-core[运行中]"
522
522
else
@@ -858,8 +858,9 @@ initTLSNginxConfig() {
858
858
handleNginx stop
859
859
echoContent skyBlue " \n进度 $1 /${totalProgress} : 初始化Nginx申请证书配置"
860
860
if [[ -n " ${currentHost} " ]]; then
861
+ echo " 读取到上次安装记录,上次安装时的域名: ${currentHost} "
861
862
echo
862
- read -r -p " 读取到上次安装记录 ,是否使用上次安装时的域名 ?[y/n]:" historyDomainStatus
863
+ read -r -p " 请注意检测正确性 ,是否使用上次安装时的域名 ?[y/n]:" historyDomainStatus
863
864
if [[ " ${historyDomainStatus} " == " y" ]]; then
864
865
domain=${currentHost}
865
866
echoContent yellow " \n ---> 域名: ${domain} "
@@ -1656,7 +1657,7 @@ installXray() {
1656
1657
1657
1658
if [[ " ${coreInstallType} " != " 1" ]]; then
1658
1659
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)
1660
1661
1661
1662
echoContent green " ---> Xray-core版本:${version} "
1662
1663
if wget --help | grep -q show-progress; then
@@ -1810,9 +1811,9 @@ updateV2Ray() {
1810
1811
if [[ -n " $1 " ]]; then
1811
1812
read -r -p " 回退版本为${version} ,是否继续?[y/n]:" rollbackV2RayStatus
1812
1813
if [[ " ${rollbackV2RayStatus} " == " y" ]]; then
1813
- if [[ " ${coreInstallType} " == " 2" || " ${coreInstallType} " == " 3 " ]]; then
1814
+ if [[ " ${coreInstallType} " == " 2" ]]; then
1814
1815
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
1816
1817
echoContent green " ---> 当前Xray-core版本:$( /etc/v2ray-agent/xray/xray --version | awk ' {print $2}' | head -1) "
1817
1818
fi
1818
1819
@@ -1917,9 +1918,9 @@ updateXray() {
1917
1918
checkGFWStatue () {
1918
1919
readInstallType
1919
1920
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
1921
1922
echoContent green " ---> 服务启动成功"
1922
- elif [[ " ${coreInstallType} " == " 2" || " ${coreInstallType} " == " 3 " ]] && [[ -n $( pgrep -f v2ray/v2ray) ]]; then
1923
+ elif [[ " ${coreInstallType} " == " 2" ]] && [[ -n $( pgrep -f v2ray/v2ray) ]]; then
1923
1924
echoContent green " ---> 服务启动成功"
1924
1925
else
1925
1926
echoContent red " ---> 服务启动失败,请检查终端是否有日志打印"
@@ -2701,30 +2702,27 @@ initXrayConfig() {
2701
2702
if [[ -n " ${currentUUID} " ]]; then
2702
2703
read -r -p " 读取到上次安装记录,是否使用上次安装时的UUID ?[y/n]:" historyUUIDStatus
2703
2704
if [[ " ${historyUUIDStatus} " == " y" ]]; then
2704
- addClientsStatus=true
2705
2705
uuid=${currentUUID}
2706
2706
echoContent green " \n ---> 使用成功"
2707
2707
fi
2708
- fi
2708
+ else
2709
+ if [[ -z " ${uuid} " ]]; then
2710
+ echoContent yellow " 请输入自定义UUID[需合法],[回车]随机UUID"
2711
+ read -r -p ' UUID:' customUUID
2709
2712
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
2713
2718
2714
- if [[ -n ${customUUID} ]]; then
2715
- uuid=${customUUID}
2716
- else
2717
- uuid=$( /etc/v2ray-agent/xray/xray uuid)
2718
2719
fi
2719
2720
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
2728
2726
echoContent yellow " \n ${uuid} "
2729
2727
2730
2728
movePreviousConfig
@@ -2785,7 +2783,7 @@ EOF
2785
2783
{
2786
2784
"dns": {
2787
2785
"servers": [
2788
- "localhost "
2786
+ "8.8.8.8 "
2789
2787
]
2790
2788
}
2791
2789
}
@@ -2985,8 +2983,53 @@ EOF
2985
2983
if [[ -n " ${customPort} " ]]; then
2986
2984
defaultPort=${customPort}
2987
2985
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
2990
3033
{
2991
3034
"inbounds":[
2992
3035
{
@@ -3030,6 +3073,7 @@ EOF
3030
3073
]
3031
3074
}
3032
3075
EOF
3076
+ fi
3033
3077
addClients " /etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" " ${addClientsStatus} "
3034
3078
}
3035
3079
@@ -3136,7 +3180,7 @@ EOF
3136
3180
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-splice)"
3137
3181
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"
3138
3182
3139
- elif [[ " ${coreInstallType} " == 2 || " ${coreInstallType} " == " 3 " ]]; then
3183
+ elif [[ " ${coreInstallType} " == 2 ]]; then
3140
3184
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS)"
3141
3185
echoContent green " vless://${id} @${currentHost} :${currentDefaultPort} ?security=tls&encryption=none&host=${currentHost} &headerType=none&type=tcp#${email} \n"
3142
3186
@@ -3148,6 +3192,19 @@ vless://${id}@${currentHost}:${currentDefaultPort}?security=tls&encryption=none&
3148
3192
EOF
3149
3193
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS)"
3150
3194
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"
3151
3208
fi
3152
3209
3153
3210
elif [[ " ${type} " == " trojanTCPXTLS" ]]; then
@@ -3291,7 +3348,7 @@ showAccounts() {
3291
3348
done
3292
3349
3293
3350
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"
3295
3352
jq .inbounds[0].settings.clients ${configPath} 02_VLESS_TCP_inbounds.json | jq -c ' .[]' | while read -r user; do
3296
3353
local email=
3297
3354
email=$( echo " ${user} " | jq -r .email)
@@ -3985,7 +4042,7 @@ updateV2RayAgent() {
3985
4042
else
3986
4043
updateV2RayAgent
3987
4044
fi
3988
-
4045
+
3989
4046
echoContent skyBlue " \n进度 $1 /${totalProgress} : 更新v2ray-agent脚本"
3990
4047
rm -rf /etc/v2ray-agent/install.sh
3991
4048
if wget --help | grep -q show-progress; then
@@ -4911,10 +4968,10 @@ removeVMessWSTLSUnblockStreamingMedia() {
4911
4968
4912
4969
# 重启核心
4913
4970
reloadCore () {
4914
- if [[ " ${coreInstallType} " == " 1" ]]; then
4971
+ if [[ " ${coreInstallType} " == " 1" || " ${coreInstallType} " == " 3 " ]]; then
4915
4972
handleXray stop
4916
4973
handleXray start
4917
- elif [[ " ${coreInstallType} " == " 2" || " ${coreInstallType} " == " 3 " ]]; then
4974
+ elif [[ " ${coreInstallType} " == " 2" ]]; then
4918
4975
handleV2Ray stop
4919
4976
handleV2Ray start
4920
4977
fi
@@ -5150,6 +5207,7 @@ selectCoreInstall() {
5150
5207
echoContent red " \n=============================================================="
5151
5208
echoContent yellow " 1.Xray-core"
5152
5209
echoContent yellow " 2.v2ray-core"
5210
+ echoContent yellow " 3.Xray-core预览版(tcp默认使用xtls-rprx-vision)"
5153
5211
echoContent red " =============================================================="
5154
5212
read -r -p " 请选择:" selectCoreType
5155
5213
case ${selectCoreType} in
@@ -5169,11 +5227,12 @@ selectCoreInstall() {
5169
5227
fi
5170
5228
;;
5171
5229
3)
5172
- v2rayCoreVersion=v4.32.1
5230
+ prereleaseStatus=true
5231
+ xtlsRprxVision=true
5173
5232
if [[ " ${selectInstallType} " == " 2" ]]; then
5174
- customV2RayInstall
5233
+ customXrayInstall
5175
5234
else
5176
- v2rayCoreInstall
5235
+ xrayCoreInstall
5177
5236
fi
5178
5237
;;
5179
5238
* )
@@ -5289,15 +5348,11 @@ coreVersionManageMenu() {
5289
5348
menu
5290
5349
exit 0
5291
5350
fi
5292
- if [[ " ${coreInstallType} " == " 1" ]]; then
5351
+ if [[ " ${coreInstallType} " == " 1" || " ${coreInstallType} " == " 3 " ]]; then
5293
5352
xrayVersionManageMenu 1
5294
5353
elif [[ " ${coreInstallType} " == " 2" ]]; then
5295
5354
v2rayCoreVersion=
5296
5355
v2rayVersionManageMenu 1
5297
-
5298
- elif [[ " ${coreInstallType} " == " 3" ]]; then
5299
- v2rayCoreVersion=v4.32.1
5300
- v2rayVersionManageMenu 1
5301
5356
fi
5302
5357
}
5303
5358
# 定时任务检查证书
@@ -5447,7 +5502,7 @@ menu() {
5447
5502
echoContent red " \n=============================================================="
5448
5503
echoContent green " 作者:Reece"
5449
5504
echoContent green " 原作者:mack-a"
5450
- echoContent green " 当前版本:v2.6.15 "
5505
+ echoContent green " 当前版本:v2.7.0 "
5451
5506
echoContent green " Github:https://github.com/reeceyng/v2ray-agent"
5452
5507
echoContent green " 描述:八合一共存脚本\c"
5453
5508
showInstallStatus
0 commit comments