From 8bc2c6963465cf2abec046e82ec415bd9cf88930 Mon Sep 17 00:00:00 2001 From: mack-a <57424792+mack-a@users.noreply.github.com> Date: Wed, 4 Aug 2021 17:11:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E8=84=9A=E6=9C=AC):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=9F=A5=E6=89=BEip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/install.sh b/install.sh index 061e518..52d25e0 100644 --- a/install.sh +++ b/install.sh @@ -815,15 +815,21 @@ EOF # 检查ip checkIP() { echoContent skyBlue " ---> 检查ipv4中" - pingIP=$(curl -s -H 'accept:application/dns-json' 'https://cloudflare-dns.com/dns-query?name='${domain}'&type=A' | jq -r ".Answer|.[]|select(.type==1)|.data") - - if [[ -z "${pingIP}" ]]; then - echoContent skyBlue " ---> 检查ipv6中" - pingIP=$(curl -s -H 'accept:application/dns-json' 'https://cloudflare-dns.com/dns-query?name='${domain}'&type=AAAA' | jq -r ".Answer|.[]|select(.type==28)|.data") - pingIPv6=${pingIP} + local pingIP=$(curl -s -H 'accept:application/dns-json' 'https://cloudflare-dns.com/dns-query?name='${domain}'&type=A' | jq -r ".Answer") + if [[ "${pingIP}" != "null" ]];then + pingIP=$(echo "${pingIP}"|jq -r ".[]|select(.type==1)|.data") fi - if [[ -n "${pingIP}" ]]; then + if [[ "${pingIP}" == "null" ]]; then + echoContent skyBlue " ---> 检查ipv6中" + local pingIP=$(curl -s -H 'accept:application/dns-json' 'https://cloudflare-dns.com/dns-query?name='${domain}'&type=AAAA' | jq -r ".Answer") + if [[ "${pingIP}" -ne "null" ]];then + pingIP=$(echo "${pingIP}"|jq -r ".[]|select(.type==28)|.data") + pingIPv6=${pingIP} + fi + fi + + if [[ "${pingIP}" != "null" ]]; then echo read -r -p "当前域名的IP为 [${pingIP}],是否正确[y/n]?" domainStatus if [[ "${domainStatus}" == "y" ]]; then