diff --git a/tasks/workstation/linux/software/vpn.yml b/tasks/workstation/linux/software/vpn.yml index 7166821..cd64e3a 100644 --- a/tasks/workstation/linux/software/vpn.yml +++ b/tasks/workstation/linux/software/vpn.yml @@ -204,19 +204,26 @@ mullvad disconnect sleep 1 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 loop=1 while (( loop <= loops )); do - echo -n "| $dns_server" - name=`dig -x $dns_server +short +time=5 +tries=1 2>/dev/null` - status=$? - if [[ $status != 0 ]]; then - name="FAILED" - fi - echo -n " | $name" + echo -n "| $dns_server | $name" local dig_out ip query_time 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}$') if [[ -z "$query_time" ]]; then - echo -n " | $domain | FAILED | FAILED" - else - echo -n " | $domain | $ip | ${query_time}" + query_time=999999 + ip="FAILED" fi + echo -n " | $domain | $ip | $query_time" + results="${results}\n $query_time $name $dns_server $domain $ip" echo " | $loop |" @@ -252,6 +260,7 @@ dns-test "$DNS_SERVERS_ALL" "$1" "$2" } 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" ]] && echo "`date` - Ansible .mullvadrc loaded successfully!"