module documentation
(source)

DNS protocol implementation.

Future Plans:

  • Get rid of some toplevels, maybe.
Function randomSource Wrapper around twisted.python.randbytes.RandomFactory.secureRandom to return 2 random bytes.
Variable PORT Undocumented
Variable A Undocumented
Variable NS Undocumented
Variable MD Undocumented
Variable MF Undocumented
Variable CNAME Undocumented
Variable SOA Undocumented
Variable MB Undocumented
Variable MG Undocumented
Variable MR Undocumented
Variable NULL Undocumented
Variable WKS Undocumented
Variable PTR Undocumented
Variable HINFO Undocumented
Variable MINFO Undocumented
Variable MX Undocumented
Variable TXT Undocumented
Variable RP Undocumented
Variable AFSDB Undocumented
Variable AAAA Undocumented
Variable SRV Undocumented
Variable NAPTR Undocumented
Variable A6 Undocumented
Variable DNAME Undocumented
Variable OPT Undocumented
Variable SSHFP Undocumented
Variable SPF Undocumented
Variable TKEY Undocumented
Variable TSIG Undocumented
Variable QUERY_TYPES Undocumented
Variable IXFR Undocumented
Variable AXFR Undocumented
Variable MAILB Undocumented
Variable MAILA Undocumented
Variable ALL_RECORDS Undocumented
Variable EXT_QUERIES Undocumented
Variable REV_TYPES Undocumented
Variable IN Undocumented
Variable CS Undocumented
Variable CH Undocumented
Variable HS Undocumented
Variable ANY Undocumented
Variable QUERY_CLASSES Undocumented
Variable REV_CLASSES Undocumented
Variable OP_QUERY Undocumented
Variable OP_INVERSE Undocumented
Variable OP_STATUS Undocumented
Variable OP_NOTIFY Undocumented
Variable OP_UPDATE Undocumented
Variable OK Undocumented
Variable EFORMAT Undocumented
Variable ESERVER Undocumented
Variable ENAME Undocumented
Variable ENOTIMP Undocumented
Variable EREFUSED Undocumented
Variable EBADVERSION Undocumented
Variable EBADSIG Undocumented
Variable EBADKEY Undocumented
Variable EBADTIME Undocumented
Interface IRecord A single entry in a zone of authority.
Function domainString Coerce a domain name string to bytes.
Function str2time Parse a string description of an interval into an integer number of seconds.
Function readPrecisely Undocumented
Interface IEncodable Interface for something which can be encoded to and decoded to the DNS wire format.
Interface IEncodableRecord Interface for DNS records that can be encoded and decoded.
Class Charstr No class docstring; 0/1 instance variables, 3/6 methods documented
Class Name A name in the domain name system, made up of multiple labels. For example, twistedmatrix.com.
Class Query Represent a single DNS query.
Class RRHeader A resource record header.
Class SimpleRecord A Resource Record which consists of a single RFC 1035 domain-name.
Class Record_NS An authoritative nameserver.
Class Record_MD A mail destination.
Class Record_MF A mail forwarder.
Class Record_CNAME The canonical name for an alias.
Class Record_MB A mailbox domain name.
Class Record_MG A mail group member.
Class Record_MR A mail rename domain name.
Class Record_PTR A domain name pointer.
Class Record_DNAME A non-terminal DNS name redirection.
Class Record_A An IPv4 host address.
Class Record_SOA Marks the start of a zone of authority.
Class Record_NULL A null record.
Class Record_WKS A well known service description.
Class Record_AAAA An IPv6 host address.
Class Record_A6 An IPv6 address.
Class Record_SRV The location of the server(s) for a specific protocol and domain.
Class Record_NAPTR The location of the server(s) for a specific protocol and domain.
Class Record_AFSDB Map from a domain name to the name of an AFS cell database server.
Class Record_RP The responsible person for a domain.
Class Record_HINFO Host information.
Class Record_MINFO Mailbox or mail list information.
Class Record_MX Mail exchange.
Class Record_SSHFP A record containing the fingerprint of an SSH key.
Class Record_TXT Freeform text.
Class UnknownRecord Encapsulate the wire data for unknown record types so that they can pass through the system unchanged.
Class Record_SPF Structurally, freeform text. Semantically, a policy definition, formatted as defined in rfc 4408.
Class Record_TSIG A transaction signature, encapsulated in a RR, as described in RFC 2845.
Class Message Message contains all the information represented by a single DNS request or response.
Class DNSMixin DNS protocol mixin shared by UDP and TCP implementations.
Class DNSDatagramProtocol DNS protocol over UDP.
Class DNSProtocol DNS protocol over TCP.
Function _ord2bytes Construct a bytes object representing a single byte with the given ordinal value.
Function _nicebytes Represent a mostly textful bytes object in a way suitable for presentation to an end user.
Function _nicebyteslist Represent a list of mostly textful bytes objects in a way suitable for presentation to an end user.
Function _nameToLabels Split a domain name into its constituent labels.
Function _isSubdomainOf Test whether descendantName is equal to or is a subdomain of ancestorName.
Class _OPTHeader An OPT record header.
Class _OPTVariableOption A class to represent OPT record variable options.
Function _responseFromMessage Generate a Message like instance suitable for use as the response to message.
Function _getDisplayableArguments Inspect the function signature of obj's constructor, and get a list of which arguments should be displayed. This is a helper function for _compactRepr.
Function _compactRepr Return a str representation of obj which only shows fields with non-default values, flags which are True and sections which have been explicitly set.
Class _EDNSMessage An EDNS message.
def _ord2bytes(ordinal): (source)

