feat(脚本): 修复reality安装后正常使用但是重新更换订阅无法使用的问题、修复httpupgrade无法添加CDN的问题、增加tuic读取上次配置、增加读取reailty dest端口

master
mack-a 2024-11-12 15:00:18 +08:00
parent acbf6a3d2e
commit f12554c0c5
1 changed files with 78 additions and 55 deletions

View File

@ -489,8 +489,6 @@ readInstallProtocolType() {
xrayVLESSRealityServerName=$(jq -r .inbounds[0].streamSettings.realitySettings.serverNames[0] "${row}.json") xrayVLESSRealityServerName=$(jq -r .inbounds[0].streamSettings.realitySettings.serverNames[0] "${row}.json")
realityServerName=${xrayVLESSRealityServerName} realityServerName=${xrayVLESSRealityServerName}
xrayVLESSRealityPort=$(jq -r .inbounds[0].port "${row}.json") xrayVLESSRealityPort=$(jq -r .inbounds[0].port "${row}.json")
# xrayVLESSRealityPrivateKey=$(jq -r .inbounds[0].streamSettings.realitySettings.privateKey "${row}.json")
# xrayVLESSRealityPublicKey=$(jq -r .inbounds[0].streamSettings.realitySettings.publicKey "${row}.json")
currentRealityPublicKey=$(jq -r .inbounds[0].streamSettings.realitySettings.publicKey "${row}.json") currentRealityPublicKey=$(jq -r .inbounds[0].streamSettings.realitySettings.publicKey "${row}.json")
currentRealityPrivateKey=$(jq -r .inbounds[0].streamSettings.realitySettings.privateKey "${row}.json") currentRealityPrivateKey=$(jq -r .inbounds[0].streamSettings.realitySettings.privateKey "${row}.json")
@ -498,6 +496,8 @@ readInstallProtocolType() {
frontingTypeReality=07_VLESS_vision_reality_inbounds frontingTypeReality=07_VLESS_vision_reality_inbounds
singBoxVLESSRealityVisionPort=$(jq -r .inbounds[0].listen_port "${row}.json") singBoxVLESSRealityVisionPort=$(jq -r .inbounds[0].listen_port "${row}.json")
singBoxVLESSRealityVisionServerName=$(jq -r .inbounds[0].tls.server_name "${row}.json") singBoxVLESSRealityVisionServerName=$(jq -r .inbounds[0].tls.server_name "${row}.json")
realityDomainPort=$(jq -r .inbounds[0].tls.reality.handshake.server_port "${row}.json")
realityServerName=${singBoxVLESSRealityVisionServerName} realityServerName=${singBoxVLESSRealityVisionServerName}
if [[ -f "${configPath}reality_key" ]]; then if [[ -f "${configPath}reality_key" ]]; then
singBoxVLESSRealityPublicKey=$(grep "publicKey" <"${configPath}reality_key" | awk -F "[:]" '{print $2}') singBoxVLESSRealityPublicKey=$(grep "publicKey" <"${configPath}reality_key" | awk -F "[:]" '{print $2}')
@ -2897,8 +2897,9 @@ handleSingBox() {
echoContent green " ---> sing-box启动成功" echoContent green " ---> sing-box启动成功"
else else
echoContent red "sing-box启动失败" echoContent red "sing-box启动失败"
echoContent red "请手动执行【/etc/v2ray-agent/sing-box/sing-box merge config.json -C /etc/v2ray-agent/sing-box/conf/config/ -D /etc/v2ray-agent/sing-box/conf/】,查看错误日志" echoContent yellow "请手动执行【 /etc/v2ray-agent/sing-box/sing-box merge config.json -C /etc/v2ray-agent/sing-box/conf/config/ -D /etc/v2ray-agent/sing-box/conf/ 】,查看错误日志"
echoContent red "如上面命令没有错误,请手动执行【/etc/v2ray-agent/sing-box/sing-box run -c /etc/v2ray-agent/sing-box/conf/config.json】查看错误日志" echo
echoContent yellow "如上面命令没有错误,请手动执行【 /etc/v2ray-agent/sing-box/sing-box run -c /etc/v2ray-agent/sing-box/conf/config.json 】,查看错误日志"
exit 0 exit 0
fi fi
elif [[ "$1" == "stop" ]]; then elif [[ "$1" == "stop" ]]; then
@ -3412,6 +3413,19 @@ initTuicPort() {
# 初始化tuic的协议 # 初始化tuic的协议
initTuicProtocol() { initTuicProtocol() {
if [[ -n "${tuicAlgorithm}" && -z "${lastInstallationConfig}" ]]; then
read -r -p "读取到上次使用的端口,是否使用 [y/n]:" historyTuicAlgorithm
if [[ "${historyTuicAlgorithm}" != "y" ]]; then
tuicAlgorithm=
else
echoContent yellow "\n ---> 算法: ${tuicAlgorithm}\n"
fi
elif [[ -n "${tuicAlgorithm}" && -n "${lastInstallationConfig}" ]]; then
echoContent yellow "\n ---> 算法: ${tuicAlgorithm}\n"
fi
if [[ -z "${tuicAlgorithm}" ]]; then
echoContent skyBlue "\n请选择算法类型" echoContent skyBlue "\n请选择算法类型"
echoContent red "==============================================================" echoContent red "=============================================================="
echoContent yellow "1.bbr(默认)" echoContent yellow "1.bbr(默认)"
@ -3434,6 +3448,7 @@ initTuicProtocol() {
;; ;;
esac esac
echoContent yellow "\n ---> 算法: ${tuicAlgorithm}\n" echoContent yellow "\n ---> 算法: ${tuicAlgorithm}\n"
fi
} }
# 初始化tuic配置 # 初始化tuic配置
@ -4465,6 +4480,10 @@ EOF
rm /etc/v2ray-agent/xray/conf/08_VLESS_vision_gRPC_inbounds.json >/dev/null 2>&1 rm /etc/v2ray-agent/xray/conf/08_VLESS_vision_gRPC_inbounds.json >/dev/null 2>&1
fi fi
installSniffing installSniffing
if [[ -z "$3" ]]; then
removeXrayOutbound wireguard_out_IPv4_route
removeXrayOutbound wireguard_out_IPv6_route
removeXrayOutbound wireguard_outbound
removeXrayOutbound IPv4_out removeXrayOutbound IPv4_out
removeXrayOutbound IPv6_out removeXrayOutbound IPv6_out
removeXrayOutbound socks5_outbound removeXrayOutbound socks5_outbound
@ -4472,6 +4491,7 @@ EOF
removeXrayOutbound wireguard_out_IPv6 removeXrayOutbound wireguard_out_IPv6
removeXrayOutbound wireguard_out_IPv4 removeXrayOutbound wireguard_out_IPv4
addXrayOutbound z_direct_outbound addXrayOutbound z_direct_outbound
fi
} }
# 初始化TCP Brutal # 初始化TCP Brutal
@ -4905,8 +4925,13 @@ EOF
elif [[ -z "$3" ]]; then elif [[ -z "$3" ]]; then
rm /etc/v2ray-agent/sing-box/conf/config/11_VMess_HTTPUpgrade_inbounds.json >/dev/null 2>&1 rm /etc/v2ray-agent/sing-box/conf/config/11_VMess_HTTPUpgrade_inbounds.json >/dev/null 2>&1
fi fi
if [[ -z "$3" ]]; then
removeSingBoxConfig wireguard_out_IPv4 removeSingBoxConfig wireguard_out_IPv4
removeSingBoxConfig wireguard_out_IPv6 removeSingBoxConfig wireguard_out_IPv6
removeSingBoxConfig wireguard_out_IPv4_route
removeSingBoxConfig wireguard_out_IPv6_route
removeSingBoxConfig wireguard_outbound
removeSingBoxConfig IPv4_out removeSingBoxConfig IPv4_out
removeSingBoxConfig IPv6_out removeSingBoxConfig IPv6_out
removeSingBoxConfig IPv6_route removeSingBoxConfig IPv6_route
@ -4916,6 +4941,7 @@ EOF
removeSingBoxConfig 01_direct_outbound removeSingBoxConfig 01_direct_outbound
removeSingBoxConfig block_domain_outbound removeSingBoxConfig block_domain_outbound
removeSingBoxConfig dns removeSingBoxConfig dns
fi
} }
# 初始化 sing-box订阅配置 # 初始化 sing-box订阅配置
initSubscribeLocalConfig() { initSubscribeLocalConfig() {
@ -5945,7 +5971,7 @@ manageCDN() {
echoContent skyBlue "\n进度 $1/1 : CDN节点管理" echoContent skyBlue "\n进度 $1/1 : CDN节点管理"
local setCDNDomain= local setCDNDomain=
if echo "${currentInstallProtocolType}" | grep -qE ",1,|,2,|,3,|,5,"; then if echo "${currentInstallProtocolType}" | grep -qE ",1,|,2,|,3,|,5,|,11,"; then
echoContent red "==============================================================" echoContent red "=============================================================="
echoContent yellow "# 注意事项" echoContent yellow "# 注意事项"
echoContent yellow "\n教程地址:" echoContent yellow "\n教程地址:"
@ -5995,7 +6021,7 @@ manageCDN() {
else else
echoContent yellow "\n教程地址:" echoContent yellow "\n教程地址:"
echoContent skyBlue "https://www.v2ray-agent.com/archives/cloudflarezi-xuan-ip\n" echoContent skyBlue "https://www.v2ray-agent.com/archives/cloudflarezi-xuan-ip\n"
echoContent red " ---> 未检测到可以使用的协议仅支持ws或者grpc相关的协议" echoContent red " ---> 未检测到可以使用的协议仅支持ws、grpc、HTTPUpgrade相关的协议"
fi fi
} }
# 自定义uuid # 自定义uuid
@ -8069,6 +8095,7 @@ customSingBoxInstall() {
fi fi
if [[ "${selectCustomInstallType//,/}" =~ ^[0-9]+$ ]]; then if [[ "${selectCustomInstallType//,/}" =~ ^[0-9]+$ ]]; then
unInstallSubscribe
readLastInstallationConfig readLastInstallationConfig
totalProgress=9 totalProgress=9
installTools 1 installTools 1
@ -8090,7 +8117,6 @@ customSingBoxInstall() {
handleNginx start handleNginx start
# 生成账号 # 生成账号
checkGFWStatue 8 checkGFWStatue 8
unInstallSubscribe
showAccounts 9 showAccounts 9
else else
echoContent red " ---> 输入不合法" echoContent red " ---> 输入不合法"
@ -8191,7 +8217,6 @@ customXrayInstall() {
handleXray start handleXray start
# 生成账号 # 生成账号
checkGFWStatue 11 checkGFWStatue 11
unInstallSubscribe
showAccounts 12 showAccounts 12
else else
echoContent red " ---> 输入不合法" echoContent red " ---> 输入不合法"
@ -8271,7 +8296,6 @@ xrayCoreInstall() {
handleNginx start handleNginx start
# 生成账号 # 生成账号
checkGFWStatue 11 checkGFWStatue 11
unInstallSubscribe
showAccounts 12 showAccounts 12
} }
@ -9295,12 +9319,11 @@ initRealityClientServersName() {
read -r -p "读取到上次安装设置的Reality域名是否使用[y/n]:" realityServerNameStatus read -r -p "读取到上次安装设置的Reality域名是否使用[y/n]:" realityServerNameStatus
if [[ "${realityServerNameStatus}" != "y" ]]; then if [[ "${realityServerNameStatus}" != "y" ]]; then
realityServerName= realityServerName=
realityDomainPort=
fi fi
elif [[ -z "${lastInstallationConfig}" ]]; then elif [[ -n "${realityServerName}" && -z "${lastInstallationConfig}" ]]; then
realityServerName= realityServerName=
fi realityDomainPort=
if [[ -n "${realityServerName}" ]] && [[ "${realityServerName}" != "${domain}" ]]; then
realityDomainPort=443
fi fi
if [[ -z "${realityServerName}" ]]; then if [[ -z "${realityServerName}" ]]; then
@ -9456,7 +9479,7 @@ xrayCoreRealityInstall() {
sleep 2 sleep 2
# 启动 # 启动
handleXray start handleXray start
unInstallSubscribe # unInstallSubscribe
# 生成账号 # 生成账号
showAccounts 8 showAccounts 8
} }
@ -9687,7 +9710,7 @@ menu() {
cd "$HOME" || exit cd "$HOME" || exit
echoContent red "\n==============================================================" echoContent red "\n=============================================================="
echoContent green "作者mack-a" echoContent green "作者mack-a"
echoContent green "当前版本v3.3.19" echoContent green "当前版本v3.3.20"
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