Programmatic DNS server

A programmatic DNS server is an authoritative or recursive DNS server that is capable of executing a custom, user-defined function upon receiving an incoming DNS query and is able to reply with a DNS response based on the result of executing such function. In order for a particular DNS server to be "programmatic", it must actually execute such function upon receiving an incoming DNS query, and not merely hold a static enumeration of such function.

The Universal Relay programmatic DNS server is known as "fake_dns.js" and has been used for the following applications:

  • generating "cookie" IPv6 addresses for Transparent Happy Eyeballs
  • generating complex name to IPv6 address mappings for IPv6 Things, where if statically enumerated, would take up more RAM and/or disk space than what is actually available, even if the amount of "information" to describe it (the Kolmogorov complexity) does not actually exceed available RAM or disk space resources. For example, you could have a list of 30,000 first names, 30,000 last names, and you want to create DNS records for every permutation of first and last names in those lists. With a regular DNS server, you would need space for 900,000,000 DNS AAAA records plus 900,000,000 PTR records, plus RRSIG and NSEC3 records if using DNSSEC. But with the programmatic DNS server, you could just store the 60,000 names in some efficient data structure and then generate all those records on demand.

The "information" in the above example would consist of the following:

  • the list of 30,000 first names
  • the list of 30,000 last names
  • the fact that DNS records are formed based on the Cartesian product of the above two lists (as sets).
  • the algorithm to convert domain names to IPv6 addresses, e.g. rebecca-jones.example.com could map to 2001:db8::6e53:5d98 where 0x6e53 is the index of "Rebecca" in the first name list, and 0x5d98 is the index of "Jones" in the last name list. Similarly, rebecca-smith.example.com could map to 2001:db8::6e53:4736 and patrick-jones.example.com could map to 2001:db8::4a30:5d98.