Universal Relay/Domain Mapping

This article or section needs to be updated.
The currently-implemented "dynamic" domain mapping algorithm is not described here; this article only describes a previously-proposed static domain mapping.

Universal Relay can be used to route Internet connections on the basis of DNS names, rather than IP addresses. This can be accomplished using the following steps:

  • In a private DNS server which is directly visible to end clients, assign each domain name of interest a "phantom" IP (v4 or v6) address.
  • In Universal Relay, configure the IP Rewrite function to map each of the phantom IP addresses to the ultimate destination using certain criteria (source interface, through proxy, etc.) (Use dns.lookup4 or dns.lookup6 to get the IP address for a particular domain name in your filter function, as the IP address of a particular website can change at any time, even when Universal Relay is in operation. filters are called with the await keyword in front, so you can wait for a DNS response without hampering any other TCP flows on the node.js main loop.)

Example mapping to put in /etc/hosts or overriding entries in a custom DNS server:

fd1b:af87:ad58::1 www.google.com
fd1b:af87:ad58::2 www.youtube.com
fd1b:af87:ad58::3 www.facebook.com
fd1b:af87:ad58::4 www.twitter.com
fd1b:af87:ad58::5 www.reddit.com
fd1b:af87:ad58::6 duckduckgo.com
fd1b:af87:ad58::7 github.com
fd1b:af87:ad58::8 en.wikipedia.org
fd1b:af87:ad58::9 fr.wikipedia.org
fd1b:af87:ad58::a www.nist.gov
fd1b:af87:ad58::b www.example.com
fd1b:af87:ad58::c www.example.org
fd1b:af87:ad58::d www.example.net
fd1b:af87:ad58::e website.peterjin.org
fd1b:af87:ad58::f www.peterjin.org
fd1b:af87:ad58::10 www.ietf.org
fd1b:af87:ad58::11 www.nsa.gov
fd1b:af87:ad58::12 www.nasa.gov
fd1b:af87:ad58::13 registry.npmjs.org

Subseqnetly, in Universal Relay, you would write a filter function that would say something to the effect of "if the IP address of the incoming connection (req.localAddress) == 'fd1b:af87:ad58::1', then resolve the IP address of www.google.com (using the normal DNS server) and relay the incoming TCP connection there"