예제 #1
0
 def _identify_sanity_check(self, real_name):
     if (
         real_name.startswith(b"hellotelepresence")
         and real_name.endswith(b"telepresence.io")
     ):
         print("Sanity check: {}".format(real_name))
         return defer.fail(error.AuthoritativeDomainError("Sanity check"))
예제 #2
0
    def _lookup(self, name, cls, type, timeout):
        if cls != dns.IN:
            return defer.fail(error.DomainError())

        # Try to answer dynamically
        res = self.store.match(name, type)
        
        if res:
            # Return positive response
            # Be prepared to chase CNAMEs
            if res.payload:
            #    if query.type == res.type:
                answer = dns.RRHeader(
                    name=name,
                    type=res.type,
                    payload=res.to_record(),
                )
                answers = [answer]
                authority = []
                additional = []
                return defer.succeed((answers, authority, additional))
            # Return negative response
            else:
                return defer.fail(error.AuthoritativeDomainError())
        # Don't know
        else:
            return defer.fail(error.DomainError())
예제 #3
0
 def test_gotResolverErrorAuthoritativeDomainError(self):
     """
     L{server.DNSServerFactory.gotResolver} triggers a response message with
     an C{rCode} of L{dns.ENAME} if supplied with a
     L{error.AuthoritativeDomainError}.
     """
     self._assertMessageRcodeForError(
         error.AuthoritativeDomainError(), dns.ENAME)