From 3c3eb91d7d2fac94b5e3387e290a4b579d8a4e83 Mon Sep 17 00:00:00 2001 From: 233boy <31657650+233boy@users.noreply.github.com> Date: Sun, 27 Oct 2019 19:16:34 +0800 Subject: [PATCH] fix ping not support '-4' option. #367, #370 --- install.sh | 4 +++- v2ray.sh | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 5c91b33..e1974aa 100644 --- a/install.sh +++ b/install.sh @@ -745,7 +745,9 @@ domain_check() { # $cmd install dnsutils -y # fi # test_domain=$(dig $domain +short) - test_domain=$(ping $domain -c 1 -4 | grep -oE -m1 "([0-9]{1,3}\.){3}[0-9]{1,3}") + # test_domain=$(ping $domain -c 1 -4 | 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=$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=$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" diff --git a/v2ray.sh b/v2ray.sh index daa01fd..f45b60c 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.18" +_version="v3.19" cmd="apt-get" @@ -1763,7 +1763,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 $domain -c 1 -4 | 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=$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=$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"