dns.message.decode

dns.message

decode(raw_bytes) -> msg, err

Decode a raw DNS message into a structured table

Decodes a complete DNS message from a raw binary string. Returns a table with header, question, answer, authority, additional, and optionally edns fields. The OPT pseudo-record is extracted from the additional section into msg.edns.

Section counts from the header determine how many entries are parsed in each section. If any entry fails to parse, the entire decode fails with an error (strict mode).