feat(脚本): 修改检测ip为DoH

pull/534/merge
mack-a 2021-03-08 15:30:55 +08:00
parent 12f3b159ef
commit 52d8e3508e
1 changed files with 8 additions and 7 deletions

View File

@ -450,12 +450,12 @@ initTLSNginxConfig() {
echoContent yellow "\n ---> 域名:${domain}"
else
echo
echoContent yellow "请输入要配置的域名 例:blog.v2ray-agent.com --->"
echoContent yellow "请输入要配置的域名 例:www.v2ray-agent.com --->"
read -r -p "域名:" domain
fi
else
echo
echoContent yellow "请输入要配置的域名 例:blog.v2ray-agent.com --->"
echoContent yellow "请输入要配置的域名 例:www.v2ray-agent.com --->"
read -r -p "域名:" domain
fi
@ -539,14 +539,15 @@ EOF
# 检查ip
checkIP() {
echoContent skyBlue " ---> 检查ipv4中"
pingIP=$(ping -c 1 -W 1000 ${domain} | sed '2{s/[^(]*(//;s/).*//;q;}' | sed -n '$p')
if [[ -z $(echo "${pingIP}" | awk -F "[.]" '{print $4}') ]]; then
local pingIP=$(curl -s -H 'accept:application/dns-json' 'https://cloudflare-dns.com/dns-query?name='${domain}'&type=A' | jq .Answer[0].data | awk -F '["]' '{print $2}')
if [[ -z "${pingIP}" ]]; then
echoContent skyBlue " ---> 检查ipv6中"
pingIP=$(ping6 -c 1 ${domain} | sed '2{s/[^(]*(//;s/).*//;q;}' | sed -n '$p')
pingIP=$(curl -s -H 'accept:application/dns-json' 'https://cloudflare-dns.com/dns-query?name='${domain}'&type=AAAA' | jq .Answer[0].data | awk -F '["]' '{print $2}')
pingIPv6=${pingIP}
fi
if [[ -n "${pingIP}" ]]; then # && [[ `echo ${pingIP}|grep '^\([1-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)\.\([0-9]\|[1-9][0-9]\|1[0-9][0-9]\|2[0-4][0-9]\|25[0-5]\)$'` ]]
if [[ -n "${pingIP}" ]]; then
echo
read -r -p "当前域名的IP为 [${pingIP}],是否正确[y/n]" domainStatus
if [[ "${domainStatus}" == "y" ]]; then
@ -3422,7 +3423,7 @@ menu() {
cd "$HOME" || exit
echoContent red "\n=============================================================="
echoContent green "作者mack-a"
echoContent green "当前版本v2.3.27"
echoContent green "当前版本v2.3.28"
echoContent green "Githubhttps://github.com/mack-a/v2ray-agent"
echoContent green "描述:七合一共存脚本"
echoContent red "=============================================================="