dns.iter.query_server

dns.iter

query_server(host, qname, qtype, opts) -> resp, err

Send a single iterative (RD=0) DNS query to a specific server

Sends one DNS query with RD=0 (Recursion Desired off) to the server at host. Returns the full decoded response message including all sections (header, question, answer, authority, additional, edns).

qtype may be a string ("A", "AAAA", "NS", "MX") or a numeric type code.

Optional opts fields:

Automatically retries over TCP when the response has the TC (truncation) bit set.

local iter = require("dns.iter")
local resp, err = iter.query_server("198.41.0.4", "example.com.", "A")
if resp then
    local kind, info = iter.classify(resp, 1)
    print(kind)  -- "referral"
end