class documentation

DNS protocol over UDP.

Method datagramReceived Read a datagram, extract the message in it and trigger the associated Deferred.
Method query Send out a message with the given queries.
Method removeResend Mark message ID as no longer having duplication suppression.
Method startListening Undocumented
Method startProtocol Upon start, reset internal state.
Method stopProtocol Stop protocol: reset state variables.
Method writeMessage Send a message holding DNS queries.
Instance Variable liveMessages a dictionary mapping message-ID to the Deferred that will fire when it completes, and the pending timeout that will cause it to fail, for all outstanding queries that have not yet received a response.
Instance Variable resends Undocumented
Instance Variable transport Undocumented
Method _clearFailed Clean the Deferred after a timeout.
Instance Variable _addressValidation a map of {message-id: expected source-address}; when issuing a DNS query over UDP, the response to that query ought to come from the same network address (host and port) that we issued it to. If it doesn't, we discard it...

Inherited from DNSMixin:

Method __init__ Undocumented
Method callLater Wrapper around reactor.callLater, mainly for test purpose.
Method pickID Return a unique ID for queries.
Instance Variable controller Undocumented
Instance Variable id Undocumented
Method _handleResponse Handle an incoming DNS message.
Method _query Send out a message with the given queries.
Instance Variable _reactor A IReactorTime and IReactorUDP provider which will be used to issue DNS queries and manage request timeouts.

Inherited from DatagramProtocol (via DNSMixin):

Method connectionRefused Called due to error from write in connected mode.
Method logPrefix Return a prefix matching the class name, to identify log messages related to this protocol instance.

Inherited from AbstractDatagramProtocol (via DNSMixin, DatagramProtocol):

Method __getstate__ Undocumented
Method doStart Make sure startProtocol is called.
Method doStop Make sure stopProtocol is called.
Method makeConnection Make a connection to a transport and a server.
Class Variable noisy Undocumented
Instance Variable numPorts Undocumented
def datagramReceived(self, data: bytes, addr: tuple[str, int]): (source)

Read a datagram, extract the message in it and trigger the associated Deferred.

def query(self, address: tuple[str, int], queries: list[Query], timeout: float = 10, id: int | None = None) -> Deferred[Message]: (source)

Send out a message with the given queries.

Parameters
address:tuple[str, int]The address to which to send the query
queries:list[Query]The queries to transmit
timeout:floatUndocumented
id:int | NoneUndocumented
Returns
Deferred[Message]a Deferred which fires with the response when it arrives.
def removeResend(self, id: int): (source)

Mark message ID as no longer having duplication suppression.

def startListening(self): (source)

Undocumented

def startProtocol(self): (source)

Upon start, reset internal state.

def stopProtocol(self): (source)

Stop protocol: reset state variables.

def writeMessage(self, message: Message, address: tuple[str, int]): (source)

Send a message holding DNS queries.

liveMessages: dict = (source)

a dictionary mapping message-ID to the Deferred that will fire when it completes, and the pending timeout that will cause it to fail, for all outstanding queries that have not yet received a response.

Undocumented

def _clearFailed(self, deferred: Deferred[Message], id: int): (source)

Clean the Deferred after a timeout.

_addressValidation: dict[int, tuple[str, int]] = (source)

a map of {message-id: expected source-address}; when issuing a DNS query over UDP, the response to that query ought to come from the same network address (host and port) that we issued it to. If it doesn't, we discard it. The keys in this dictionary ought to match those in DNSMixin.liveMessages.