Skip to content

Commit

Permalink
Add support for DNS.WATCH and Cloudflare DNS servers
Browse files Browse the repository at this point in the history
  • Loading branch information
xilopaint committed Jan 19, 2019
1 parent 64affd9 commit 6a096fe
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
14 changes: 8 additions & 6 deletions src/default-dns.conf
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
# Custom DNS List
#
# Format:
# <DNS Name> : <DNS IPs>
# <DNS Name> : <DNS IPs>
#

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
2 changes: 1 addition & 1 deletion src/dns.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions src/helpers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit 6a096fe

Please sign in to comment.