From 6a096fe3194db19543641d6bf3008e1e9a702353 Mon Sep 17 00:00:00 2001 From: xilopaint Date: Sat, 19 Jan 2019 17:40:00 -0300 Subject: [PATCH] Add support for DNS.WATCH and Cloudflare DNS servers --- src/default-dns.conf | 14 ++++++++------ src/dns.sh | 2 +- src/helpers.sh | 10 +++++----- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/default-dns.conf b/src/default-dns.conf index 9f2f3d6..3bda5bc 100755 --- a/src/default-dns.conf +++ b/src/default-dns.conf @@ -5,11 +5,13 @@ # Custom DNS List # # Format: -# : +# : # -Google DNS : 8.8.8.8, 8.8.4.4 -OpenDNS : 208.67.222.222, 208.67.220.220 -Alibaba DNS : 223.5.5.5, 223.6.6.6 -V2EX DNS : 199.91.73.222, 178.79.131.110 -114 DNS : 114.114.114.114, 114.114.115.115 +Google DNS : 8.8.8.8, 8.8.4.4 +OpenDNS : 208.67.222.222, 208.67.220.220 +Cloudflare DNS: 1.1.1.1, 1.0.0.1 +DNS.WATCH : 84.200.69.80, 84.200.70.40 +Alibaba DNS : 223.5.5.5, 223.6.6.6 +V2EX DNS : 199.91.73.222, 178.79.131.110 +114 DNS : 114.114.114.114, 114.114.115.115 diff --git a/src/dns.sh b/src/dns.sh index 6e3be57..626eded 100755 --- a/src/dns.sh +++ b/src/dns.sh @@ -20,7 +20,7 @@ if [ "$1" != "" ]; then DNS=$(echo "$1" | sed 's/ \/ / /g') fi - networksetup -setdnsservers "${NAME%,*}" "$DNS" + networksetup -setdnsservers ${NAME%,*} $DNS dscacheutil -flushcache exit fi diff --git a/src/helpers.sh b/src/helpers.sh index 54a9ade..90af226 100755 --- a/src/helpers.sh +++ b/src/helpers.sh @@ -128,7 +128,7 @@ getAuth() { getGlobalIP() { local RESOLVER=${1:-"myip.opendns.com @resolver1.opendns.com"} - local IP=$(dig +time=2 +tries=1 +short "$RESOLVER") + local IP=$(dig +time=2 +tries=1 +short $RESOLVER) if [[ "$IP" =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then echo "$IP" fi @@ -160,7 +160,7 @@ getVPNInfo() { # $1 = networksetup -getdnsservers getDNS() { if [[ "$1" != *"any DNS"* ]]; then - echo "$1" | sed 's/ / \/ /g' + echo $1 | sed 's/ / \/ /g' else echo "" fi @@ -229,9 +229,9 @@ getAPDetails() { then SSID=${BASH_REMATCH[1]} BSSID=${BASH_REMATCH[2]} - RSSI=$(echo "${BASH_REMATCH[3]}" | awk '/ / {print $1}') - CHANNEL=$(echo "${BASH_REMATCH[3]}" | awk '/ / {print $2}') - SECURITY=$(echo "${BASH_REMATCH[3]}" | awk '/ / {print substr($0, index($0, $5))}') + RSSI=$(echo ${BASH_REMATCH[3]} | awk '/ / {print $1}') + CHANNEL=$(echo ${BASH_REMATCH[3]} | awk '/ / {print $2}') + SECURITY=$(echo ${BASH_REMATCH[3]} | awk '/ / {print substr($0, index($0, $5))}') fi FAVORITED=$(listContains "$3" "$SSID")