class documentation

class Resolver(common.ResolverBase): (source)

View In Hierarchy

Resolver implements recursive lookup starting from a specified list of root servers.
Method __init__ No summary
Instance Variable hints See hints parameter of __init__
Method _discover​Authority Issue a query to a server and follow a delegation if necessary.
Method _discovered​Authority Interpret the response to a query, checking for error codes and following delegations if necessary.
Method _lookup Implement name lookup by recursively discovering the authoritative server for the name and then asking it, starting at one of the servers in self.hints.
Method _query Issue one query and return a Deferred which fires with its response.
Method _roots Return a list of two-tuples representing the addresses of the root servers, as defined by self.hints.
Instance Variable _maximum​Queries See maximumQueries parameter of __init__
Instance Variable _reactor See reactor parameter of __init__
Instance Variable _resolver​Factory See resolverFactory parameter of __init__

Inherited from ResolverBase:

Method exception​For​Code Convert a response code (one of the possible values of dns.Message.rCode to an exception instance representing it.
Method get​Host​By​Name Resolve the domain name name into an IP address.
Method lookup​Address Perform an A record lookup.
Method lookup​Address6 Perform an A6 record lookup.
Method lookup​AFSDatabase Perform an AFSDB record lookup.
Method lookup​All​Records Perform an ALL_RECORD lookup.
Method lookup​Authority Perform an SOA record lookup.
Method lookup​Canonical​Name Perform a CNAME record lookup.
Method lookup​Host​Info Perform a HINFO record lookup.
Method lookup​IPV6​Address Perform an AAAA record lookup.
Method lookup​Mail​Box Perform an MB record lookup.
Method lookup​Mailbox​Info Perform an MINFO record lookup.
Method lookup​Mail​Exchange Perform an MX record lookup.
Method lookup​Mail​Group Perform an MG record lookup.
Method lookup​Mail​Rename Perform an MR record lookup.
Method lookup​Nameservers Perform an NS record lookup.
Method lookup​Naming​Authority​Pointer Perform a NAPTR record lookup.
Method lookup​Null Perform a NULL record lookup.
Method lookup​Pointer Perform a PTR record lookup.
Method lookup​Responsibility Perform an RP record lookup.
Method lookup​Sender​Policy Perform a SPF record lookup.
Method lookup​Service Perform an SRV record lookup.
Method lookup​Text Perform a TXT record lookup.
Method lookup​Well​Known​Services Perform a WKS record lookup.
Method lookup​Zone Perform an AXFR record lookup.
Method query Dispatch query to the method which can handle its type.
Instance Variable type​To​Method Undocumented
Method _cb​Records Undocumented
Class Variable _errormap A dict mapping DNS protocol failure response codes to exception classes which will be used to represent those failures.
Class Variable _log Undocumented
def __init__(self, hints, maximumQueries=10, reactor=None, resolverFactory=None): (source)
Parameters
hints:list of strA list of str giving the dotted quad representation of IP addresses of root servers at which to begin resolving names.
maximum​Queries:intAn optional int giving the maximum number of queries which will be attempted to resolve a single name.
reactor:IReactorTime and IReactorUDP providerAn optional IReactorTime and IReactorUDP provider to use to bind UDP ports and manage timeouts.
resolver​Factory:callableAn optional callable which accepts reactor and servers arguments and returns an instance that provides a queryUDP method. Defaults to twisted.names.client.Resolver.
hints = (source)
See hints parameter of __init__
def _discoverAuthority(self, query, servers, timeout, queriesLeft): (source)
Issue a query to a server and follow a delegation if necessary.
Parameters
query:dns.QueryThe query to issue.
servers:list of tuple of str and intThe servers which might have an answer for this query.
timeoutA tuple of int giving the timeout to use for this query.
queries​LeftA int giving the number of queries which may yet be attempted to answer this query before the attempt will be abandoned.
Returns
A Deferred which fires with a three-tuple of lists of twisted.names.dns.RRHeader giving the response, or with a Failure if there is a timeout or response error.
def _discoveredAuthority(self, response, query, timeout, queriesLeft): (source)
Interpret the response to a query, checking for error codes and following delegations if necessary.
Parameters
response:MessageThe Message received in response to issuing query.
query:dns.Query.The dns.Query which was issued.
timeout:tuple of intThe timeout to use if another query is indicated by this response.
queries​LeftA int giving the number of queries which may yet be attempted to answer this query before the attempt will be abandoned.
Returns
A Failure indicating a response error, a three-tuple of lists of twisted.names.dns.RRHeader giving the response to query or a Deferred which will fire with one of those.
def _lookup(self, name, cls, type, timeout): (source)
Implement name lookup by recursively discovering the authoritative server for the name and then asking it, starting at one of the servers in self.hints.
def _query(self, query, servers, timeout, filter): (source)
Issue one query and return a Deferred which fires with its response.
Parameters
query:dns.QueryThe query to issue.
servers:list of tuple of str and intThe servers which might have an answer for this query.
timeout:tuple of intA timeout on how long to wait for the response.
filter:boolA flag indicating whether to filter the results. If True, the returned Deferred will fire with a three-tuple of lists of twisted.names.dns.RRHeader (like the return value of the lookup* methods of IResolver. IF False, the result will be a Message instance.
Returns
DeferredA Deferred which fires with the response or a timeout error.
def _roots(self): (source)
Return a list of two-tuples representing the addresses of the root servers, as defined by self.hints.
_maximumQueries = (source)
See maximumQueries parameter of __init__
_reactor = (source)
See reactor parameter of __init__
_resolverFactory = (source)
See resolverFactory parameter of __init__