private static DnsRecord toDnsRecord(DNSRecord rec) { DnsRecord retVal = new DnsRecord(); retVal.setData(rec.getData()); retVal.setDclass(rec.getDclass()); retVal.setName(rec.getName()); retVal.setTtl(rec.getTtl()); retVal.setType(rec.getType()); return retVal; }
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())); }