mullvadrc, only get the provider's name once, add alias for testing my domain and important subdomains.
This commit is contained in:
1 parent
a597477c0b
commit
cb88843dc8
1 file changed
+20
-11
@@ -204,19 +204,26 @@
|
|||||||
mullvad disconnect
|
mullvad disconnect
|
||||||
sleep 1
|
sleep 1
|
||||||
mullvad connect
|
mullvad connect
|
||||||
sleep 3
|
|
||||||
|
name="" count=0
|
||||||
|
while [[ -z "$name" && count -lt 20 ]]; do
|
||||||
|
sleep 1
|
||||||
|
name=`dig -x $dns_server +short +time=5 +tries=1 2>/dev/null`
|
||||||
|
status=$?
|
||||||
|
if [[ $status != 0 ]]; then
|
||||||
|
name=""
|
||||||
|
fi
|
||||||
|
(( count++ ))
|
||||||
|
done
|
||||||
|
if [[ -z "$name" ]]; then
|
||||||
|
name="FAILED"
|
||||||
|
fi
|
||||||
|
|
||||||
for domain in $domains; do
|
for domain in $domains; do
|
||||||
loop=1
|
loop=1
|
||||||
|
|
||||||
while (( loop <= loops )); do
|
while (( loop <= loops )); do
|
||||||
echo -n "| $dns_server"
|
echo -n "| $dns_server | $name"
|
||||||
name=`dig -x $dns_server +short +time=5 +tries=1 2>/dev/null`
|
|
||||||
status=$?
|
|
||||||
if [[ $status != 0 ]]; then
|
|
||||||
name="FAILED"
|
|
||||||
fi
|
|
||||||
echo -n " | $name"
|
|
||||||
|
|
||||||
local dig_out ip query_time
|
local dig_out ip query_time
|
||||||
dig_out=$(dig "$domain" @"$dns_server" +time=5 +tries=1 +noall +answer +stats 2>/dev/null)
|
dig_out=$(dig "$domain" @"$dns_server" +time=5 +tries=1 +noall +answer +stats 2>/dev/null)
|
||||||
@@ -224,11 +231,12 @@
|
|||||||
ip=$(echo "$dig_out" | grep -oP '(?:[0-9]{1,3}\.){3}[0-9]{1,3}$')
|
ip=$(echo "$dig_out" | grep -oP '(?:[0-9]{1,3}\.){3}[0-9]{1,3}$')
|
||||||
|
|
||||||
if [[ -z "$query_time" ]]; then
|
if [[ -z "$query_time" ]]; then
|
||||||
echo -n " | $domain | FAILED | FAILED"
|
query_time=999999
|
||||||
else
|
ip="FAILED"
|
||||||
echo -n " | $domain | $ip | ${query_time}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
echo -n " | $domain | $ip | $query_time"
|
||||||
|
|
||||||
results="${results}\n $query_time $name $dns_server $domain $ip"
|
results="${results}\n $query_time $name $dns_server $domain $ip"
|
||||||
|
|
||||||
echo " | $loop |"
|
echo " | $loop |"
|
||||||
@@ -252,6 +260,7 @@
|
|||||||
dns-test "$DNS_SERVERS_ALL" "$1" "$2"
|
dns-test "$DNS_SERVERS_ALL" "$1" "$2"
|
||||||
}
|
}
|
||||||
alias dns-test-all="dns_test_all "
|
alias dns-test-all="dns_test_all "
|
||||||
|
alias dns-test-mine="dns-test-all 'hyperling.com git.hyperling.com cloud.hyperling.com blog.hyperling.com fdroid.hyperling.com' '1'"
|
||||||
|
|
||||||
[[ $(whoami) != "root" ]] &&
|
[[ $(whoami) != "root" ]] &&
|
||||||
echo "`date` - Ansible .mullvadrc loaded successfully!"
|
echo "`date` - Ansible .mullvadrc loaded successfully!"
|
||||||
|
|||||||
Reference in new issue
Block a user