From fff1e83b03c3e0a8c39e737530a28fd3665b64d9 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Tue, 26 Dec 2023 16:37:09 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E6=94=B9w?= =?UTF-8?q?arp=E3=80=81IPv6=E5=88=86=E6=B5=81=E5=BC=95=E8=B5=B7=E7=9A=84?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E9=94=99=E8=AF=AF=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 47 ++++++++++++++++++++++++----------------------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/install.sh b/install.sh index fe4f0a5..69e4f9c 100644 --- a/install.sh +++ b/install.sh @@ -366,7 +366,7 @@ readInstallType() { if [[ -f "${configPath}07_VLESS_vision_reality_inbounds.json" ]]; then realityStatus=1 fi - if [[ -f "/etc/v2ray-agent/sing-box/conf/config/06_hysteria2_inbounds.json" || -f "/etc/v2ray-agent/sing-box/conf/config/09_tuic_inbounds.json" ]]; then + if [[ -f "/etc/v2ray-agent/sing-box/sing-box" ]] && [[ -f "/etc/v2ray-agent/sing-box/conf/config/06_hysteria2_inbounds.json" || -f "/etc/v2ray-agent/sing-box/conf/config/09_tuic_inbounds.json" ]]; then singBoxConfigPath=/etc/v2ray-agent/sing-box/conf/config/ fi fi @@ -1820,7 +1820,7 @@ installCronTLS() { } # 定时任务更新geo文件 installCronUpdateGeo() { - if [[ -n "${configPath}" ]]; then + if [[ "${coreInstallType}" == "1" ]]; then if crontab -l | grep -q "UpdateGeo"; then echoContent red "\n ---> 已添加自动更新定时任务,请不要重复添加" exit 0 @@ -5498,7 +5498,7 @@ ipv6Routing() { if [[ -n "${singBoxConfigPath}" ]]; then echoContent yellow "sing-box:" - jq -r -c '.route.rules[]|select (.outbound=="IPv6_out")|.geosite' "${singBoxConfigPath}IPv6_out_route.json" | jq -r + jq -r -c '.route.rules[]|select (.outbound=="IPv6_out")' "${singBoxConfigPath}IPv6_out_route.json" | jq -r fi exit 0 @@ -5519,7 +5519,7 @@ ipv6Routing() { echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json fi - if [[ "${coreInstallType}" == "2" ]]; then + if [[ -n "${singBoxConfigPath}" ]]; then configurationSingBoxRoute add IPv6_out "${domainList}" addSingBoxOutbound IPv6_out addSingBoxOutbound IPv4_out @@ -5552,11 +5552,13 @@ ipv6Routing() { EOF rm ${configPath}09_routing.json >/dev/null 2>&1 fi - if [[ "${coreInstallType}" == "2" ]]; then + if [[ -n "${singBoxConfigPath}" ]]; then configurationSingBoxRoute delete wireguard_out_IPv4 configurationSingBoxRoute delete wireguard_out_IPv6 + removeSingBoxOutbound IPv4_out removeSingBoxOutbound wireguard_out_IPv4 + removeSingBoxOutbound wireguard_out_IPv6 removeSingBoxOutbound wireguard_outbound addSingBoxOutbound IPv6_out @@ -5570,18 +5572,21 @@ EOF fi elif [[ "${ipv6Status}" == "4" ]]; then + if [[ "${coreInstallType}" == "1" ]]; then + unInstallRouting IPv6_out outboundTag - unInstallRouting IPv6_out outboundTag + unInstallOutbounds IPv6_out + if ! grep -q "IPv4_out" <"${configPath}10_ipv4_outbounds.json"; then + outbounds=$(jq -r '.outbounds += [{"protocol":"freedom","settings": {"domainStrategy": "UseIPv4"},"tag":"IPv4_out"}]' ${configPath}10_ipv4_outbounds.json) - unInstallOutbounds IPv6_out - - configurationSingBoxRoute delete IPv6_out - - if ! grep -q "IPv4_out" <"${configPath}10_ipv4_outbounds.json"; then - outbounds=$(jq -r '.outbounds += [{"protocol":"freedom","settings": {"domainStrategy": "UseIPv4"},"tag":"IPv4_out"}]' ${configPath}10_ipv4_outbounds.json) - - echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json + echo "${outbounds}" | jq . >${configPath}10_ipv4_outbounds.json + fi fi + + if [[ -n "${singBoxConfigPath}" ]]; then + configurationSingBoxRoute delete IPv6_out + fi + echoContent green " ---> IPv6分流卸载成功" else echoContent red " ---> 选择错误" @@ -6058,7 +6063,7 @@ addWireGuardRoute() { # 卸载wireGuard unInstallWireGuard() { local type=$1 - if [[ -n "${configPath}" ]]; then + if [[ "${coreInstallType}" == "1" ]]; then if [[ "${type}" == "IPv4" ]]; then if ! grep -q "wireguard_out_IPv6" <${configPath}10_ipv4_outbounds.json; then @@ -6081,9 +6086,7 @@ unInstallWireGuard() { # 移除WireGuard分流 removeWireGuardRoute() { local type=$1 - # local tag=$2 - # xray - if [[ -n "${configPath}" ]]; then + if [[ "${coreInstallType}" == "1" ]]; then unInstallRouting wireguard_out_"${type}" outboundTag @@ -6116,8 +6119,6 @@ removeWireGuardRoute() { } EOF fi - - echoContent green " ---> WARP分流卸载成功" fi # sing-box @@ -6235,9 +6236,9 @@ EOF fi elif [[ "${warpStatus}" == "4" ]]; then - removeWireGuardRoute "${type}" removeSingBoxOutbound "wireguard_out_${type}" + echoContent green " ---> 卸载WARP ${type}分流成功" else echoContent red " ---> 选择错误" exit 0 @@ -6817,7 +6818,7 @@ customSingBoxInstall() { if [[ "${selectCustomInstallType}" =~ ^[0-9]+$ ]]; then # checkBTPanel - totalProgress=17 + totalProgress=9 installTools 1 # 申请tls if echo "${selectCustomInstallType}" | grep -q -E "0|6|9"; then @@ -8289,7 +8290,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v3.1.17" + echoContent green "当前版本:v3.1.18" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus