From a85f61526401e812a1196360298c980d0f2b5e43 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Sun, 24 Dec 2023 22:10:07 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E5=A4=8Dsi?= =?UTF-8?q?ng-box=20IPv6=E5=85=A8=E5=B1=80=E3=80=81warp=E5=85=A8=E5=B1=80?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E6=A0=B8=E5=BF=83=E5=90=AF=E5=8A=A8=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 145 ++++++++++++++++++++++++++++------------------------- 1 file changed, 77 insertions(+), 68 deletions(-) diff --git a/install.sh b/install.sh index 5da70e0..e42f6b6 100644 --- a/install.sh +++ b/install.sh @@ -5537,31 +5537,35 @@ ipv6Routing() { read -r -p "是否确认设置?[y/n]:" IPv6OutStatus if [[ "${IPv6OutStatus}" == "y" ]]; then - cat <${configPath}10_ipv4_outbounds.json - { - "outbounds":[ - { - "protocol":"freedom", - "settings":{ - "domainStrategy":"UseIPv6" - }, - "tag":"IPv6_out" - } - ] - } + if [[ "${coreInstallType}" == "1" ]]; then + cat <${configPath}10_ipv4_outbounds.json +{ + "outbounds":[ + { + "protocol":"freedom", + "settings":{ + "domainStrategy":"UseIPv6" + }, + "tag":"IPv6_out" + } + ] +} EOF - rm ${configPath}09_routing.json >/dev/null 2>&1 + rm ${configPath}09_routing.json >/dev/null 2>&1 + fi + if [[ "${coreInstallType}" == "2" ]]; then + configurationSingBoxRoute delete wireguard_out_IPv4 + configurationSingBoxRoute delete wireguard_out_IPv6 + removeSingBoxOutbound IPv4_out + removeSingBoxOutbound wireguard_out_IPv4 + removeSingBoxOutbound wireguard_outbound + + addSingBoxOutbound IPv6_out + fi + echoContent green " ---> IPv6全局出站设置成功" - - configurationSingBoxRoute delete wireguard_out_IPv4 - configurationSingBoxRoute delete wireguard_out_IPv6 - removeSingBoxOutbound IPv4_out - removeSingBoxOutbound wireguard_out_IPv4 - removeSingBoxOutbound wireguard_outbound - - addSingBoxOutbound IPv6_out - else + echoContent green " ---> 放弃设置" exit 0 fi @@ -6169,57 +6173,62 @@ warpRoutingReg() { if [[ "${warpOutStatus}" == "y" ]]; then readConfigWarpReg - - cat <${configPath}10_ipv4_outbounds.json + if [[ "${coreInstallType}" == "1" ]]; then + cat <${configPath}10_ipv4_outbounds.json { - "outbounds":[ - { - "protocol": "wireguard", - "settings": { - "secretKey": "${secretKeyWarpReg}", - "address": [ - "${address}" - ], - "peers": [ - { - "publicKey": "${publicKeyWarpReg}", - "allowedIPs": [ - "0.0.0.0/0", - "::/0" - ], - "endpoint": "162.159.192.1:2408" - } - ], - "reserved": ${reservedWarpReg}, - "mtu": 1280 - }, - "tag": "wireguard_out_${type}" - } - ] + "outbounds":[ + { + "protocol": "wireguard", + "settings": { + "secretKey": "${secretKeyWarpReg}", + "address": [ + "${address}" + ], + "peers": [ + { + "publicKey": "${publicKeyWarpReg}", + "allowedIPs": [ + "0.0.0.0/0", + "::/0" + ], + "endpoint": "162.159.192.1:2408" + } + ], + "reserved": ${reservedWarpReg}, + "mtu": 1280 + }, + "tag": "wireguard_out_${type}" + } + ] } EOF - rm ${configPath}09_routing.json >/dev/null 2>&1 + rm ${configPath}09_routing.json >/dev/null 2>&1 - configurationSingBoxRoute delete IPv4 - configurationSingBoxRoute delete IPv6 - - removeSingBoxOutbound direct - - removeSingBoxOutbound IPv4_out - removeSingBoxOutbound IPv6_out - - configurationSingBoxRoute delete wireguard_out_IPv4 - configurationSingBoxRoute delete wireguard_out_IPv6 - - if [[ "${type}" == "IPv4" ]]; then - removeSingBoxOutbound wireguard_out_IPv6 - else - removeSingBoxOutbound wireguard_out_IPv4 fi - # outbound - addSingBoxOutbound "wireguard_out_${type}" "wireguard_out" - addSingBoxWireGuardOut + if [[ "${coreInstallType}" == "2" ]]; then + configurationSingBoxRoute delete IPv4 + configurationSingBoxRoute delete IPv6 + + removeSingBoxOutbound direct + + removeSingBoxOutbound IPv4_out + removeSingBoxOutbound IPv6_out + + configurationSingBoxRoute delete wireguard_out_IPv4 + configurationSingBoxRoute delete wireguard_out_IPv6 + + if [[ "${type}" == "IPv4" ]]; then + removeSingBoxOutbound wireguard_out_IPv6 + else + removeSingBoxOutbound wireguard_out_IPv4 + fi + + # outbound + addSingBoxOutbound "wireguard_out_${type}" "wireguard_out" + addSingBoxWireGuardOut + fi + echoContent green " ---> WARP全局出站设置成功" else echoContent green " ---> 放弃设置" @@ -8283,7 +8292,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v3.1.14" + echoContent green "当前版本:v3.1.15" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus