コード例 #1
0
ファイル: DNS.py プロジェクト: peterbrightwell/nmos-testing
 def resolve(self, request, handler):
     qtype = request.q.qtype
     qname = str(request.q.qname)
     try:
         self.watching[qtype][qname].set()
     except (KeyError, AttributeError):
         pass
     return ZoneResolver.resolve(self, request, handler)
コード例 #2
0
    def resolve(self, request, handler):
        reply = ZoneResolver.resolve(self, request, handler)

        if reply.header.rcode == RCODE.NXDOMAIN and self.upstream:
            try:
                if handler.protocol == 'udp':
                    proxy_r = request.send(self.upstream, self.upstream_port,
                                           timeout=self.timeout)
                else:
                    proxy_r = request.send(self.upstream, self.upstream_port,
                                           tcp=True, timeout=self.timeout)
                reply = DNSRecord.parse(proxy_r)
            except socket.timeout:
                reply.header.rcode = RCODE.SERVFAIL

        return reply