Merge branch 'master' into 'master'
Replace opennic-set.py with a version that use the OpenNIC API This version is a almost complete rewriting of the vindarel's original file. It use the API grab from the source web page https://www.opennicproject.org/nearest-servers/ of openNIC (https://api.opennicproject.org/geoip/?jsonp&res=4&ip=&nearest). It use two type of very fast ping: ones that ping always up IP, and onother that ping notorious domain name like google.com. Is used o lot number of IP's and domain name for safety reason and is checked the DNS get from the OpenNIC's API via a ping. If the previous Opennic DNS/the previous DNS located in head of /etc/resolvconf.d directory are not working, we used other fall back DNS IPs like google DNS and other. TODO?: in this wise you are able to download the opennic DNS via the API. But if the old (old session?) DNS dont't works is reasonable to try the new ones? Or is better to wait the next session when you has setted the default DNS (fall back) and you can try to download the new ones via API? At the end is write into head of resolv.conf.d directory the Opennic DNS IPs if they are pinged, then they are checked via a ping domain name (example ping google.com). If the last ping is ok then you can start your session with working Opennic DNS. Otherwise you have a problem and my script don't go further. It is unlike that this script fail to set DNS. I don't like google and OpenDNS so I used other IPs, other DNS and other domain name like startpage.com. You can set your own like you agree. the CLI command ping is very fast in my machine so i insert a pause of one second to slow the sequence of test. I have set the option timeout and other but w/o success so I inserted the time.sleep(1). When this script is started for first it check the Internet connection via a iterative pinging of all TEST IP, so those servers known your IP. For privacy reason is better if TEST IP are not google IP like 220.127.116.11 and 18.104.22.168 or other spyware server. When your internet connection (router is on?) is up the pinging ended. I have a 3G modem/router so when I power on my linux box my router is booted and this script wait some seconds for when the Internet is up. This script has the timeout feature: you can enlarge it. See merge request !1
Showing with 227 additions and 92 deletions