~samiam/MaraDNS

c27b413810c28617811f1c5302ff03f79260a892 — Sam Trenholme 6 days ago 49dc87b
DNS-to-IP script: Allow TLD to be changed.
1 files changed, 6 insertions(+), 2 deletions(-)

M deadwood-github/tools/coLunacyDNS/README.md
M deadwood-github/tools/coLunacyDNS/README.md => deadwood-github/tools/coLunacyDNS/README.md +6 -2
@@ 136,6 136,10 @@ Here is an example where we can synthesize any IP given to us:
-- This script takes a query like 10.1.2.3.ip4.invalid. and returns the
-- corresponding IP (e.g. 10.1.2.3 here)

-- 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="invalid"
-- 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


@@ 143,8 147,8 @@ 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%.invalid%.$") then
      local ip = query:gsub("%.ip4%.invalid%.$","")
    if query:match("^%d+%.%d+%.%d+%.%d+%.ip4%." .. TLD .. "%.$") then
      local ip = query:gsub("%.ip4%." .. TLD .. "%.$","")
      return {co1Type = "A", co1Data = ip}
    end
  else