M CHANGELOG => CHANGELOG +2 -0
@@ 4,6 4,8 @@ MaraDNS changelog
This is a stable release of MaraDNS:
* One line change to zoneserver.c to make it work better with systemd
+ * Synthetic IP generator example (e.g. 10.1.2.3.ip4.internal
+ resolves to 10.1.2.3) added to coLunacyDNS documentation
(2021-03-16)
M maradns-win32/coLunacyDNS.txt => maradns-win32/coLunacyDNS.txt +28 -0
@@ 100,6 100,34 @@ function processQuery(Q) -- Called for every DNS query received
end
--------------------------------------------------------------------------
+Here is an example where we can synthesize any IP given to us:
+--------------------------------------------------------------------------
+-- This script takes a query like 10.1.2.3.ip4.internal. and returns the
+-- corresponding IP (e.g. 10.1.2.3 here)
+-- We use "internal" because this is the fourth-most commonly used
+-- bogus TLD (#1 is "local", #2 is "home", and #3 is "dhcp")
+
+-- Change this is a different top level domain as desired. So, if this
+-- becomes "test", the this configuration script will resolve
+-- "10.1.2.3.ip4.test." names to their IP.
+TLD="internal"
+-- Change these IPs to the actual IPs the DNS server will run on
+bindIp = "127.0.0.1" -- We bind the server to the IP 127.0.0.1
+bindIp6 = "::1" -- Localhost for IPv6
+
+function processQuery(Q) -- Called for every DNS query received
+ if Q.coQtype == 1 then
+ local query = Q.coQuery
+ if query:match("^%d+%.%d+%.%d+%.%d+%.ip4%." .. TLD .. "%.$") then
+ local ip = query:gsub("%.ip4%." .. TLD .. "%.$","")
+ return {co1Type = "A", co1Data = ip}
+ end
+ else
+ return {co1Type = "notThere"}
+ end
+ return {co1Type = "notThere"}
+end
+--------------------------------------------------------------------------
Here is a more complicated example:
--------------------------------------------------------------------------