feat(脚本): 添加xtls-rprx-vision、移除其余xtls类型

pull/534/merge
mack-a 2023-01-12 16:53:37 +08:00
parent 45c5a75b19
commit 13114c9a76
1 changed files with 41 additions and 94 deletions

View File

@ -267,13 +267,8 @@ readInstallType() {
if [[ -d "/etc/v2ray-agent/v2ray/conf" && -f "/etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json" ]]; then if [[ -d "/etc/v2ray-agent/v2ray/conf" && -f "/etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json" ]]; then
configPath=/etc/v2ray-agent/v2ray/conf/ configPath=/etc/v2ray-agent/v2ray/conf/
if grep </etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json -q '"security": "tls"'; then if grep </etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json -q '"security": "tls"'; then
# 不带XTLS的v2ray-core
coreInstallType=2 coreInstallType=2
ctlPath=/etc/v2ray-agent/v2ray/v2ctl ctlPath=/etc/v2ray-agent/v2ray/v2ctl
elif grep </etc/v2ray-agent/v2ray/conf/02_VLESS_TCP_inbounds.json -q '"security": "xtls"'; then
# 带XTLS的v2ray-core
ctlPath=/etc/v2ray-agent/v2ray/v2ctl
coreInstallType=3
fi fi
fi fi
fi fi
@ -344,7 +339,7 @@ checkBTPanel() {
readInstallAlpn() { readInstallAlpn() {
if [[ -n ${currentInstallProtocolType} ]]; then if [[ -n ${currentInstallProtocolType} ]]; then
local alpn local alpn
alpn=$(jq -r .inbounds[0].streamSettings.xtlsSettings.alpn[0] ${configPath}${frontingType}.json) alpn=$(jq -r .inbounds[0].streamSettings.tlsSettings.alpn[0] ${configPath}${frontingType}.json)
if [[ -n ${alpn} ]]; then if [[ -n ${alpn} ]]; then
currentAlpn=${alpn} currentAlpn=${alpn}
fi fi
@ -483,7 +478,7 @@ readConfigHostPathUUID() {
fi fi
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
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}') 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}')
currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType}.json) currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType}.json)
currentAdd=$(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json) currentAdd=$(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json)
if [[ "${currentAdd}" == "null" ]]; then if [[ "${currentAdd}" == "null" ]]; then
@ -491,13 +486,8 @@ readConfigHostPathUUID() {
fi fi
currentPort=$(jq .inbounds[0].port ${configPath}${frontingType}.json) currentPort=$(jq .inbounds[0].port ${configPath}${frontingType}.json)
elif [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]]; then elif [[ "${coreInstallType}" == "2" ]]; then
if [[ "${coreInstallType}" == "3" ]]; then 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}')
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}')
else
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}')
fi
currentAdd=$(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json) currentAdd=$(jq -r .inbounds[0].settings.clients[0].add ${configPath}${frontingType}.json)
if [[ "${currentAdd}" == "null" ]]; then if [[ "${currentAdd}" == "null" ]]; then
@ -1812,7 +1802,7 @@ updateV2Ray() {
if [[ -n "$1" ]]; then if [[ -n "$1" ]]; then
read -r -p "回退版本为${version},是否继续?[y/n]:" rollbackV2RayStatus read -r -p "回退版本为${version},是否继续?[y/n]:" rollbackV2RayStatus
if [[ "${rollbackV2RayStatus}" == "y" ]]; then if [[ "${rollbackV2RayStatus}" == "y" ]]; then
if [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]]; then if [[ "${coreInstallType}" == "2" ]]; then
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)"
elif [[ "${coreInstallType}" == "1" ]]; then elif [[ "${coreInstallType}" == "1" ]]; then
echoContent green " ---> 当前Xray-core版本:$(/etc/v2ray-agent/xray/xray --version | awk '{print $2}' | head -1)" echoContent green " ---> 当前Xray-core版本:$(/etc/v2ray-agent/xray/xray --version | awk '{print $2}' | head -1)"
@ -1921,7 +1911,7 @@ checkGFWStatue() {
echoContent skyBlue "\n进度 $1/${totalProgress} : 验证服务启动状态" echoContent skyBlue "\n进度 $1/${totalProgress} : 验证服务启动状态"
if [[ "${coreInstallType}" == "1" ]] && [[ -n $(pgrep -f xray/xray) ]]; then if [[ "${coreInstallType}" == "1" ]] && [[ -n $(pgrep -f xray/xray) ]]; then
echoContent green " ---> 服务启动成功" echoContent green " ---> 服务启动成功"
elif [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]] && [[ -n $(pgrep -f v2ray/v2ray) ]]; then elif [[ "${coreInstallType}" == "2" ]] && [[ -n $(pgrep -f v2ray/v2ray) ]]; then
echoContent green " ---> 服务启动成功" echoContent green " ---> 服务启动成功"
else else
echoContent red " ---> 服务启动失败,请检查终端是否有日志打印" echoContent red " ---> 服务启动失败,请检查终端是否有日志打印"
@ -2626,6 +2616,8 @@ EOF
# 初始化Xray Trojan XTLS 配置文件 # 初始化Xray Trojan XTLS 配置文件
initXrayFrontingConfig() { initXrayFrontingConfig() {
echoContent red " ---> Trojan暂不支持 xtls-rprx-vision"
exit 0;
if [[ -z "${configPath}" ]]; then if [[ -z "${configPath}" ]]; then
echoContent red " ---> 未安装,请使用脚本安装" echoContent red " ---> 未安装,请使用脚本安装"
menu menu
@ -3000,7 +2992,7 @@ EOF
{ {
"id": "${uuid}", "id": "${uuid}",
"add":"${add}", "add":"${add}",
"flow":"xtls-rprx-direct", "flow":"xtls-rprx-vision,none",
"email": "${domain}_${uuid}" "email": "${domain}_${uuid}"
} }
], ],
@ -3011,8 +3003,8 @@ EOF
}, },
"streamSettings": { "streamSettings": {
"network": "tcp", "network": "tcp",
"security": "xtls", "security": "tls",
"xtlsSettings": { "tlsSettings": {
"minVersion": "1.2", "minVersion": "1.2",
"alpn": [ "alpn": [
"http/1.1", "http/1.1",
@ -3114,36 +3106,25 @@ defaultBase64Code() {
if [[ "${type}" == "vlesstcp" ]]; then if [[ "${type}" == "vlesstcp" ]]; then
if [[ "${coreInstallType}" == "1" ]] && echo "${currentInstallProtocolType}" | grep -q 0; then if [[ "${coreInstallType}" == "1" ]] && echo "${currentInstallProtocolType}" | grep -q 0; then
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-vision)"
echoContent green " vless://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-direct#${email}\n" echoContent green " vless://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=tls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-vision#${email}\n"
echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-vision)"
echoContent green "协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:xtls传输方式:tcpflow:xtls-rprx-direct,账户名:${email}\n" echoContent green "协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:tcpflow:xtls-rprx-vision,账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
vless://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-direct#${email} vless://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=tls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-vision#${email}
EOF EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-vision)"
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-direct%23${email}\n" 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}\n"
echoContent skyBlue "----------------------------------------------------------------------------------" echoContent skyBlue "----------------------------------------------------------------------------------"
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS/xtls-rprx-splice)" elif [[ "${coreInstallType}" == 2 ]]; then
echoContent green " vless://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-splice#${email/direct/splice}\n"
echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-splice)"
echoContent green " 协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:xtls传输方式:tcpflow:xtls-rprx-splice账户名:${email/direct/splice}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
vless://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-splice#${email/direct/splice}
EOF
echoContent yellow " ---> 二维码 VLESS(VLESS+TCP+TLS/xtls-rprx-splice)"
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"
elif [[ "${coreInstallType}" == 2 || "${coreInstallType}" == "3" ]]; then
echoContent yellow " ---> 通用格式(VLESS+TCP+TLS)" echoContent yellow " ---> 通用格式(VLESS+TCP+TLS)"
echoContent green " vless://${id}@${currentHost}:${currentDefaultPort}?security=tls&encryption=none&host=${currentHost}&headerType=none&type=tcp#${email}\n" echoContent green " vless://${id}@${currentHost}:${currentDefaultPort}?security=tls&encryption=none&host=${currentHost}&headerType=none&type=tcp#${email}\n"
echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS/xtls-rprx-splice)" echoContent yellow " ---> 格式化明文(VLESS+TCP+TLS)"
echoContent green " 协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:tcp账户名:${email/direct/splice}\n" echoContent green " 协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:tls传输方式:tcp账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
vless://${id}@${currentHost}:${currentDefaultPort}?security=tls&encryption=none&host=${currentHost}&headerType=none&type=tcp#${email} vless://${id}@${currentHost}:${currentDefaultPort}?security=tls&encryption=none&host=${currentHost}&headerType=none&type=tcp#${email}
@ -3153,29 +3134,16 @@ EOF
fi fi
elif [[ "${type}" == "trojanTCPXTLS" ]]; then elif [[ "${type}" == "trojanTCPXTLS" ]]; then
echoContent yellow " ---> 通用格式(Trojan+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 通用格式(Trojan+TCP+TLS/xtls-rprx-vision)"
echoContent green " trojan://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-direct#${email}\n" echoContent green " trojan://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-vision#${email}\n"
echoContent yellow " ---> 格式化明文(Trojan+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 格式化明文(Trojan+TCP+TLS/xtls-rprx-vision)"
echoContent green "协议类型:Trojan地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:xtls传输方式:tcpflow:xtls-rprx-direct,账户名:${email}\n" echoContent green "协议类型:Trojan地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:xtls传输方式:tcpflow:xtls-rprx-vision,账户名:${email}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}" cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
trojan://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-direct#${email} trojan://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-vision#${email}
EOF EOF
echoContent yellow " ---> 二维码 Trojan(Trojan+TCP+TLS/xtls-rprx-direct)" echoContent yellow " ---> 二维码 Trojan(Trojan+TCP+TLS/xtls-rprx-vision)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%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-direct%23${email}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%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-vision%23${email}\n"
echoContent skyBlue "----------------------------------------------------------------------------------"
echoContent yellow " ---> 通用格式(Trojan+TCP+TLS/xtls-rprx-splice)"
echoContent green " trojan://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-splice#${email/direct/splice}\n"
echoContent yellow " ---> 格式化明文(Trojan+TCP+TLS/xtls-rprx-splice)"
echoContent green " 协议类型:VLESS地址:${currentHost},端口:${currentDefaultPort}用户ID:${id},安全:xtls传输方式:tcpflow:xtls-rprx-splice账户名:${email/direct/splice}\n"
cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
trojan://${id}@${currentHost}:${currentDefaultPort}?encryption=none&security=xtls&type=tcp&host=${currentHost}&headerType=none&sni=${currentHost}&flow=xtls-rprx-splice#${email/direct/splice}
EOF
echoContent yellow " ---> 二维码 Trojan(Trojan+TCP+TLS/xtls-rprx-splice)"
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=trojan%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"
elif [[ "${type}" == "vmessws" ]]; then elif [[ "${type}" == "vmessws" ]]; then
qrCodeBase64Default=$(echo -n "{\"port\":${currentDefaultPort},\"ps\":\"${email}\",\"tls\":\"tls\",\"id\":\"${id}\",\"aid\":0,\"v\":2,\"host\":\"${currentHost}\",\"type\":\"none\",\"path\":\"/${currentPath}vws\",\"net\":\"ws\",\"add\":\"${currentAdd}\",\"allowInsecure\":0,\"method\":\"none\",\"peer\":\"${currentHost}\",\"sni\":\"${currentHost}\"}" | base64 -w 0) qrCodeBase64Default=$(echo -n "{\"port\":${currentDefaultPort},\"ps\":\"${email}\",\"tls\":\"tls\",\"id\":\"${id}\",\"aid\":0,\"v\":2,\"host\":\"${currentHost}\",\"type\":\"none\",\"path\":\"/${currentPath}vws\",\"net\":\"ws\",\"add\":\"${currentAdd}\",\"allowInsecure\":0,\"method\":\"none\",\"peer\":\"${currentHost}\",\"sni\":\"${currentHost}\"}" | base64 -w 0)
@ -3192,23 +3160,6 @@ vmess://${qrCodeBase64Default}
EOF EOF
echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vmess://${qrCodeBase64Default}\n" echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vmess://${qrCodeBase64Default}\n"
# elif [[ "${type}" == "vmesstcp" ]]; then
#
# echoContent red "path:${path}"
# qrCodeBase64Default=$(echo -n "{\"add\":\"${add}\",\"aid\":0,\"host\":\"${host}\",\"id\":\"${id}\",\"net\":\"tcp\",\"path\":\"${path}\",\"port\":${port},\"ps\":\"${email}\",\"scy\":\"none\",\"sni\":\"${host}\",\"tls\":\"tls\",\"v\":2,\"type\":\"http\",\"allowInsecure\":0,\"peer\":\"${host}\",\"obfs\":\"http\",\"obfsParam\":\"${host}\"}" | base64)
# qrCodeBase64Default="${qrCodeBase64Default// /}"
#
# echoContent yellow " ---> 通用json(VMess+TCP+TLS)"
# echoContent green " {\"port\":'${port}',\"ps\":\"${email}\",\"tls\":\"tls\",\"id\":\"${id}\",\"aid\":0,\"v\":2,\"host\":\"${host}\",\"type\":\"http\",\"path\":\"${path}\",\"net\":\"http\",\"add\":\"${add}\",\"allowInsecure\":0,\"method\":\"post\",\"peer\":\"${host}\",\"obfs\":\"http\",\"obfsParam\":\"${host}\"}\n"
# echoContent yellow " ---> 通用vmess(VMess+TCP+TLS)链接"
# echoContent green " vmess://${qrCodeBase64Default}\n"
#
# cat <<EOF >>"/etc/v2ray-agent/subscribe_tmp/${subAccount}"
#vmess://${qrCodeBase64Default}
#EOF
# echoContent yellow " ---> 二维码 vmess(VMess+TCP+TLS)"
# echoContent green " https://api.qrserver.com/v1/create-qr-code/?size=400x400&data=vmess://${qrCodeBase64Default}\n"
elif [[ "${type}" == "vlessws" ]]; then elif [[ "${type}" == "vlessws" ]]; then
echoContent yellow " ---> 通用格式(VLESS+WS+TLS)" echoContent yellow " ---> 通用格式(VLESS+WS+TLS)"
@ -3284,7 +3235,7 @@ showAccounts() {
if [[ -n "${configPath}" ]]; then if [[ -n "${configPath}" ]]; then
show=1 show=1
if echo "${currentInstallProtocolType}" | grep -q trojan; then if echo "${currentInstallProtocolType}" | grep -q trojan; then
echoContent skyBlue "===================== Trojan TCP TLS/XTLS-direct/XTLS-splice ======================\n" echoContent skyBlue "===================== Trojan TCP TLS/XTLS-vision ======================\n"
jq .inbounds[0].settings.clients ${configPath}02_trojan_TCP_inbounds.json | jq -c '.[]' | while read -r user; do jq .inbounds[0].settings.clients ${configPath}02_trojan_TCP_inbounds.json | jq -c '.[]' | while read -r user; do
local email= local email=
email=$(echo "${user}" | jq -r .email) email=$(echo "${user}" | jq -r .email)
@ -3293,7 +3244,7 @@ showAccounts() {
done done
else else
echoContent skyBlue "===================== VLESS TCP TLS/XTLS-direct/XTLS-splice ======================\n" echoContent skyBlue "===================== VLESS TCP TLS/XTLS-vision ======================\n"
jq .inbounds[0].settings.clients ${configPath}02_VLESS_TCP_inbounds.json | jq -c '.[]' | while read -r user; do jq .inbounds[0].settings.clients ${configPath}02_VLESS_TCP_inbounds.json | jq -c '.[]' | while read -r user; do
local email= local email=
email=$(echo "${user}" | jq -r .email) email=$(echo "${user}" | jq -r .email)
@ -3595,7 +3546,7 @@ addCorePort() {
fi fi
if [[ -n ${hysteriaFileName} ]]; then if [[ -n ${hysteriaFileName} ]]; then
cat <<EOF >"${hysteriaFileName}" cat <<EOF >"${hysteriaFileName}"
{ {
"inbounds": [ "inbounds": [
{ {
@ -3866,7 +3817,7 @@ addUser() {
fi fi
# 兼容v2ray-core # 兼容v2ray-core
users="{\"id\":\"${uuid}\",\"flow\":\"xtls-rprx-direct\",\"email\":\"${email}\",\"alterId\":0}" users="{\"id\":\"${uuid}\",\"flow\":\"xtls-rprx-vision,none\",\"email\":\"${email}\",\"alterId\":0}"
if [[ "${coreInstallType}" == "2" ]]; then if [[ "${coreInstallType}" == "2" ]]; then
users="{\"id\":\"${uuid}\",\"email\":\"${email}\",\"alterId\":0}" users="{\"id\":\"${uuid}\",\"email\":\"${email}\",\"alterId\":0}"
@ -3891,14 +3842,14 @@ addUser() {
if echo ${currentInstallProtocolType} | grep -q 1; then if echo ${currentInstallProtocolType} | grep -q 1; then
local vlessUsers="${users//\,\"alterId\":0/}" local vlessUsers="${users//\,\"alterId\":0/}"
vlessUsers="${vlessUsers//\"flow\":\"xtls-rprx-direct\"\,/}" vlessUsers="${vlessUsers//\"flow\":\"xtls-rprx-vision,none\"\,/}"
local vlessWsResult local vlessWsResult
vlessWsResult=$(jq -r ".inbounds[0].settings.clients += [${vlessUsers}]" ${configPath}03_VLESS_WS_inbounds.json) vlessWsResult=$(jq -r ".inbounds[0].settings.clients += [${vlessUsers}]" ${configPath}03_VLESS_WS_inbounds.json)
echo "${vlessWsResult}" | jq . >${configPath}03_VLESS_WS_inbounds.json echo "${vlessWsResult}" | jq . >${configPath}03_VLESS_WS_inbounds.json
fi fi
if echo ${currentInstallProtocolType} | grep -q 2; then if echo ${currentInstallProtocolType} | grep -q 2; then
local trojangRPCUsers="${users//\"flow\":\"xtls-rprx-direct\"\,/}" local trojangRPCUsers="${users//\"flow\":\"xtls-rprx-vision,none\"\,/}"
trojangRPCUsers="${trojangRPCUsers//\,\"alterId\":0/}" trojangRPCUsers="${trojangRPCUsers//\,\"alterId\":0/}"
trojangRPCUsers=${trojangRPCUsers//"id"/"password"} trojangRPCUsers=${trojangRPCUsers//"id"/"password"}
@ -3908,7 +3859,7 @@ addUser() {
fi fi
if echo ${currentInstallProtocolType} | grep -q 3; then if echo ${currentInstallProtocolType} | grep -q 3; then
local vmessUsers="${users//\"flow\":\"xtls-rprx-direct\"\,/}" local vmessUsers="${users//\"flow\":\"xtls-rprx-vision,none\"\,/}"
local vmessWsResult local vmessWsResult
vmessWsResult=$(jq -r ".inbounds[0].settings.clients += [${vmessUsers}]" ${configPath}05_VMess_WS_inbounds.json) vmessWsResult=$(jq -r ".inbounds[0].settings.clients += [${vmessUsers}]" ${configPath}05_VMess_WS_inbounds.json)
@ -3916,7 +3867,7 @@ addUser() {
fi fi
if echo ${currentInstallProtocolType} | grep -q 5; then if echo ${currentInstallProtocolType} | grep -q 5; then
local vlessGRPCUsers="${users//\"flow\":\"xtls-rprx-direct\"\,/}" local vlessGRPCUsers="${users//\"flow\":\"xtls-rprx-vision,none\"\,/}"
vlessGRPCUsers="${vlessGRPCUsers//\,\"alterId\":0/}" vlessGRPCUsers="${vlessGRPCUsers//\,\"alterId\":0/}"
local vlessGRPCResult local vlessGRPCResult
@ -3925,7 +3876,7 @@ addUser() {
fi fi
if echo ${currentInstallProtocolType} | grep -q 4; then if echo ${currentInstallProtocolType} | grep -q 4; then
local trojanUsers="${users//\"flow\":\"xtls-rprx-direct\"\,/}" local trojanUsers="${users//\"flow\":\"xtls-rprx-vision,none\"\,/}"
trojanUsers="${trojanUsers//id/password}" trojanUsers="${trojanUsers//id/password}"
trojanUsers="${trojanUsers//\,\"alterId\":0/}" trojanUsers="${trojanUsers//\,\"alterId\":0/}"
@ -4932,7 +4883,7 @@ reloadCore() {
if [[ "${coreInstallType}" == "1" ]]; then if [[ "${coreInstallType}" == "1" ]]; then
handleXray stop handleXray stop
handleXray start handleXray start
elif [[ "${coreInstallType}" == "2" || "${coreInstallType}" == "3" ]]; then elif [[ "${coreInstallType}" == "2" ]]; then
handleV2Ray stop handleV2Ray stop
handleV2Ray start handleV2Ray start
fi fi
@ -5312,10 +5263,6 @@ coreVersionManageMenu() {
elif [[ "${coreInstallType}" == "2" ]]; then elif [[ "${coreInstallType}" == "2" ]]; then
v2rayCoreVersion= v2rayCoreVersion=
v2rayVersionManageMenu 1 v2rayVersionManageMenu 1
elif [[ "${coreInstallType}" == "3" ]]; then
v2rayCoreVersion=v4.32.1
v2rayVersionManageMenu 1
fi fi
} }
# 定时任务检查证书 # 定时任务检查证书
@ -5416,12 +5363,12 @@ switchAlpn() {
if [[ "${selectSwitchAlpnType}" == "1" && "${currentAlpn}" == "http/1.1" ]]; then if [[ "${selectSwitchAlpnType}" == "1" && "${currentAlpn}" == "http/1.1" ]]; then
local frontingTypeJSON local frontingTypeJSON
frontingTypeJSON=$(jq -r ".inbounds[0].streamSettings.xtlsSettings.alpn = [\"h2\",\"http/1.1\"]" ${configPath}${frontingType}.json) frontingTypeJSON=$(jq -r ".inbounds[0].streamSettings.tlsSettings.alpn = [\"h2\",\"http/1.1\"]" ${configPath}${frontingType}.json)
echo "${frontingTypeJSON}" | jq . >${configPath}${frontingType}.json echo "${frontingTypeJSON}" | jq . >${configPath}${frontingType}.json
elif [[ "${selectSwitchAlpnType}" == "1" && "${currentAlpn}" == "h2" ]]; then elif [[ "${selectSwitchAlpnType}" == "1" && "${currentAlpn}" == "h2" ]]; then
local frontingTypeJSON local frontingTypeJSON
frontingTypeJSON=$(jq -r ".inbounds[0].streamSettings.xtlsSettings.alpn =[\"http/1.1\",\"h2\"]" ${configPath}${frontingType}.json) frontingTypeJSON=$(jq -r ".inbounds[0].streamSettings.tlsSettings.alpn =[\"http/1.1\",\"h2\"]" ${configPath}${frontingType}.json)
echo "${frontingTypeJSON}" | jq . >${configPath}${frontingType}.json echo "${frontingTypeJSON}" | jq . >${configPath}${frontingType}.json
else else
echoContent red " ---> 选择错误" echoContent red " ---> 选择错误"
@ -5464,7 +5411,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者:mack-a" echoContent green "作者:mack-a"
echoContent green "当前版本:v2.6.14" echoContent green "当前版本:v2.6.15"
echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "Github:https://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus