The basic idea of this project (or a PoC) is to create a Name Server that responds to the queries from Global DNS servers like Cloudflare (184.108.40.206) or Google (220.127.116.11) with respecting the geography of the IP Address it is requested from.
It does look difficult from the perspective of normal website user, but if you think about it from a engineering perspective it is quite simple.
The main purpose of this project is to have a Name server that sits in-between DNS and records. Based on the location it will resolve A/AAAA records closest to the Client IP that requested the record.
e.g. if client is in India and the website they visit is resolving to multiple IPs around the globe thatdns service will respond with only nearest ones.
How it works?
The server is running CoreDNS service that responds to all the queries from DNS Servers. Following are the plugins that are going to be used.
- file: File plugin allows serving records from a File.
- geoip: Allows to set metadata about the Client IP.
- geodns: Allows resolving the record and if it has more than one A record, check closest one.
The simple file has records which needs records to be served. More details about it are available in Core DNS Plugin file
The GeoIP plugin allows adding a metadata about the Client Address, like Country, City, etc. More details about it are available in Core DNS Plugin geoip
GeoDNS Plugin (In progress)
This plugin is in development, it actually does the magic. It is a middleware which filters the IPs which are nearby to the Client IP. Code repository is available at GeoDNS Git Repository.More details...