4 There are many constants in :program:`dnsdist`.
11 These constants represent the `OpCode <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5>`__ of a query.
14 - ``DNSOpcode.IQuery``
15 - ``DNSOpcode.Status``
16 - ``DNSOpcode.Notify``
17 - ``DNSOpcode.Update``
19 Reference: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5
26 These constants represent the `CLASS <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2>`__ of a DNS record.
33 Reference: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
40 These constants represent the different `RCODEs <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-6>`__ for DNS messages.
42 .. versionchanged:: 1.4.0
43 The prefix is changed from ``dnsdist`` to ``DNSRCode``.
45 .. versionchanged:: 1.7.0
46 The lookup fallback from ``dnsdist`` to ``DNSRCode`` was removed.
48 - ``DNSRCode.NOERROR``
49 - ``DNSRCode.FORMERR``
50 - ``DNSRCode.SERVFAIL``
51 - ``DNSRCode.NXDOMAIN``
53 - ``DNSRCode.REFUSED``
54 - ``DNSRCode.YXDOMAIN``
55 - ``DNSRCode.YXRRSET``
56 - ``DNSRCode.NXRRSET``
57 - ``DNSRCode.NOTAUTH``
58 - ``DNSRCode.NOTZONE``
60 RCodes below are extended RCodes that can only be matched using :func:`ERCodeRule`.
62 - ``DNSRCode.BADVERS``
65 - ``DNSRCode.BADTIME``
66 - ``DNSRCode.BADMODE``
67 - ``DNSRCode.BADNAME``
69 - ``DNSRCode.BADTRUNC``
70 - ``DNSRCode.BADCOOKIE``
77 - ``EDNSOptionCode.DHU``
78 - ``EDNSOptionCode.ECS``
79 - ``EDNSOptionCode.N3U``
80 - ``EDNSOptionCode.DAU``
81 - ``EDNSOptionCode.TCPKEEPALIVE``
82 - ``EDNSOptionCode.COOKIE``
83 - ``EDNSOptionCode.PADDING``
84 - ``EDNSOptionCode.KEYTAG``
85 - ``EDNSOptionCode.NSID``
86 - ``EDNSOptionCode.CHAIN``
87 - ``EDNSOptionCode.EXPIRE``
89 Reference: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11
96 These constants represent the section in the DNS Packet.
98 - ``DNSSection.Question``
99 - ``DNSSection.Answer``
100 - ``DNSSection.Authority``
101 - ``DNSSection.Additional``
108 .. versionchanged:: 1.5.0
109 ``DNSAction.SpoofRaw`` has been added.
111 .. versionchanged:: 1.8.0
112 ``DNSAction.SpoofPacket`` has been added.
114 These constants represent an Action that can be returned from :func:`LuaAction` functions.
116 * ``DNSAction.Allow``: let the query pass, skipping other rules
117 * ``DNSAction.Delay``: delay the response for the specified milliseconds (UDP-only), continue to the next rule
118 * ``DNSAction.Drop``: drop the query
119 * ``DNSAction.HeaderModify``: indicate that the query has been turned into a response
120 * ``DNSAction.None``: continue to the next rule
121 * ``DNSAction.NoOp``: continue to the next rule (used for Dynamic Block actions where None has a different meaning)
122 * ``DNSAction.Nxdomain``: return a response with a NXDomain rcode
123 * ``DNSAction.Pool``: use the specified pool to forward this query
124 * ``DNSAction.Refused``: return a response with a Refused rcode
125 * ``DNSAction.ServFail``: return a response with a ServFail rcode
126 * ``DNSAction.Spoof``: spoof the response using the supplied IPv4 (A), IPv6 (AAAA) or string (CNAME) value. TTL will be 60 seconds.
127 * ``DNSAction.SpoofPacket``: spoof the response using the supplied raw packet
128 * ``DNSAction.SpoofRaw``: spoof the response using the supplied raw value as record data (see also :meth:`DNSQuestion:spoof` and :func:`dnsdist_ffi_dnsquestion_spoof_raw` to spoof multiple values)
129 * ``DNSAction.Truncate``: truncate the response
130 * ``DNSAction.NoRecurse``: set rd=0 on the query
137 .. versionchanged:: 1.4.0
138 The prefix is changed from ``dnsdist.`` to ``DNSQType``.
140 .. versionchanged:: 1.7.0
141 The lookup fallback from ``dnsdist`` to ``DNSQType`` was removed.
143 All named `QTypes <https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4>`__ are available as constants, prefixed with ``DNSQType.``, e.g.:
152 .. _DNSResponseAction:
157 These constants represent an Action that can be returned from :func:`LuaResponseAction` functions.
159 * ``DNSResponseAction.Allow``: let the response pass, skipping other rules
160 * ``DNSResponseAction.Delay``: delay the response for the specified milliseconds (UDP-only), continue to the next rule
161 * ``DNSResponseAction.Drop``: drop the response
162 * ``DNSResponseAction.HeaderModify``: indicate that the query has been turned into a response
163 * ``DNSResponseAction.None``: continue to the next rule
164 * ``DNSResponseAction.ServFail``: return a response with a ServFail rcode