コード例 #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
ファイル: hosts.py プロジェクト: ling-1/GETAiqiyiDanmu
 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)