Search in sources :

Example 6 with LRUCache

use of org.minidns.cache.LRUCache in project minidns by MiniDNS.

the class DNSSECTest method testCloudFlare.

@IntegrationTest
public static void testCloudFlare() throws IOException {
    DNSSECClient client = new DNSSECClient(new LRUCache(1024));
    assertAuthentic(client.queryDnssec("www.cloudflare-dnssec-auth.com", Record.TYPE.A));
}
Also used : LRUCache(org.minidns.cache.LRUCache) DNSSECClient(org.minidns.dnssec.DNSSECClient)

Example 7 with LRUCache

use of org.minidns.cache.LRUCache in project minidns by MiniDNS.

the class IntegrationTestTools method getClient.

public static DNSSECClient getClient(CacheConfig cacheConfig) {
    DNSCache cache;
    switch(cacheConfig) {
        case without:
            cache = null;
            break;
        case normal:
            cache = new LRUCache();
            break;
        case extended:
            cache = new ExtendedLRUCache();
            break;
        case full:
            cache = new FullLRUCache();
            break;
        default:
            throw new IllegalStateException();
    }
    DNSSECClient client = new DNSSECClient(cache);
    client.setDataSource(new NetworkDataSourceWithAccounting());
    return client;
}
Also used : ExtendedLRUCache(org.minidns.cache.ExtendedLRUCache) FullLRUCache(org.minidns.cache.FullLRUCache) ExtendedLRUCache(org.minidns.cache.ExtendedLRUCache) LRUCache(org.minidns.cache.LRUCache) FullLRUCache(org.minidns.cache.FullLRUCache) DNSSECClient(org.minidns.dnssec.DNSSECClient) DNSCache(org.minidns.DNSCache) NetworkDataSourceWithAccounting(org.minidns.source.NetworkDataSourceWithAccounting)

Example 8 with LRUCache

use of org.minidns.cache.LRUCache in project minidns by MiniDNS.

the class CoreTest method testExampleCom.

@IntegrationTest
public static void testExampleCom() throws IOException {
    DNSClient client = new DNSClient(new LRUCache(1024));
    // stable?
    String exampleIp4 = "93.184.216.34";
    // stable?
    String exampleIp6 = "2606:2800:220:1:248:1893:25c8:1946";
    assertEquals(client.query("example.com", Record.TYPE.A).answerSection.get(0).payloadData.toString(), exampleIp4);
    assertEquals(client.query("www.example.com", Record.TYPE.A).answerSection.get(0).payloadData.toString(), exampleIp4);
    assertEquals(client.query("example.com", Record.TYPE.AAAA).answerSection.get(0).payloadData.toString(), exampleIp6);
    assertEquals(client.query("www.example.com", Record.TYPE.AAAA).answerSection.get(0).payloadData.toString(), exampleIp6);
    DNSMessage nsRecords = client.query("example.com", Record.TYPE.NS);
    List<String> values = new ArrayList<>();
    for (Record<? extends Data> record : nsRecords.answerSection) {
        values.add(record.payloadData.toString());
    }
    Collections.sort(values);
    assertEquals(values.get(0), "a.iana-servers.net.");
    assertEquals(values.get(1), "b.iana-servers.net.");
}
Also used : DNSClient(org.minidns.DNSClient) LRUCache(org.minidns.cache.LRUCache) ArrayList(java.util.ArrayList) DNSMessage(org.minidns.dnsmessage.DNSMessage)

Example 9 with LRUCache

use of org.minidns.cache.LRUCache in project minidns by MiniDNS.

the class CoreTest method testTcpAnswer.

@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);
}
Also used : DNSClient(org.minidns.DNSClient) LRUCache(org.minidns.cache.LRUCache) DNSMessage(org.minidns.dnsmessage.DNSMessage)

Example 10 with LRUCache

use of org.minidns.cache.LRUCache in project minidns by MiniDNS.

the class DNSSECTest method testUniDueSigOk.

@IntegrationTest
public static void testUniDueSigOk() throws IOException {
    DNSSECClient client = new DNSSECClient(new LRUCache(1024));
    assertAuthentic(client.queryDnssec("sigok.verteiltesysteme.net", Record.TYPE.A));
}
Also used : LRUCache(org.minidns.cache.LRUCache) DNSSECClient(org.minidns.dnssec.DNSSECClient)

Aggregations

LRUCache (org.minidns.cache.LRUCache)12 DNSMessage (org.minidns.dnsmessage.DNSMessage)6 Test (org.junit.Test)5 DNSSECClient (org.minidns.dnssec.DNSSECClient)5 DNSClient (org.minidns.DNSClient)2 Data (org.minidns.record.Data)2 Record (org.minidns.record.Record)2 InetAddress (java.net.InetAddress)1 ArrayList (java.util.ArrayList)1 Ignore (org.junit.Ignore)1 DNSCache (org.minidns.DNSCache)1 ExtendedLRUCache (org.minidns.cache.ExtendedLRUCache)1 FullLRUCache (org.minidns.cache.FullLRUCache)1 DNSDataSource (org.minidns.source.DNSDataSource)1 NetworkDataSourceWithAccounting (org.minidns.source.NetworkDataSourceWithAccounting)1