From 10b6ce759dfb470ddb1d771775ca03f6da93866e Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Tue, 6 Jun 2023 13:56:04 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E8=84=9A=E6=9C=AC):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E5=8F=8C=E6=A0=88vps=E6=90=AD=E5=BB=BA=E5=8F=AA=E4=BD=BF?= =?UTF-8?q?=E7=94=A8IPv6=E6=97=A0=E6=B3=95=E6=90=AD=E5=BB=BA=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index 7d01660..86d6594 100644 --- a/install.sh +++ b/install.sh @@ -478,10 +478,14 @@ allowPort() { } # 获取公网IP getPublicIP() { + local type=4 + if [[ -n "$1" ]]; then + type=$1 + fi local currentIP= - currentIP=$(curl -s -4 http://www.cloudflare.com/cdn-cgi/trace | grep "ip" | awk -F "[=]" '{print $2}') + currentIP=$(curl -s "-${type}" http://www.cloudflare.com/cdn-cgi/trace | grep "ip" | awk -F "[=]" '{print $2}') if [[ -z "${currentIP}" ]]; then - currentIP=$(curl -s -6 http://www.cloudflare.com/cdn-cgi/trace | grep "ip" | awk -F "[=]" '{print $2}') + currentIP=$(curl -s "-${type}" http://www.cloudflare.com/cdn-cgi/trace | grep "ip" | awk -F "[=]" '{print $2}') fi echo "${currentIP}" } @@ -991,12 +995,14 @@ installWarp() { checkDNSIP() { local domain=$1 local dnsIP= + local type=4 dnsIP=$(dig @1.1.1.1 +time=1 +short "${domain}") if echo "${dnsIP}" | grep -q "timed out" || [[ -z "${dnsIP}" ]]; then echo echoContent red " ---> 无法通过DNS获取域名IPv4地址" echoContent green " ---> 尝试检查域名IPv6地址" dnsIP=$(dig @2606:4700:4700::1111 +time=1 aaaa +short "${domain}") + type=6 if [[ -z "${dnsIP}" ]]; then echoContent red " ---> 无法通过DNS获取域名IPv6地址,退出安装" exit 0 @@ -1004,7 +1010,7 @@ checkDNSIP() { fi local publicIP= - publicIP=$(getPublicIP) + publicIP=$(getPublicIP "${type}") if [[ "${publicIP}" != "${dnsIP}" ]]; then echoContent red " ---> 域名解析IP与当前服务器IP不一致\n" @@ -7389,7 +7395,7 @@ menu() { cd "$HOME" || exit echoContent red "\n==============================================================" echoContent green "作者:mack-a" - echoContent green "当前版本:v2.9.10" + echoContent green "当前版本:v2.9.11" echoContent green "Github:https://github.com/mack-a/v2ray-agent" echoContent green "描述:八合一共存脚本\c" showInstallStatus