Part of twisted.names.client View Source View In Hierarchy
Implements interfaces: twisted.internet.interfaces.IResolver
Method | __init__ | No summary |
Method | __getstate__ | Undocumented |
Method | __setstate__ | Undocumented |
Method | maybeParseConfig | Undocumented |
Method | parseConfig | Undocumented |
Method | pickServer | Return the address of a nameserver. |
Method | connectionMade | Called by associated dns.DNSProtocol
instances when they connect. |
Method | connectionLost | Called by associated dns.DNSProtocol
instances when they disconnect. |
Method | messageReceived | Undocumented |
Method | queryUDP | Make a number of DNS queries via UDP. |
Method | queryTCP | Make a number of DNS queries via TCP. |
Method | filterAnswers | Extract results from the given message. |
Method | lookupZone | Perform an AXFR request. This is quite different from usual DNS requests. See http://cr.yp.to/djbdns/axfr-notes.html for more information. |
Instance Variable | _waiting | A dict mapping tuple keys of query name/type/class to
Deferreds which will be called back with the result of those queries. This
is used to avoid issuing the same query more than once in parallel. This
is more efficient on the network and helps avoid a "birthday
paradox" attack by keeping the number of outstanding requests for a
particular query fixed at one instead of allowing the attacker to raise it
to an arbitrary number. |
Instance Variable | _reactor | A provider of IReactorTCP ,
IReactorUDP ,
and IReactorTime
which will be used to set up network resources and track timeouts. |
Method | _getProtocol | Undocumented |
Method | _connectedProtocol | Return a new DNSDatagramProtocol
bound to a randomly selected port number. |
Method | _query | Get a new DNSDatagramProtocol
instance from _connectedProtocol ,
issue a query to it using *args , and arrange for it to be
disconnected from its transport after the query completes. |
Method | _reissue | Undocumented |
Method | _lookup | Build a dns.Query for the
given parameters and dispatch it via UDP. |
Method | _timeoutZone | Undocumented |
Method | _cbLookupZone | Undocumented |
Inherited from ResolverBase:
Method | exceptionForCode | Convert a response code (one of the possible values of
dns.Message.rCode to an exception instance representing
it. |
Method | query | Undocumented |
Method | lookupAddress | |
Method | lookupIPV6Address | |
Method | lookupAddress6 | |
Method | lookupMailExchange | |
Method | lookupNameservers | |
Method | lookupCanonicalName | |
Method | lookupMailBox | |
Method | lookupMailGroup | |
Method | lookupMailRename | |
Method | lookupPointer | |
Method | lookupAuthority | |
Method | lookupNull | |
Method | lookupWellKnownServices | |
Method | lookupService | |
Method | lookupHostInfo | |
Method | lookupMailboxInfo | |
Method | lookupText | |
Method | lookupSenderPolicy | |
Method | lookupResponsibility | |
Method | lookupAFSDatabase | |
Method | lookupNamingAuthorityPointer | |
Method | lookupAllRecords | |
Method | getHostByName | |
Class Variable | _errormap | A dict mapping DNS protocol failure response codes to
exception classes which will be used to represent those failures. |
Method | _cbRecords | Undocumented |
dict
mapping tuple keys of query name/type/class to
Deferreds which will be called back with the result of those queries. This
is used to avoid issuing the same query more than once in parallel. This
is more efficient on the network and helps avoid a "birthday
paradox" attack by keeping the number of outstanding requests for a
particular query fixed at one instead of allowing the attacker to raise it
to an arbitrary number.
IReactorTCP
,
IReactorUDP
,
and IReactorTime
which will be used to set up network resources and track timeouts.
resolv.conf(5)
-format file given by resolv
as
well as those in the given servers
list. Servers are queried
in a round-robin fashion. If given, resolv
is periodically
checked for modification and re-parsed if it is noticed to have
changed.Parameters | servers | If not None, interpreted as a list of (host, port) pairs specifying
addresses of domain name servers to attempt to use for this lookup. Host
addresses should be in IPv4 dotted-quad form. If specified, overrides
resolv . (type: list of (str, int) or None ) |
resolv | Filename to read and parse as a resolver(5) configuration file. (type: str ) | |
timeout | Default number of seconds after which to reissue the query. When the last
timeout expires, the query is considered failed. (type: Sequence of int ) | |
reactor | A provider of IReactorTime ,
IReactorUDP ,
and IReactorTCP
which will be used to establish connections, listen for DNS datagrams, and
enforce timeouts. If not provided, the global reactor will be used. | |
Raises | ValueError | Raised if no nameserver addresses can be found. |
TODO: Weight servers for response time so faster ones can be preferred.
DNSDatagramProtocol
bound to a randomly selected port number.dns.DNSProtocol
instances when they connect.dns.DNSProtocol
instances when they disconnect.DNSDatagramProtocol
instance from _connectedProtocol
,
issue a query to it using *args
, and arrange for it to be
disconnected from its transport after the query completes.Parameters | *args | Positional arguments to be passed to DNSDatagramProtocol.query . |
Returns | A Deferred
which will be called back with the result of the query. |
Parameters | queries | The queries to make. (type: A list of dns.Query instances) |
timeout | Number of seconds after which to reissue the query. When the last timeout
expires, the query is considered failed. (type: Sequence of int ) | |
Returns | (type: Deferred @raise
twisted.internet.defer.TimeoutError : When the query times out.) |
Parameters | queries | The queries to make. (type: Any non-zero number of dns.Query instances) |
timeout | The number of seconds after which to fail. (type: int ) | |
Returns | (type: Deferred ) |
If the message was truncated, re-attempt the query over TCP and return a Deferred which will fire with the results of that query.
If the message's result code is not dns.OK
, return a
Failure indicating the type of error which occurred.
Otherwise, return a three-tuple of lists containing the results from the answers section, the authority section, and the additional section.
dns.Query
for the
given parameters and dispatch it via UDP.
If this query is already outstanding, it will not be re-issued. Instead, when the outstanding query receives a response, that response will be re-used for this query as well.
Returns | A Deferred
which fires with a three-tuple giving the answer, authority, and additional
sections of the response or with a Failure if the
response code is anything other than dns.OK . |