mirror of https://github.com/mack-a/v2ray-agent
feat(脚本): 优化查找ip
parent
6e09e0bbef
commit
8bc2c69634
20
install.sh
20
install.sh
|
@ -815,15 +815,21 @@ EOF
|
||||||
# 检查ip
|
# 检查ip
|
||||||
checkIP() {
|
checkIP() {
|
||||||
echoContent skyBlue " ---> 检查ipv4中"
|
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")
|
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
|
||||||
if [[ -z "${pingIP}" ]]; then
|
pingIP=$(echo "${pingIP}"|jq -r ".[]|select(.type==1)|.data")
|
||||||
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}
|
|
||||||
fi
|
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
|
echo
|
||||||
read -r -p "当前域名的IP为 [${pingIP}],是否正确[y/n]?" domainStatus
|
read -r -p "当前域名的IP为 [${pingIP}],是否正确[y/n]?" domainStatus
|
||||||
if [[ "${domainStatus}" == "y" ]]; then
|
if [[ "${domainStatus}" == "y" ]]; then
|
||||||
|
|
Loading…
Reference in New Issue