class documentation

class Resolver(common.ResolverBase): (source)

View In Hierarchy

A resolver that services hosts(5) format files.
Method __init__ Undocumented
Method lookup​Address Read any IPv4 addresses from self.file and return them as Record_A instances.
Method lookup​IPV6​Address Read any IPv6 addresses from self.file and return them as Record_AAAA instances.
Instance Variable file Undocumented
Instance Variable ttl Undocumented
Method _aaaa​Records Return a tuple of dns.RRHeader instances for all of the IPv6 addresses in the hosts file.
Method _a​Records Return a tuple of dns.RRHeader instances for all of the IPv4 addresses in the hosts file.
Method _respond Generate a response for the given name containing the given result records, or a failure if there are no result records.

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​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​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
Method _lookup 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, file=b'/etc/hosts', ttl=60*60): (source)
def lookupAddress(self, name, timeout=None): (source)
Read any IPv4 addresses from self.file and return them as Record_A instances.
def lookupIPV6Address(self, name, timeout=None): (source)
Read any IPv6 addresses from self.file and return them as Record_AAAA instances.
file = (source)

Undocumented

Undocumented

def _aaaaRecords(self, name): (source)
Return a tuple of dns.RRHeader instances for all of the IPv6 addresses in the hosts file.
def _aRecords(self, name): (source)
Return a tuple of dns.RRHeader instances for all of the IPv4 addresses in the hosts file.
def _respond(self, name, records): (source)
Generate a response for the given name containing the given result records, or a failure if there are no result records.
Parameters
name:strThe DNS name the response is for.
recordsA tuple of dns.RRHeader instances giving the results that will go into the response.
Returns
A Deferred which will fire with a three-tuple of result records, authority records, and additional records, or which will fail with dns.DomainError if there are no result records.