fix(脚本): 修复sing-box无法使用warp分流问题、修复xray 只安装reality无法删除用户问题

master
mack-a 2025-02-06 17:29:06 +08:00
parent 8444b1092a
commit e19e9a101f
1 changed files with 45 additions and 35 deletions

View File

@ -507,6 +507,7 @@ readInstallProtocolType() {
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")
frontingTypeReality=07_VLESS_vision_reality_inbounds
elif [[ "${coreInstallType}" == "2" ]]; then elif [[ "${coreInstallType}" == "2" ]]; then
frontingTypeReality=07_VLESS_vision_reality_inbounds frontingTypeReality=07_VLESS_vision_reality_inbounds
@ -3879,25 +3880,30 @@ removeSingBoxConfig() {
} }
# 初始化wireguard出站信息 # 初始化wireguard出站信息
addSingBoxWireGuardOut() { addSingBoxWireGuardEndpoints() {
readConfigWarpReg local type=$1
cat <<EOF >"${singBoxConfigPath}wireguard_outbound.json"
{
"outbounds": [
readConfigWarpReg
cat <<EOF >"${singBoxConfigPath}wireguard_endpoints_${type}.json"
{
"endpoints": [
{ {
"type": "wireguard", "type": "wireguard",
"tag": "wireguard_out", "tag": "wireguard_endpoints_${type}",
"server": "162.159.192.1", "address": [
"server_port": 2408, "${address}"
"local_address": [
"172.16.0.2/32",
"${addressWarpReg}/128"
], ],
"private_key": "${secretKeyWarpReg}", "private_key": "${secretKeyWarpReg}",
"peer_public_key": "${publicKeyWarpReg}", "peers": [
"reserved":${reservedWarpReg}, {
"mtu": 1280 "address": "162.159.192.1",
"port": 2408,
"public_key": "${publicKeyWarpReg}",
"reserved":${reservedWarpReg},
"allowed_ips": ["0.0.0.0/0","::/0"]
}
]
} }
] ]
} }
@ -4948,8 +4954,8 @@ EOF
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 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_IPv4_route
removeSingBoxConfig wireguard_out_IPv6_route removeSingBoxConfig wireguard_out_IPv6_route
removeSingBoxConfig wireguard_outbound removeSingBoxConfig wireguard_outbound
@ -6377,8 +6383,8 @@ removeUser() {
echo "${vmessHTTPUpgradeResult}" | jq . >${configPath}11_VMess_HTTPUpgrade_inbounds.json echo "${vmessHTTPUpgradeResult}" | jq . >${configPath}11_VMess_HTTPUpgrade_inbounds.json
fi fi
reloadCore reloadCore
subscribe false
fi fi
subscribe false
manageAccount 1 manageAccount 1
} }
# 更新脚本 # 更新脚本
@ -6628,10 +6634,10 @@ ipv6Routing() {
if [[ -n "${singBoxConfigPath}" ]]; then if [[ -n "${singBoxConfigPath}" ]]; then
removeSingBoxConfig IPv4_out removeSingBoxConfig IPv4_out
removeSingBoxConfig wireguard_out_IPv4 # removeSingBoxConfig wireguard_out_IPv4
removeSingBoxConfig wireguard_out_IPv4_route removeSingBoxConfig wireguard_out_IPv4_route
removeSingBoxConfig wireguard_out_IPv6 # removeSingBoxConfig wireguard_out_IPv6
removeSingBoxConfig wireguard_out_IPv6_route removeSingBoxConfig wireguard_out_IPv6_route
removeSingBoxConfig wireguard_outbound removeSingBoxConfig wireguard_outbound
@ -7047,11 +7053,14 @@ addWireGuardRoute() {
if [[ -n "${singBoxConfigPath}" ]]; then if [[ -n "${singBoxConfigPath}" ]]; then
# rule # rule
addSingBoxRouteRule "wireguard_out_${type}" "${domainList}" "wireguard_out_${type}_route" addSingBoxRouteRule "wireguard_endpoints_${type}" "${domainList}" "wireguard_endpoints_${type}_route"
addSingBoxOutbound "wireguard_out_${type}" "wireguard_out" # addSingBoxOutbound "wireguard_out_${type}" "wireguard_out"
addSingBoxOutbound "01_direct_outbound" if [[ -n "${domainList}" ]]; then
addSingBoxOutbound "01_direct_outbound"
fi
# outbound # outbound
addSingBoxWireGuardOut addSingBoxWireGuardEndpoints "${type}"
fi fi
} }
@ -7167,21 +7176,23 @@ warpRoutingReg() {
removeSingBoxConfig 01_direct_outbound removeSingBoxConfig 01_direct_outbound
# 删除所有分流规则 # 删除所有分流规则
removeSingBoxConfig wireguard_out_IPv4_route removeSingBoxConfig wireguard_endpoints_IPv4_route
removeSingBoxConfig wireguard_out_IPv6_route removeSingBoxConfig wireguard_endpoints_IPv6_route
removeSingBoxConfig IPv6_route removeSingBoxConfig IPv6_route
removeSingBoxConfig socks5_inbound_route removeSingBoxConfig socks5_inbound_route
addSingBoxWireGuardEndpoints "${type}"
addWireGuardRoute "${type}" outboundTag ""
if [[ "${type}" == "IPv4" ]]; then if [[ "${type}" == "IPv4" ]]; then
removeSingBoxConfig wireguard_out_IPv6 removeSingBoxConfig wireguard_endpoints_IPv6
else else
removeSingBoxConfig wireguard_out_IPv4 removeSingBoxConfig wireguard_endpoints_IPv4
fi fi
# outbound # outbound
addSingBoxOutbound "wireguard_out_${type}" "wireguard_out" # addSingBoxOutbound "wireguard_out_${type}" "wireguard_out"
addSingBoxWireGuardOut
fi fi
echoContent green " ---> WARP全局出站设置完毕" echoContent green " ---> WARP全局出站设置完毕"
@ -7199,11 +7210,10 @@ warpRoutingReg() {
fi fi
if [[ -n "${singBoxConfigPath}" ]]; then if [[ -n "${singBoxConfigPath}" ]]; then
removeSingBoxConfig "wireguard_out_${type}_route" removeSingBoxConfig "wireguard_endpoints_${type}_route"
removeSingBoxConfig "wireguard_out_${type}" removeSingBoxConfig "wireguard_endpoints_${type}"
addSingBoxOutbound "01_direct_outbound" addSingBoxOutbound "01_direct_outbound"
fi fi
echoContent green " ---> 卸载WARP ${type}分流完毕" echoContent green " ---> 卸载WARP ${type}分流完毕"
@ -7420,11 +7430,11 @@ setSocks5OutboundRoutingAll() {
if [[ -n "${singBoxConfigPath}" ]]; then if [[ -n "${singBoxConfigPath}" ]]; then
removeSingBoxConfig IPv4_out removeSingBoxConfig IPv4_out
removeSingBoxConfig wireguard_out_IPv4 # removeSingBoxConfig wireguard_out_IPv4
removeSingBoxConfig wireguard_out_IPv4_route removeSingBoxConfig wireguard_out_IPv4_route
removeSingBoxConfig IPv6_out removeSingBoxConfig IPv6_out
removeSingBoxConfig wireguard_out_IPv6 # removeSingBoxConfig wireguard_out_IPv6
removeSingBoxConfig wireguard_out_IPv6_route removeSingBoxConfig wireguard_out_IPv6_route
removeSingBoxConfig wireguard_outbound removeSingBoxConfig wireguard_outbound
@ -9738,7 +9748,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.31" echoContent green "当前版本v3.4.1"
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