Logo Search packages:      
Sourcecode: namebench version File versions  Download package

def libnamebench::mocks::MockNameServer::Query (   self,
  request,
  timeout 
)

Return a falsified DNS response.

Reimplemented from libnamebench::nameserver::NameServer.

Definition at line 65 of file mocks.py.

00065                                    :
    """Return a falsified DNS response."""
    question = str(request.question[0])
    if self.ip == BROKEN_IP:
      raise dns.query.BadResponse('This sucks.')

    if self.ip == NO_RESPONSE_IP:
      answer = self.FakeAnswer(request, no_answer=True)
    elif self.ip == GOOD_IP and  'www.google.com' in question:
      answer = self.FakeAnswer(request, no_answer=True)
    else:
      answer = self.FakeAnswer(request)

    if self.ip == GOOD_IP:
      time.sleep(0.001)
    elif self.ip == SLOW_IP:
      time.sleep(0.03)
    return answer
    return answer


Generated by  Doxygen 1.6.0   Back to index