(self,request,handler)
return reply
Respond to DNS request - parameters are request packet & handler.
            Method is expected to return DNS response
Respond to DNS request - parameters are request packet & handler.
            Method is expected to return DNS response
Respond to DNS request - parameters are request packet & handler . Method is expected to return DNS response
def resolve(self,request,handler):
        """
            Respond to DNS request - parameters are request packet & handler.
            Method is expected to return DNS response
        """
        reply = request.reply()
        qname = request.q.qname
        qtype = QTYPE[request.q.qtype]
        for name,rtype,rr in self.zone:
            # Check if label & type match
            if getattr(qname,self.eq)(name) and (qtype == rtype or 
                                                 qtype == 'ANY' or 
                                                 rtype == 'CNAME'):
                # If we have a glob match fix reply label
                if self.glob:
                    a = copy.copy(rr)
                    a.rname = qname
                    reply.add_answer(a)
                else:
                    reply.add_answer(rr)
                # Check for A/AAAA records associated with reply and
                # add in additional section
                if rtype in ['CNAME','NS','MX','PTR']:
                    for a_name,a_rtype,a_rr in self.zone:
                        if a_name == rr.rdata.label and a_rtype in ['A','AAAA']:
                            reply.add_ar(a_rr)
        if not reply.rr:
            reply.header.rcode = RCODE.NXDOMAIN
        return reply
def resolve ( self , request , handler ) : reply = request . reply ( ) qname = request . q . qname qtype = QTYPE [ request . q . qtype ] for name , rtype , rr in self . zone : # Check if label & type match if getattr ( qname , self . eq ) ( name ) and ( qtype == rtype or qtype == 'ANY' or rtype == 'CNAME' ) : # If we have a glob match fix reply label if self . glob : a = copy . copy ( rr ) a . rname = qname reply . add_answer ( a ) else : reply . add_answer ( rr ) # Check for A/AAAA records associated with reply and # add in additional section if rtype in [ 'CNAME' , 'NS' , 'MX' , 'PTR' ] : for a_name , a_rtype , a_rr in self . zone : if a_name == rr . rdata . label and a_rtype in [ 'A' , 'AAAA' ] : reply . add_ar ( a_rr ) if not reply . rr : reply . header . rcode = RCODE . NXDOMAIN return reply