Search in sources :

Example 86 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class SignZone method getNameList.

/**
 * Load a list of DNS names from a file.
 *
 * @param nameListFile
 *          the path of a file containing a bare list of DNS names.
 * @return a list of {@link org.xbill.DNS.Name} objects.
 */
private static List<Name> getNameList(File nameListFile) throws IOException {
    BufferedReader br = new BufferedReader(new FileReader(nameListFile));
    List<Name> res = new ArrayList<Name>();
    String line = null;
    while ((line = br.readLine()) != null) {
        try {
            Name n = Name.fromString(line);
            // root.
            if (!n.isAbsolute())
                n = Name.concatenate(n, Name.root);
            res.add(n);
        } catch (TextParseException e) {
            log.severe("DNS Name parsing error:" + e);
        }
    }
    br.close();
    if (res.size() == 0)
        return null;
    return res;
}
Also used : BufferedReader(java.io.BufferedReader) ArrayList(java.util.ArrayList) FileReader(java.io.FileReader) Name(org.xbill.DNS.Name) TextParseException(org.xbill.DNS.TextParseException)

Example 87 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_subdomain_equal.

public void test_subdomain_equal() throws TextParseException {
    Name dom = new Name("the.domain");
    Name sub = new Name("the.domain");
    assertTrue(sub.subdomain(dom));
    assertTrue(dom.subdomain(sub));
}
Also used : Name(org.xbill.DNS.Name)

Example 88 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_fromDNAME_toobig.

public void test_fromDNAME_toobig() throws NameTooLongException, TextParseException {
    Name own = new Name("the.owner.");
    Name alias = new Name("the.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb.ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc.");
    DNAMERecord dnr = new DNAMERecord(own, DClass.IN, 0xABCD, alias);
    Name sub = new Name("ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd.the.owner.");
    try {
        sub.fromDNAME(dnr);
        fail("NameTooLongException not thrown");
    } catch (NameTooLongException e) {
    }
}
Also used : Name(org.xbill.DNS.Name)

Example 89 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_toString_at.

public void test_toString_at() throws TextParseException {
    Name n = new Name("@", null);
    assertEquals("@", n.toString());
}
Also used : Name(org.xbill.DNS.Name)

Example 90 with Name

use of org.xbill.DNS.Name in project dim by 1and1.

the class NameTest method test_init_from_name_root.

public void test_init_from_name_root() throws TextParseException {
    Name n = new Name("A.B.c.d.");
    Name o = new Name(n, 4);
    assertEquals(Name.root, o);
}
Also used : Name(org.xbill.DNS.Name)

Aggregations

Name (org.xbill.DNS.Name)101 Record (org.xbill.DNS.Record)36 Message (org.xbill.DNS.Message)18 SRVRecord (org.xbill.DNS.SRVRecord)18 IOException (java.io.IOException)11 UnknownHostException (java.net.UnknownHostException)11 ArrayList (java.util.ArrayList)11 Lookup (org.xbill.DNS.Lookup)10 ARecord (org.xbill.DNS.ARecord)9 ExtendedResolver (org.xbill.DNS.ExtendedResolver)9 SimpleResolver (org.xbill.DNS.SimpleResolver)9 RRset (org.xbill.DNS.RRset)8 NSRecord (org.xbill.DNS.NSRecord)7 TXTRecord (org.xbill.DNS.TXTRecord)7 HashSet (java.util.HashSet)6 Iterator (java.util.Iterator)6 CNAMERecord (org.xbill.DNS.CNAMERecord)6 TextParseException (org.xbill.DNS.TextParseException)6 Update (org.xbill.DNS.Update)6 ZoneTransferIn (org.xbill.DNS.ZoneTransferIn)6