extract_referral(
resp) ->zone,ns,glue
Extract referral details from a DNS response
Parses the authority and additional sections of a decoded DNS response to extract delegation information.
Returns three values:
zone — the delegated zone name (owner name of NS records), or nil
if no NS records are found in the authority sectionns — list of {name = "ns1.example.com."} tables from NS recordsglue — map of NS name → {ipv4 = "1.2.3.4", ipv6 = "2001:..."} from
A/AAAA records in the additional section; keys are normalized (lowercase
with trailing dot)local iter = require("dns.iter")
local resp = iter.query_server("198.41.0.4", "example.com.", "A")
local zone, ns, glue = iter.extract_referral(resp)
-- zone: "com."
-- ns: {{name = "a.gtld-servers.net."}, ...}
-- glue: {["a.gtld-servers.net."] = {ipv4 = "192.5.6.30"}, ...}