示例#1
0
 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)))
示例#2
0
 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))
示例#3
0
 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
示例#4
0
 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)
示例#5
0
    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
示例#6
0
 def lookupMailExchange(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.MX, timeout)
示例#7
0
 def lookupNameservers(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.NS, timeout)
示例#8
0
 def lookupIPV6Address(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.AAAA, timeout)
示例#9
0
 def lookupAddress6(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.A6, timeout)
示例#10
0
 def lookupAllRecords(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.ALL_RECORDS, timeout)
示例#11
0
 def lookupAuthority(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.SOA, timeout)
示例#12
0
 def lookupNull(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.NULL, timeout)
示例#13
0
 def lookupHostInfo(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.HINFO, timeout)
示例#14
0
 def lookupResponsibility(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.RP, timeout)
示例#15
0
 def lookupWellKnownServices(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.WKS, timeout)
示例#16
0
 def lookupSenderPolicy(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.SPF, timeout)
示例#17
0
 def lookupText(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.TXT, timeout)
示例#18
0
 def lookupMailboxInfo(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.MINFO, timeout)
示例#19
0
 def lookupCanonicalName(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.CNAME, timeout)
示例#20
0
 def lookupPointer(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.PTR, timeout)
示例#21
0
 def lookupAFSDatabase(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.AFSDB, timeout)
示例#22
0
 def lookupService(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.SRV, timeout)
示例#23
0
 def lookupZone(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.AXFR, timeout)
示例#24
0
 def lookupNamingAuthorityPointer(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.NAPTR, timeout)
示例#25
0
 def wrapRecordFunc(name, *arg, **kw):
     return (dns.domainString(name), type(*arg, **kw))
示例#26
0
 def lookupMailRename(self, name, timeout=None):
     return self._lookup(dns.domainString(name), dns.IN, dns.MR, timeout)