install_easy: speed up DNS check

This commit is contained in:
bol-van 2021-03-08 16:37:41 +03:00
parent b2b91fa437
commit f66b59af76

View File

@ -801,7 +801,7 @@ check_dns_spoof()
{ {
# $1 - domain # $1 - domain
# $2 - public DNS # $2 - public DNS
echo $1 | "$EXEDIR/mdig/mdig" --family=4 >"$DNSCHECK_DIG1" echo $1 | "$EXEDIR/mdig/mdig" --threads=10 --family=4 >"$DNSCHECK_DIG1"
nslookup $1 $2 | sed -n '/Name:/,$p' | grep ^Address | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' >"$DNSCHECK_DIG2" nslookup $1 $2 | sed -n '/Name:/,$p' | grep ^Address | grep -oE '([0-9]{1,3}\.){3}[0-9]{1,3}' >"$DNSCHECK_DIG2"
# check whether system resolver returns anything other than public DNS # check whether system resolver returns anything other than public DNS
grep -qvFf "$DNSCHECK_DIG2" "$DNSCHECK_DIG1" grep -qvFf "$DNSCHECK_DIG2" "$DNSCHECK_DIG1"
@ -837,13 +837,19 @@ check_dns()
done done
else else
echo no working public DNS was found. looks like public DNS blocked. echo no working public DNS was found. looks like public DNS blocked.
for dom in $DNSCHECK_DOM; do echo $dom; done | "$EXEDIR/mdig/mdig" --family=4 >"$DNSCHECK_DIGS" for dom in $DNSCHECK_DOM; do echo $dom; done | "$EXEDIR/mdig/mdig" --threads=10 --family=4 >"$DNSCHECK_DIGS"
fi fi
echo checking resolved IP uniqueness for : $DNSCHECK_DOM echo checking resolved IP uniqueness for : $DNSCHECK_DOM
echo censor\'s DNS can return equal result for multiple blocked domains. echo censor\'s DNS can return equal result for multiple blocked domains.
C1=$(wc -l <"$DNSCHECK_DIGS") C1=$(wc -l <"$DNSCHECK_DIGS")
C2=$(sort -u "$DNSCHECK_DIGS" | wc -l) C2=$(sort -u "$DNSCHECK_DIGS" | wc -l)
[ "$C1" -eq 0 ] &&
{
echo -- DNS is not working. It's either misconfigured or blocked or you don't have inet access.
check_dns_cleanup
return 1
}
[ "$C1" = "$C2" ] || [ "$C1" = "$C2" ] ||
{ {
echo system dns resolver has returned equal IPs for some domains checked above \($C1 total, $C2 unique\) echo system dns resolver has returned equal IPs for some domains checked above \($C1 total, $C2 unique\)