class documentation
class DNSMixin: (source)
Known subclasses: twisted.names.dns.DNSDatagramProtocol, twisted.names.dns.DNSProtocol
Constructor: DNSMixin(controller, reactor)
DNS protocol mixin shared by UDP and TCP implementations.
| Method | __init__ |
Undocumented |
| Method | call |
Wrapper around reactor.callLater, mainly for test purpose. |
| Method | pick |
Return a unique ID for queries. |
| Class Variable | live |
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 | controller |
Undocumented |
| Instance Variable | id |
Undocumented |
| Method | _clear |
Clean the Deferred after a timeout. |
| Method | _handle |
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. |
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.
def _handleResponse(self, data:
bytes, messageSource: object, notifyController: Callable[ [ Message], None], validate: Callable[ [ Message], bool] = lambda m: True):
(source)
¶
Handle an incoming DNS message.
| Parameters | |
data:bytes | The bytes of the message (just the payload; any length prefix removed) |
messageobject | The source of the message (the address from which it was received) |
notifyCallable[ | The callable invoked when a message is not a response to a currently-pending query response. |
validate:Callable[ | The callable invoked to ensure that a message is a valid reply; the message is discarded if this returns False. |
def _query(self, queries:
list[ Query], timeout: float, id: int, writeMessage: Callable[ [ Message], None]) -> Deferred[ Message]:
(source)
¶
Send out a message with the given queries.
| Parameters | |
queries:list[ | The queries to transmit |
timeout:float | How long to wait before giving up |
id:int | Unique key for this request |
writeCallable[ | One-parameter callback which writes the message |
| Returns | |
Deferred[ | a Deferred which will be fired with the result of the query, or errbacked with any errors that could happen (exceptions during writing of the query, timeout errors, ...). |
A IReactorTime and IReactorUDP provider which will be used to issue DNS queries and manage request timeouts.