From 26e9be0175855da38a0d8f1874dc3c52f40a67d3 Mon Sep 17 00:00:00 2001 From: Davide Permunian Date: Thu, 12 Apr 2018 22:41:17 +0200 Subject: [PATCH 1/8] Geolocalize host and add local list of DNS providers Signed-off-by: Davide Permunian --- countries/Italy.txt | 6 ++++++ dnstest.sh | 40 +++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 countries/Italy.txt diff --git a/countries/Italy.txt b/countries/Italy.txt new file mode 100644 index 0000000..48902fc --- /dev/null +++ b/countries/Italy.txt @@ -0,0 +1,6 @@ +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 diff --git a/dnstest.sh b/dnstest.sh index 23082f9..b91c979 100755 --- a/dnstest.sh +++ b/dnstest.sh @@ -8,20 +8,38 @@ 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 +77.88.8.7#yandex +176.103.130.132#adguard +156.154.70.3#neustar 8.26.56.26#comodo " +#check country by location +country=$(curl -s 'http://ip-api.com/json' | jq -r '.country') +if [[ $country ]] ; then + #add file if exist + if [ ! -f countries/$country.txt ]; then + printf "\nLocalized country file for $country not found, using default entries list\r\n\n" + else + printf "\nYou have been localized in $country - Let me show also your country's results\r\n\n" + #read localized file + additionals_providers=$(cat countries/$country.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" From 3f611a63b28d0aee942101fc91b27bafc243c34a Mon Sep 17 00:00:00 2001 From: Davide Permunian Date: Thu, 12 Apr 2018 22:51:18 +0200 Subject: [PATCH 2/8] News & help about geolocation version Signed-off-by: Davide Permunian --- README.md | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 73cb50e..59c881a 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,21 @@ Includes by default: * Neustar * Comodo -# Required +** New! ** Include your own ISP DNS with geolocation! +Add your **countries/country.txt** file, like this "*Italy.txt*" + +``` +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 and dig. For Ubuntu: @@ -26,11 +40,11 @@ You need to install bc and dig. For Ubuntu: # 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 @@ -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 @@ -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` From e58ca1af8087b9ad72fdc0a65c9035a2b346e8d4 Mon Sep 17 00:00:00 2001 From: Davide Permunian Date: Thu, 12 Apr 2018 23:25:02 +0200 Subject: [PATCH 3/8] added jq requirement for json parsing Signed-off-by: Davide Permunian --- README.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 59c881a..450b3bd 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Includes by default: * Neustar * Comodo -** New! ** Include your own ISP DNS with geolocation! +**New!** Include your own ISP DNS with geolocation! Add your **countries/country.txt** file, like this "*Italy.txt*" ``` @@ -28,6 +28,12 @@ Add your **countries/country.txt** file, like this "*Italy.txt*" 212.216.172.62#Alice_sec ``` +**Note**: require `jq`for json parsing + +``` +sudo apt-get install jq +``` + Your own DNS will be added to the default list. # Required From ff9d40db9531846e2b11e5a1e438fe5aae1c3b83 Mon Sep 17 00:00:00 2001 From: Davide Permunian Date: Thu, 12 Apr 2018 23:26:49 +0200 Subject: [PATCH 4/8] improved readme requirements Signed-off-by: Davide Permunian --- README.md | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 450b3bd..aab5fe6 100644 --- a/README.md +++ b/README.md @@ -28,20 +28,14 @@ Add your **countries/country.txt** file, like this "*Italy.txt*" 212.216.172.62#Alice_sec ``` -**Note**: require `jq`for json parsing - -``` -sudo apt-get install jq -``` - Your own DNS will be added to the default list. # Required -You need to install bc and dig. For Ubuntu: +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 From d4cb16b933fba8a6a782924c90ebfc0329dc2340 Mon Sep 17 00:00:00 2001 From: Davide Permunian Date: Tue, 29 May 2018 15:46:51 +0200 Subject: [PATCH 5/8] Modified country with countryCode + removed inactive DNS from IT list Signed-off-by: Davide Permunian --- README.md | 2 +- countries/{Italy.txt => IT.txt} | 2 -- dnstest.sh | 16 ++++++++-------- 3 files changed, 9 insertions(+), 11 deletions(-) rename countries/{Italy.txt => IT.txt} (66%) diff --git a/README.md b/README.md index aab5fe6..d34f89d 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Includes by default: * Comodo **New!** Include your own ISP DNS with geolocation! -Add your **countries/country.txt** file, like this "*Italy.txt*" +Add your **countries/countryCode.txt** file, like this "*IT.txt*" ``` 85.37.17.51#Telecom_pri diff --git a/countries/Italy.txt b/countries/IT.txt similarity index 66% rename from countries/Italy.txt rename to countries/IT.txt index 48902fc..fb1a703 100644 --- a/countries/Italy.txt +++ b/countries/IT.txt @@ -2,5 +2,3 @@ 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 diff --git a/dnstest.sh b/dnstest.sh index b91c979..073260b 100755 --- a/dnstest.sh +++ b/dnstest.sh @@ -25,16 +25,16 @@ PROVIDERS=" 8.26.56.26#comodo " -#check country by location -country=$(curl -s 'http://ip-api.com/json' | jq -r '.country') -if [[ $country ]] ; then - #add file if exist - if [ ! -f countries/$country.txt ]; then - printf "\nLocalized country file for $country not found, using default entries list\r\n\n" +#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 $country - Let me show also your country's results\r\n\n" + 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/$country.txt) + additionals_providers=$(cat countries/$countryCode.txt) #concatenate list PROVIDERS="$PROVIDERS$additionals_providers" fi From 1ca329e953daad83ae4c17286c6034116510dfba Mon Sep 17 00:00:00 2001 From: Davide Permunian Date: Tue, 29 May 2018 16:01:25 +0200 Subject: [PATCH 6/8] added CleanBrowsing secondary DNS in list Signed-off-by: Davide Permunian --- dnstest.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dnstest.sh b/dnstest.sh index 073260b..ca3c5da 100755 --- a/dnstest.sh +++ b/dnstest.sh @@ -18,7 +18,8 @@ PROVIDERS=" 208.67.220.220#opendns2 208.67.222.222#opendns3 199.85.126.20#norton -185.228.168.168#cleanbrowsing +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 From bb4994d5ba9490e10d3222de47dc85773e5963ee Mon Sep 17 00:00:00 2001 From: Davide Permunian Date: Mon, 24 Dec 2018 14:38:54 +0100 Subject: [PATCH 7/8] Removed IT Fastweb entries Signed-off-by: Davide Permunian --- countries/IT.txt | 2 -- 1 file changed, 2 deletions(-) diff --git a/countries/IT.txt b/countries/IT.txt index fb1a703..0a47481 100644 --- a/countries/IT.txt +++ b/countries/IT.txt @@ -1,4 +1,2 @@ 85.37.17.51#Telecom_pri 85.38.28.97#Telecom_sec -85.18.200.200#Fastweb_pri -89.97.140.140#Fastweb_sec From 5ab15f2f0c8030985d6767ae36799dad2205a8a5 Mon Sep 17 00:00:00 2001 From: Davide Permunian Date: Tue, 9 Apr 2019 23:52:45 +0200 Subject: [PATCH 8/8] Revert "Removed IT Fastweb entries" This reverts commit bb4994d5ba9490e10d3222de47dc85773e5963ee. --- countries/IT.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/countries/IT.txt b/countries/IT.txt index 0a47481..fb1a703 100644 --- a/countries/IT.txt +++ b/countries/IT.txt @@ -1,2 +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