Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,35 @@ Includes by default:
* Neustar
* Comodo

# Required
**New!** Include your own ISP DNS with geolocation!
Add your **countries/countryCode.txt** file, like this "*IT.txt*"

You need to install bc and dig. For Ubuntu:
```
85.37.17.51#Telecom_pri
85.38.28.97#Telecom_sec
85.18.200.200#Fastweb_pri
89.97.140.140#Fastweb_sec
212.216.112.112#Alice_pri
212.216.172.62#Alice_sec
```

Your own DNS will be added to the default list.

# Required

You need to install bc, dig and jq. For Ubuntu/Debian:

```
$ sudo apt-get install bc dnsutils
$ sudo apt-get install bc dnsutils jq
```

# Utilization

```
```
$ git clone --depth=1 https://github.com/cleanbrowsing/dnsperftest/
$ cd dnsperftest
$ bash ./dnstest.sh
test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 Average
$ bash ./dnstest.sh
test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 Average
cloudflare 1 ms 1 ms 1 ms 2 ms 1 ms 1 ms 1 ms 1 ms 1 ms 1 ms 1.10
google 22 ms 1 ms 4 ms 24 ms 1 ms 19 ms 3 ms 56 ms 21 ms 21 ms 17.20
quad9 10 ms 19 ms 10 ms 10 ms 10 ms 10 ms 10 ms 10 ms 10 ms 55 ms 15.40
Expand All @@ -47,7 +61,7 @@ To sort with the fastest first, add `sort -k 22 -n` at the end of the command:

```
$ bash ./dnstest.sh |sort -k 22 -n
test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 Average
test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 Average
cloudflare 1 ms 1 ms 1 ms 4 ms 1 ms 1 ms 1 ms 1 ms 1 ms 1 ms 1.30
norton 2 ms 2 ms 2 ms 2 ms 2 ms 2 ms 2 ms 2 ms 2 ms 2 ms 2.00
neustar 2 ms 2 ms 2 ms 2 ms 1 ms 2 ms 2 ms 2 ms 2 ms 22 ms 3.90
Expand All @@ -65,5 +79,5 @@ adguard 199 ms 210 ms 200 ms 201 ms 202 ms 202 ms 199 ms 200 ms 1
If you receive an error `$'\r': command not found`, convert the file to a Linux-compatible line endings using:

tr -d '\15\32' < dnstest.sh > dnstest-2.sh

Then run `bash ./dnstest-2.sh`
4 changes: 4 additions & 0 deletions countries/IT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
85.37.17.51#Telecom_pri
85.38.28.97#Telecom_sec
85.18.200.200#Fastweb_pri
89.97.140.140#Fastweb_sec
41 changes: 30 additions & 11 deletions dnstest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,39 @@ command -v bc > /dev/null || { echo "bc was not found. Please install bc."; exit
NAMESERVERS=`cat /etc/resolv.conf | grep ^nameserver | cut -d " " -f 2 | sed 's/\(.*\)/&#&/'`

PROVIDERS="
1.1.1.1#cloudflare
4.2.2.1#level3
8.8.8.8#google
9.9.9.9#quad9
80.80.80.80#freenom
208.67.222.123#opendns
199.85.126.20#norton
185.228.168.168#cleanbrowsing
77.88.8.7#yandex
176.103.130.132#adguard
156.154.70.3#neustar
1.1.1.1#cloudflare
4.2.2.1#level3
8.8.8.8#google_pri
8.8.4.4#google_sec
9.9.9.9#quad9
80.80.80.80#freenom
208.67.222.123#opendns1
208.67.220.220#opendns2
208.67.222.222#opendns3
199.85.126.20#norton
185.228.168.168#cleanbrowsing_pri
185.228.168.169#cleanbrowsing_sec
77.88.8.7#yandex
176.103.130.132#adguard
156.154.70.3#neustar
8.26.56.26#comodo
"

#check countryCode by location
countryCode=$(curl -s 'http://ip-api.com/json' | jq -r '.countryCode')
if [[ $countryCode ]] ; then
#check file if exist
if [ ! -f countries/$countryCode.txt ]; then
printf "\nLocalized countryCode file for $countryCode not found, using default entries list\r\n\n"
else
printf "\nYou have been localized in $countryCode - Let me show also your countryCode's results\r\n\n"
#read localized file
additionals_providers=$(cat countries/$countryCode.txt)
#concatenate list
PROVIDERS="$PROVIDERS$additionals_providers"
fi
fi

# Domains to test. Duplicated domains are ok
DOMAINS2TEST="www.google.com amazon.com facebook.com www.youtube.com www.reddit.com wikipedia.org twitter.com gmail.com www.google.com whatsapp.com"

Expand Down