예제 #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)