public static DnsRecord createNSRecord(String name, String target) throws Exception { if (!name.endsWith(".")) name = name + "."; if (!target.endsWith(".")) target = target + "."; NSRecord rec = new NSRecord(Name.fromString(name), DClass.IN, 86400L, Name.fromString(target)); return toDnsRecord(DNSRecord.fromWire(rec.toWireCanonical())); }