Message Flags

DNS message flags are used for signalling of various kinds in the DNS protocol. For example, the QR flag indicates that a message is a response to a prior query.

Messages flags are encoded in two locations: the DNS header and the EDNS flags field.

Header Flags

dns.flags.QR = <Flag.QR: 32768>

An enumeration.

dns.flags.AA = <Flag.AA: 1024>

An enumeration.

dns.flags.TC = <Flag.TC: 512>

An enumeration.

dns.flags.RD = <Flag.RD: 256>

An enumeration.

dns.flags.RA = <Flag.RA: 128>

An enumeration.

dns.flags.AD = <Flag.AD: 32>

An enumeration.

dns.flags.CD = <Flag.CD: 16>

An enumeration.

dns.flags.from_text(text)[source]

Convert a space-separated list of flag text values into a flags value.

Returns an int

dns.flags.to_text(flags)[source]

Convert a flags value into a space-separated list of flag text values.

Returns a str.

EDNS Flags

dns.flags.DO = <EDNSFlag.DO: 32768>

An enumeration.

dns.flags.edns_from_text(text)[source]

Convert a space-separated list of EDNS flag text values into a EDNS flags value.

Returns an int

dns.flags.edns_to_text(flags)[source]

Convert an EDNS flags value into a space-separated list of EDNS flag text values.

Returns a str.