feat(脚本): 添加reality vision回落至gRPC

dev
mack-a 2023-03-15 16:51:18 +08:00
parent 7c5b90f8c8
commit c534cde27e
1 changed files with 62 additions and 28 deletions

View File

@ -284,12 +284,12 @@ readInstallType() {
if [[ -d "/etc/v2ray-agent/xray" && -f "/etc/v2ray-agent/xray/xray" ]]; then if [[ -d "/etc/v2ray-agent/xray" && -f "/etc/v2ray-agent/xray/xray" ]]; then
# 这里检测xray-core # 这里检测xray-core
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" || -f "/etc/v2ray-agent/xray/conf/07_VLESS_reality_inbounds.json" ]]; then 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" || -f "/etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json" ]]; then
# xray-core # xray-core
configPath=/etc/v2ray-agent/xray/conf/ configPath=/etc/v2ray-agent/xray/conf/
ctlPath=/etc/v2ray-agent/xray/xray ctlPath=/etc/v2ray-agent/xray/xray
coreInstallType=1 coreInstallType=1
if [[ -f "${configPath}07_VLESS_reality_inbounds.json" ]]; then if [[ -f "${configPath}07_VLESS_vision_reality_inbounds.json" ]]; then
realityStatus=1 realityStatus=1
fi fi
fi fi
@ -462,9 +462,9 @@ readHysteriaConfig() {
# 读取xray reality配置 # 读取xray reality配置
readXrayCoreRealityConfig() { readXrayCoreRealityConfig() {
if [[ -n "${realityStatus}" ]]; then if [[ -n "${realityStatus}" ]]; then
currentRealityServerNames=$(jq -r .inbounds[0].streamSettings.realitySettings.serverNames "${configPath}07_VLESS_reality_inbounds.json") currentRealityServerNames=$(jq -r .inbounds[0].streamSettings.realitySettings.serverNames "${configPath}07_VLESS_vision_reality_inbounds.json")
currentRealityPublicKey=$(jq -r .inbounds[0].streamSettings.realitySettings.publicKey "${configPath}07_VLESS_reality_inbounds.json") currentRealityPublicKey=$(jq -r .inbounds[0].streamSettings.realitySettings.publicKey "${configPath}07_VLESS_vision_reality_inbounds.json")
currentRealityPort=$(jq -r .inbounds[0].port "${configPath}07_VLESS_reality_inbounds.json") currentRealityPort=$(jq -r .inbounds[0].port "${configPath}07_VLESS_vision_reality_inbounds.json")
fi fi
} }
@ -520,7 +520,7 @@ readConfigHostPathUUID() {
if [[ -z "${realityStatus}" ]]; then if [[ -z "${realityStatus}" ]]; then
currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType}.json) currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}${frontingType}.json)
else else
currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}07_VLESS_reality_inbounds.json) currentUUID=$(jq -r .inbounds[0].settings.clients[0].id ${configPath}07_VLESS_vision_reality_inbounds.json)
fi fi
fi fi
@ -3128,7 +3128,7 @@ EOF
defaultPort=${customPort} defaultPort=${customPort}
fi fi
cat <<EOF >/etc/v2ray-agent/xray/conf/07_VLESS_reality_inbounds.json cat <<EOF >/etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json
{ {
"inbounds": [ "inbounds": [
{ {
@ -3140,23 +3140,25 @@ EOF
{ {
"id": "${uuid}", "id": "${uuid}",
"add": "${add}", "add": "${add}",
"flow": "", "flow": "xtls-rprx-vision",
"email": "default_VLESS_reality_Vision" "email": "default_VLESS_reality_Vision"
} }
], ],
"decryption": "none" "decryption": "none",
"fallbacks":[
{
"dest": "31305",
"xver": 1
}
]
}, },
"streamSettings": { "streamSettings": {
"network": "grpc", "network": "tcp",
"security": "reality", "security": "reality",
"grpcSettings": {
"serviceName": "grpc"
},
"realitySettings": { "realitySettings": {
"show": true, "show": true,
"dest": "${realityDestDomain}", "dest": "${realityDestDomain}",
"xver": 0, "xver": 0,
"minClientVer": "",
"serverNames": [ "serverNames": [
${realityServerNames} ${realityServerNames}
], ],
@ -3172,6 +3174,38 @@ EOF
] ]
} }
EOF EOF
cat <<EOF >/etc/v2ray-agent/xray/conf/08_VLESS_reality_fallback_grpc_inbounds.json
{
"inbounds": [
{
"port": 31305,
"listen": "127.0.0.1",
"protocol": "vless",
"tag": "VLESSRealityGRPC",
"settings": {
"clients": [
{
"id": "${uuid}",
"add": "${add}",
"flow": "",
"email": "default_VLESS_grpc_reality"
}
],
"decryption": "none"
},
"streamSettings": {
"network": "grpc",
"grpcSettings": {
"serviceName": "grpc",
"multiMode": true
}
}
}
]
}
EOF
addClients "/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" "${addClientsStatus}" addClients "/etc/v2ray-agent/xray/conf/02_VLESS_TCP_inbounds.json" "${addClientsStatus}"
else else
getClients "${configPath}../tmp/02_VLESS_TCP_inbounds.json" "${addClientsStatus}" getClients "${configPath}../tmp/02_VLESS_TCP_inbounds.json" "${addClientsStatus}"
@ -3543,7 +3577,7 @@ showAccounts() {
if echo ${currentInstallProtocolType} | grep -q 7; then if echo ${currentInstallProtocolType} | grep -q 7; then
show=1 show=1
echoContent skyBlue "================================ VLESS reality =================================\n" echoContent skyBlue "================================ VLESS reality =================================\n"
jq .inbounds[0].settings.clients ${configPath}07_VLESS_reality_inbounds.json | jq -c '.[]' | while read -r user; do jq .inbounds[0].settings.clients ${configPath}07_VLESS_vision_reality_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)
@ -5513,7 +5547,7 @@ unInstallXrayCoreReality() {
echoContent yellow "# 仅删除VLESS Reality相关配置不会删除其他内容。" echoContent yellow "# 仅删除VLESS Reality相关配置不会删除其他内容。"
echoContent yellow "# 如果需要卸载其他内容,请卸载脚本功能" echoContent yellow "# 如果需要卸载其他内容,请卸载脚本功能"
handleXray stop handleXray stop
rm -rf /etc/v2ray-agent/xray/conf/07_VLESS_reality_inbounds.json rm -rf /etc/v2ray-agent/xray/conf/07_VLESS_vision_reality_inbounds.json
echoContent yellow " >卸载完成" echoContent yellow " >卸载完成"
} }
@ -5777,7 +5811,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.7.14_reality_beta" echoContent green "当前版本v2.7.15_reality_beta"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent" echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:八合一共存脚本\c" echoContent green "描述:八合一共存脚本\c"
showInstallStatus showInstallStatus