Construct a bytes object representing a single byte with the given ordinal value.

ParametersordinalUndocumented (type: int)
ReturnsUndocumented (type: bytes)
def _nicebytes(bytes): (source)

Represent a mostly textful bytes object in a way suitable for presentation to an end user.

ParametersbytesThe bytes to represent.
ReturnsUndocumented (type: str)
def _nicebyteslist(list): (source)

Represent a list of mostly textful bytes objects in a way suitable for presentation to an end user.

ParameterslistThe list of bytes to represent.
ReturnsUndocumented (type: str)
def randomSource(): (source)

Wrapper around twisted.python.randbytes.RandomFactory.secureRandom to return 2 random bytes.

ReturnsUndocumented (type: bytes)
PORT = (source)

Undocumented

(type: int)

Undocumented

Undocumented

Undocumented

Undocumented

CNAME = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

NULL = (source)

Undocumented

Undocumented

Undocumented

HINFO = (source)

Undocumented

MINFO = (source)

Undocumented

Undocumented

Undocumented

Undocumented

AFSDB = (source)

Undocumented

AAAA = (source)

Undocumented

(type: int)

Undocumented

(type: int)
NAPTR = (source)

Undocumented

(type: int)

Undocumented

(type: int)
DNAME = (source)

Undocumented

(type: int)

Undocumented

(type: int)
SSHFP = (source)

Undocumented

(type: int)

Undocumented

(type: int)
TKEY = (source)

Undocumented

(type: int)
TSIG = (source)

Undocumented

(type: int)
QUERY_TYPES = (source)

Undocumented

IXFR = (source)

Undocumented

AXFR = (source)

Undocumented

MAILB = (source)

Undocumented

MAILA = (source)

Undocumented

ALL_RECORDS = (source)

Undocumented

EXT_QUERIES = (source)

Undocumented

REV_TYPES = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

(type: int)
QUERY_CLASSES = (source)

Undocumented

REV_CLASSES = (source)

Undocumented

OP_QUERY = (source)

Undocumented

OP_INVERSE = (source)

Undocumented

OP_STATUS = (source)

Undocumented

OP_NOTIFY = (source)

Undocumented

(type: int)
OP_UPDATE = (source)

Undocumented

(type: int)

Undocumented

EFORMAT = (source)

Undocumented

ESERVER = (source)

Undocumented

ENAME = (source)

