def lookupZone(self, name, timeout=10): name = dns.domainString(name) if self.soa[0].lower() == name.lower(): # Wee hee hee hooo yea default_ttl = max(self.soa[1].minimum, self.soa[1].expire) if self.soa[1].ttl is not None: soa_ttl = self.soa[1].ttl else: soa_ttl = default_ttl results = [ dns.RRHeader( self.soa[0], dns.SOA, dns.IN, soa_ttl, self.soa[1], auth=True ) ] for (k, r) in self.records.items(): for rec in r: if rec.ttl is not None: ttl = rec.ttl else: ttl = default_ttl if rec.TYPE != dns.SOA: results.append( dns.RRHeader( k, rec.TYPE, dns.IN, ttl, rec, auth=True ) ) results.append(results[0]) return defer.succeed((results, (), ())) return defer.fail(failure.Failure(dns.DomainError(name)))
def lookupIPV6Address(self, name, timeout=None): """ Read any IPv6 addresses from C{self.file} and return them as L{Record_AAAA} instances. """ name = dns.domainString(name) return self._respond(name, self._aaaaRecords(name))
def getHostByName(self, name, timeout=None, effort=10): name = dns.domainString(name) # XXX - respect timeout # XXX - this should do A and AAAA lookups, not ANY (see RFC 8482). # https://twistedmatrix.com/trac/ticket/9691 d = self.lookupAllRecords(name, timeout) d.addCallback(self._cbRecords, name, effort) return d
def __init__(self, primaryIP, domain): """ @param domain: The domain for which this will be the secondary authority. @type domain: L{bytes} or L{str} """ # Yep. Skip over FileAuthority.__init__. This is a hack until we have # a good composition-based API for the complicated DNS record lookup # logic we want to share. common.ResolverBase.__init__(self) self.primary = nativeString(primaryIP) self.domain = dns.domainString(domain)
def __init__( self, reactor, service, domain, factory, protocol='tcp', connectFuncName='connectTCP', connectFuncArgs=(), connectFuncKwArgs={}, defaultPort=None, ): """ @param domain: The domain to connect to. If passed as a text string, it will be encoded using C{idna} encoding. @type domain: L{bytes} or L{str} @param defaultPort: Optional default port number to be used when SRV lookup fails and the service name is unknown. This should be the port number associated with the service name as defined by the IANA registry. @type defaultPort: L{int} """ self.reactor = reactor self.service = service self.domain = None if domain is None else dns.domainString(domain) self.factory = factory self.protocol = protocol self.connectFuncName = connectFuncName self.connectFuncArgs = connectFuncArgs self.connectFuncKwArgs = connectFuncKwArgs self._defaultPort = defaultPort self.connector = None self.servers = None # list of servers already used in this round: self.orderedServers = None
def lookupMailExchange(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.MX, timeout)
def lookupNameservers(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.NS, timeout)
def lookupIPV6Address(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.AAAA, timeout)
def lookupAddress6(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.A6, timeout)
def lookupAllRecords(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.ALL_RECORDS, timeout)
def lookupAuthority(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.SOA, timeout)
def lookupNull(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.NULL, timeout)
def lookupHostInfo(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.HINFO, timeout)
def lookupResponsibility(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.RP, timeout)
def lookupWellKnownServices(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.WKS, timeout)
def lookupSenderPolicy(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.SPF, timeout)
def lookupText(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.TXT, timeout)
def lookupMailboxInfo(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.MINFO, timeout)
def lookupCanonicalName(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.CNAME, timeout)
def lookupPointer(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.PTR, timeout)
def lookupAFSDatabase(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.AFSDB, timeout)
def lookupService(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.SRV, timeout)
def lookupZone(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.AXFR, timeout)
def lookupNamingAuthorityPointer(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.NAPTR, timeout)
def wrapRecordFunc(name, *arg, **kw): return (dns.domainString(name), type(*arg, **kw))
def lookupMailRename(self, name, timeout=None): return self._lookup(dns.domainString(name), dns.IN, dns.MR, timeout)