Constants¶
There are many constants in dnsdist.
OPCode¶
These constants represent the OpCode of a query.
DNSOpcode.QueryDNSOpcode.IQueryDNSOpcode.StatusDNSOpcode.NotifyDNSOpcode.Update
Reference: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-5
DNSClass¶
These constants represent the CLASS of a DNS record.
DNSClass.INDNSClass.CHAOSDNSClass.NONEDNSClass.ANY
Reference: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-2
RCode¶
These constants represent the different RCODEs for DNS messages.
Changed in version 1.4.0: The prefix is changed from dnsdist to DNSRCode.
Changed in version 1.7.0: The lookup fallback from dnsdist to DNSRCode was removed.
DNSRCode.NOERRORDNSRCode.FORMERRDNSRCode.SERVFAILDNSRCode.NXDOMAINDNSRCode.NOTIMPDNSRCode.REFUSEDDNSRCode.YXDOMAINDNSRCode.YXRRSETDNSRCode.NXRRSETDNSRCode.NOTAUTHDNSRCode.NOTZONE
RCodes below are extended RCodes that can only be matched using ERCodeRule().
DNSRCode.BADVERSDNSRCode.BADSIGDNSRCode.BADKEYDNSRCode.BADTIMEDNSRCode.BADMODEDNSRCode.BADNAMEDNSRCode.BADALGDNSRCode.BADTRUNCDNSRCode.BADCOOKIE
EDNSOptionCode¶
EDNSOptionCode.DHUEDNSOptionCode.ECSEDNSOptionCode.N3UEDNSOptionCode.DAUEDNSOptionCode.TCPKEEPALIVEEDNSOptionCode.COOKIEEDNSOptionCode.PADDINGEDNSOptionCode.KEYTAGEDNSOptionCode.NSIDEDNSOptionCode.CHAINEDNSOptionCode.EXPIRE
Reference: https://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-11
DNS Packet Sections¶
These constants represent the section in the DNS Packet.
DNSSection.QuestionDNSSection.AnswerDNSSection.AuthorityDNSSection.Additional
DNSAction¶
Changed in version 1.5.0: DNSAction.SpoofRaw has been added.
Changed in version 1.8.0: DNSAction.SpoofPacket has been added.
Changed in version 2.0.0: DNSAction.SetTag has been added.
These constants represent an Action that can be returned from LuaAction() functions.
DNSAction.Allow: let the query pass, skipping other rulesDNSAction.Delay: delay the response for the specified milliseconds (UDP-only), continue to the next ruleDNSAction.Drop: drop the queryDNSAction.HeaderModify: indicate that the query has been turned into a responseDNSAction.None: continue to the next ruleDNSAction.NoOp: continue to the next rule (used for Dynamic Block actions where None has a different meaning)DNSAction.NoRecurse: set rd=0 on the queryDNSAction.Nxdomain: return a response with a NXDomain rcodeDNSAction.Pool: use the specified pool to forward this queryDNSAction.Refused: return a response with a Refused rcodeDNSAction.ServFail: return a response with a ServFail rcodeDNSAction.SetTag: set a tag, seeSetTagAction()(only used for Dynamic Block actions, see meth:DNSQuestion:setTag to set a tag from Lua)DNSAction.Spoof: spoof the response using the supplied IPv4 (A), IPv6 (AAAA) or string (CNAME) value. TTL will be 60 seconds.DNSAction.SpoofPacket: spoof the response using the supplied raw packetDNSAction.SpoofRaw: spoof the response using the supplied raw value as record data (see alsoDNSQuestion:spoof()anddnsdist_ffi_dnsquestion_spoof_raw()to spoof multiple values)DNSAction.Truncate: truncate the response
DNSQType¶
Changed in version 1.4.0: The prefix is changed from dnsdist. to DNSQType.
Changed in version 1.7.0: The lookup fallback from dnsdist to DNSQType was removed.
All named QTypes are available as constants, prefixed with DNSQType., e.g.:
DNSQType.AAAADNSQType.AXFRDNSQType.ADNSQType.NSDNSQType.SOA- etc.
DNSResponseAction¶
Changed in version 1.9.0: The DNSResponseAction.Truncate value was added.
These constants represent an Action that can be returned from LuaResponseAction() functions.
DNSResponseAction.Allow: let the response pass, skipping other rulesDNSResponseAction.Delay: delay the response for the specified milliseconds (UDP-only), continue to the next ruleDNSResponseAction.Drop: drop the responseDNSResponseAction.HeaderModify: indicate that the query has been turned into a responseDNSResponseAction.None: continue to the next ruleDNSResponseAction.ServFail: return a response with a ServFail rcodeDNSResponseAction.Truncate: truncate the response, removing all records from the answer, authority and additional sections if any