From 7028fbe67938ac320538fc1136615bad26e3751a Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Sun, 13 Feb 2022 14:27:53 +0800 Subject: [PATCH] use ping check domain --- v2ray.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/v2ray.sh b/v2ray.sh index 5db582f..47451aa 100644 --- a/v2ray.sh +++ b/v2ray.sh @@ -10,7 +10,7 @@ none='\e[0m' # Root [[ $(id -u) != 0 ]] && echo -e " 哎呀……请使用 ${red}root ${none}用户运行 ${yellow}~(^_^) ${none}" && exit 1 -_version="v3.51" +_version="v3.52" cmd="apt-get" @@ -1737,9 +1737,9 @@ change_proxy_site_config() { } domain_check() { # test_domain=$(dig $new_domain +short) - # test_domain=$(ping $new_domain -c 1 -4 | grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}") + test_domain=$(ping $new_domain -c 1 -4 -W 2| grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}") # test_domain=$(wget -qO- --header='accept: application/dns-json' "https://cloudflare-dns.com/dns-query?name=$new_domain&type=A" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1) - test_domain=$(curl -sH 'accept: application/dns-json' "https://cloudflare-dns.com/dns-query?name=$new_domain&type=A" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1) + # test_domain=$(curl -sH 'accept: application/dns-json' "https://cloudflare-dns.com/dns-query?name=$new_domain&type=A" | grep -oE "([0-9]{1,3}\.){3}[0-9]{1,3}" | head -1) if [[ $test_domain != $ip ]]; then echo echo -e "$red 检测域名解析错误....$none"