Exemplo n.º 1
0
  @Override
  protected String fetchResource(Context context, OperationLog log, int indent) {

    Client c = new Client();
    DNSMessage msg = c.query(new Question(mFqdn, mType, mClass));
    Record aw = msg.getAnswers()[0];
    TXT txt = (TXT) aw.getPayload();
    return txt.getText().toLowerCase();
  }
Exemplo n.º 2
0
 @IntegrationTest
 public static void testTcpAnswer() throws IOException {
   DNSClient client = new DNSClient(new LRUCache(1024));
   client.setAskForDnssec(true);
   client.setDisableResultFilter(true);
   DNSMessage result = client.query("www-nsec.example.com", Record.TYPE.A);
   assertNotNull(result);
   assertTrue(result.toArray().length > 512);
 }
  public DNSMessage query(DNSMessage message, InetAddress address, int port) throws IOException {
    DNSMessage response;
    try {
      response = super.query(message, address, port);
    } catch (IOException e) {
      failedQueries.incrementAndGet();
      throw e;
    }

    successfulQueries.incrementAndGet();
    responseSize.addAndGet(response.toArray().length);

    return response;
  }
Exemplo n.º 4
0
 @IntegrationTest
 public static NSID testNsidLRoot() {
   DNSClient client =
       new DNSClient(null) {
         @Override
         protected Builder newQuestion(Builder message) {
           message.getEdnsBuilder().addEdnsOption(NSID.REQUEST);
           return super.newQuestion(message);
         }
       };
   DNSMessage response = null;
   Question q = new Question("de", TYPE.NS);
   for (InetAddress lRoot : IterativeDNSClient.getRootServer('l')) {
     try {
       response = client.query(q, lRoot);
     } catch (IOException e) {
       continue;
     }
     break;
   }
   NSID nsid = response.getEdns().getEdnsOption(OptionCode.NSID);
   assertNotNull(nsid);
   return nsid;
 }