Undocumented

ENOTIMP = (source)

Undocumented

EREFUSED = (source)

Undocumented

EBADVERSION = (source)

Undocumented

(type: int)
EBADSIG = (source)

Undocumented

EBADKEY = (source)

Undocumented

EBADTIME = (source)

Undocumented

def _nameToLabels(name): (source)

Split a domain name into its constituent labels.

ParametersnameA fully qualified domain name (with or without a trailing dot). (type: bytes)
ReturnsA list of labels ending with an empty label representing the DNS root zone. (type: list of bytes)
def domainString(domain): (source)

Coerce a domain name string to bytes.

twisted.names represents domain names as bytes, but many interfaces accept bytes or a text string (unicode on Python 2, str on Python 3). This function coerces text strings using IDNA encoding --- see encodings.idna.

Note that DNS is case insensitive but case preserving. This function doesn't normalize case, so you'll still need to do that whenever comparing the strings it returns.

ParametersdomainA domain name. If passed as a text string it will be idna encoded. (type: bytes or str)
Returnsbytes suitable for network transmission. (type: bytes)
Present SinceTwisted 20.3.0
def _isSubdomainOf(descendantName, ancestorName): (source)

Test whether descendantName is equal to or is a subdomain of ancestorName.

The names are compared case-insensitively.

The names are treated as byte strings containing one or more DNS labels separated by ..

descendantName is considered equal if its sequence of labels exactly matches the labels of ancestorName.

descendantName is considered a subdomain if its sequence of labels ends with the labels of ancestorName.

ParametersdescendantNameThe DNS subdomain name. (type: bytes)
ancestorNameThe DNS parent or ancestor domain name. (type: bytes)
ReturnsTrue if descendantName is equal to or if it is a subdomain of ancestorName. Otherwise returns False.
def str2time(s): (source)

Parse a string description of an interval into an integer number of seconds.

ParameterssAn interval definition constructed as an interval duration followed by an interval unit. An interval duration is a base ten representation of an integer. An interval unit is one of the following letters: S (seconds), M (minutes), H (hours), D (days), W (weeks), or Y (years). For example: "3S" indicates an interval of three seconds; "5D" indicates an interval of five days. Alternatively, s may be any non-string and it will be returned unmodified. (type: text string (bytes or str) for parsing; anything else for passthrough.)
Returnsan int giving the interval represented by the string s, or whatever s is if it is not a string.
def readPrecisely(file, l): (source)

Undocumented

def _responseFromMessage(responseConstructor, message, **kwargs): (source)

Generate a Message like instance suitable for use as the response to message.

The queries, id attributes will be copied from message and the answer flag will be set to True.

ParametersresponseConstructorA response message constructor with an initializer signature matching dns.Message.__init__. (type: callable)
messageA request message. (type: Message)
kwargsKeyword arguments which will be passed to the initialiser of the response message. (type: dict)
ReturnsA Message like response instance. (type: responseConstructor)
def _getDisplayableArguments(obj, alwaysShow, fieldNames): (source)

Inspect the function signature of obj's constructor, and get a list of which arguments should be displayed. This is a helper function for _compactRepr.

ParametersobjThe instance whose repr is being generated.
alwaysShowA list of field names which should always be shown.
fieldNamesA list of field attribute names which should be shown if they have non-default values.
ReturnsA list of displayable arguments.
def _compactRepr(obj, alwaysShow=None, flagNames=None, fieldNames=None, sectionNames=None): (source)

Return a str representation of obj which only shows fields with non-default values, flags which are True and sections which have been explicitly set.

ParametersobjThe instance whose repr is being generated.
alwaysShowA list of field names which should always be shown.
flagNamesA list of flag attribute names which should be shown if they are True.
fieldNamesA list of field attribute names which should be shown if they have non-default values.
sectionNamesA list of section attribute names which should be shown if they have been assigned a value.
ReturnsA str representation of obj.
API Documentation for Twisted, generated by pydoctor 21.2.0 at 2021-02-28 21:00:42.