Generating PDNS Config File: Part 2
In this post I will describe recent changes to the Flask webapp. On clicking the
Plot Voronoi button, it also generates the map file
pdns.config that maps networks to mirror servers’ pseudo IPs.
This is how the generated file looks:
220.127.116.11/24 :127.0.0.59 18.104.22.168/22 :127.0.0.24 22.214.171.124/22 :127.0.0.59 126.96.36.199/21 :127.0.0.5 188.8.131.52/20 :127.0.0.24 184.108.40.206/19 :127.0.0.5 220.127.116.11/18 :127.0.0.24 18.104.22.168/17 :127.0.0.5 22.214.171.124/24 :127.0.0.5 126.96.36.199/24 :127.0.0.59
Conversion from a range of IP addresses to the corresponding sub-networks in CIDR notation is time consuming. Out of the 2 Python libraries that do this job well:
cidrize is much faster. Even then, on measuring the time by Python
time module I found that for each entry in the Whois database, getting its latitude and lognitude and the CIDR networks takes approximately 0.14 seconds. Considering there are 160000 entries in the Whois database, generating the entire config file would take approximately 5 hours.