notifly/server.py
def handle_request(self, request, addr):
        """
        Take a parsed request (from self.unpack_from_wire)
        Perform checks on content and either process a NOTIFY or pass it to self.health_check
        trailling dots from origins are always removed
        when self.is_test (boolean) is True we won't send a UDP response but return binary response instead
        """
        if request is None:
            logging.error('no data received')
            return
        try:
            if isinstance(EVENT_QUEUE, mp.queues.Queue):
                event_queue = EVENT_QUEUE
        except NameError:
            if self.is_test:
                event_queue = mp.Queue()
            else:
                raise NoqQueueError("EVENT_QUEUE is not declared")
        logging.debug("test_mode: %s", str(self.is_test))
        if request.origin[-1] == '.':
            origin = request.origin[:-1]
        else:
            origin = request.origin
        if request.opcode_text == 'NOTIFY':
            logging.info("notify for %s", origin)
            event_queue.put((
                addr[0], 
                origin, 
                request.query_id
            ))
            response = dns.message.make_response(request.request)
            response.flags |= dns.flags.AA
            wire = response.to_wire(response)
            if not self.is_test:
                self.transport.sendto(wire, addr)
            else:
                self.event_queue = event_queue
                return event_queue
        # TODO: explicit DNSDIST health query check
        else:
            if not self.is_test:
                try:
                    self.health_check(request, addr)
                except Exception as health_err:
                    logging.error("health-check error: {}".format(health_err))
            else:
                event_queue.put((addr[0], origin, request.query_id))
                return event_queue

        Take a parsed request (from self.unpack_from_wire)
        Perform checks on content and either process a NOTIFY or pass it to self.health_check
        trailling dots from origins are always removed
        when self.is_test (boolean) is True we won't send a UDP response but return binary response instead
        
Take a parsed request (from self.unpack_from_wire)
Perform checks on content and either process a NOTIFY or pass it to self.health_check
trailling dots from origins are always removed
when self.is_test (boolean) is True we won't send a UDP response but return binary response instead
Take a parsed request ( from self . unpack_from_wire ) Perform checks on content and either process a NOTIFY or pass it to self . health_check trailling dots from origins are always removed when self . is_test ( boolean ) is True we won ' t send a UDP response but return binary response instead
def handle_request(self, request, addr):
        if request is None:
            logging.error('no data received')
            return
        try:
            if isinstance(EVENT_QUEUE, mp.queues.Queue):
                event_queue = EVENT_QUEUE
        except NameError:
            if self.is_test:
                event_queue = mp.Queue()
            else:
                raise NoqQueueError("EVENT_QUEUE is not declared")
        logging.debug("test_mode: %s", str(self.is_test))
        if request.origin[-1] == '.':
            origin = request.origin[:-1]
        else:
            origin = request.origin
        if request.opcode_text == 'NOTIFY':
            logging.info("notify for %s", origin)
            event_queue.put((
                addr[0], 
                origin, 
                request.query_id
            ))
            response = dns.message.make_response(request.request)
            response.flags |= dns.flags.AA
            wire = response.to_wire(response)
            if not self.is_test:
                self.transport.sendto(wire, addr)
            else:
                self.event_queue = event_queue
                return event_queue
        else:
            if not self.is_test:
                try:
                    self.health_check(request, addr)
                except Exception as health_err:
                    logging.error("health-check error: {}".format(health_err))
            else:
                event_queue.put((addr[0], origin, request.query_id))
                return event_queue
def handle_request ( self , request , addr ) : if request is None : logging . error ( 'no data received' ) return try : if isinstance ( EVENT_QUEUE , mp . queues . Queue ) : event_queue = EVENT_QUEUE except NameError : if self . is_test : event_queue = mp . Queue ( ) else : raise NoqQueueError ( "EVENT_QUEUE is not declared" ) logging . debug ( "test_mode: %s" , str ( self . is_test ) ) if request . origin [ - 1 ] == '.' : origin = request . origin [ : - 1 ] else : origin = request . origin if request . opcode_text == 'NOTIFY' : logging . info ( "notify for %s" , origin ) event_queue . put ( ( addr [ 0 ] , origin , request . query_id ) ) response = dns . message . make_response ( request . request ) response . flags |= dns . flags . AA wire = response . to_wire ( response ) if not self . is_test : self . transport . sendto ( wire , addr ) else : self . event_queue = event_queue return event_queue else : if not self . is_test : try : self . health_check ( request , addr ) except Exception as health_err : logging . error ( "health-check error: {}" . format ( health_err ) ) else : event_queue . put ( ( addr [ 0 ] , origin , request . query_id ) ) return event_queue
Take a parsed request (from self.unpack_from_wire)
Perform checks on content and either process a NOTIFY or pass it to self.health_check
trailling dots from origins are always removed
when self.is_test (boolean) is True we won't send a UDP response but return binary response instead
Take a parsed request ( from self . unpack_from_wire ) Perform checks on content and either process a NOTIFY or pass it to self . health_check trailling dots from origins are always removed when self . is_test ( boolean ) is True we won ' t send a UDP response but return binary response instead
"""
        Take a parsed request (from self.unpack_from_wire)
        Perform checks on content and either process a NOTIFY or pass it to self.health_check
        trailling dots from origins are always removed
        when self.is_test (boolean) is True we won't send a UDP response but return binary response instead
        """ # TODO: explicit DNSDIST health query check
self
request
addr