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

An enumeration.

dns.flags.AA = Flag.AA

An enumeration.

dns.flags.TC = Flag.TC

An enumeration.

dns.flags.RD = Flag.RD

An enumeration.

dns.flags.RA = Flag.RA

An enumeration.

dns.flags.AD = Flag.AD

An enumeration.

dns.flags.CD = Flag.CD

An enumeration.

dns.flags.from_text(text: str) int[source]

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

Returns an int

dns.flags.to_text(flags: int) str[source]

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

Returns a str.

EDNS Flags

dns.flags.DO = EDNSFlag.DO

An enumeration.

dns.flags.edns_from_text(text: str) int[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: int) str[source]

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

Returns a str.