private String iteratorToString(Iterator it) { StringBuffer sb = new StringBuffer(); while (it.hasNext()) { Record rr = (Record) it.next(); sb.append("["); sb.append(rr.rdataToString()); sb.append("]"); if (it.hasNext()) sb.append(" "); } return sb.toString(); }
private String iteratorToString(Iterator it) { StringBuffer sb = new StringBuffer(); while (it.hasNext()) { Record rr = (Record) it.next(); sb.append("["); sb.append(rr.rdataToString()); sb.append("]"); if (it.hasNext()) sb.append(" "); } return sb.toString(); }
private String iteratorToString(Iterator it) { StringBuffer sb = new StringBuffer(); while (it.hasNext()) { Record rr = (Record) it.next(); sb.append("["); sb.append(rr.rdataToString()); sb.append("]"); if (it.hasNext()) sb.append(" "); } return sb.toString(); }
private String iteratorToString(Iterator it) { StringBuffer sb = new StringBuffer(); while (it.hasNext()) { Record rr = (Record) it.next(); sb.append("["); sb.append(rr.rdataToString()); sb.append("]"); if (it.hasNext()) sb.append(" "); } return sb.toString(); }
private List<InetAddress> resolve(String key) throws UnknownHostException { List<InetAddress> result = new ArrayList<InetAddress>(); List<Record> list = m_records.get(key); if (list != null) for (Record r : list) if (r.getType() == Type.A) result.add(InetAddress.getByName(r.rdataToString())); else if ((r.getType() == Type.CNAME)) { List<Record> cnamelist = m_records.get(r.rdataToString()); for (Record r1 : cnamelist) { result.add(InetAddress.getByName(r1.rdataToString())); } } return result; } }
public static String toString(Record record) { if (record == null) { return null; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append(record.getName()); stringBuilder.append(" "); stringBuilder.append(record.getTTL()); stringBuilder.append(" "); stringBuilder.append(DClass.string(record.getDClass())); stringBuilder.append(" "); stringBuilder.append(Type.string(record.getType())); String rdata = record.rdataToString(); if (!rdata.equals("")) { stringBuilder.append(" "); stringBuilder.append(rdata); } return stringBuilder.toString(); }
System.exit(1); server = ns[0].rdataToString(); System.out.println("sending to server '" + server + "'");
rec.getName(), rec.rdataToString(), expression); m = p.matcher(rec.getName().toString() + " " + rec.rdataToString()); if (m.matches()) { matches = true;
System.exit(1); server = ns[0].rdataToString(); System.out.println("sending to server '" + server + "'");
System.exit(1); server = ns[0].rdataToString(); System.out.println("sending to server '" + server + "'");
Record[] newResults = new Lookup(result.host(), Type.A, DClass.IN).run(); if (newResults != null && newResults.length > 0) { builder.setHost(newResults[0].rdataToString()); } else { throw new IllegalArgumentException("Unable to resolve auth service host " + authServiceHost + " -> " + result.host() + " -> ???");
Record[] newResults = new Lookup(result.host(), Type.A, DClass.IN).run(); if (newResults != null && newResults.length > 0) { builder.setHost(newResults[0].rdataToString()); } else { throw new IllegalArgumentException("Unable to resolve audit service host " + auditServiceHost + " -> " + result.host() + " -> ???");
return fallback(hostIp); } else { String reverseAddress = answers[0].rdataToString(); return reverseAddress.endsWith(".") ? reverseAddress.substring(0, reverseAddress.length() - 1) : reverseAddress;
return fallback(hostIp); } else { String reverseAddress = answers[0].rdataToString(); return reverseAddress.endsWith(".") ? reverseAddress.substring(0, reverseAddress.length() - 1) : reverseAddress;
for (Record answer : answers) { if (answer.getType() == Type.A) { resolution = answer.rdataToString(); break;
public DBRecord(Record record, Name origin, long zoneTTL) { this.name = record.getName().relativize(origin).toString(); this.type = Type.string(record.getType()); this.dclass = DClass.string(record.getDClass()); this.content = record.rdataToString(); if(record.getTTL() == zoneTTL){ this.ttl = null; }else{ this.ttl = record.getTTL(); } }
public static String reverseDns(String hostIp) throws IOException { Resolver res = new ExtendedResolver(); // set the timeout, defaults to 200 milliseconds int timeout = ConfigurationManager.getIntProperty("solr-statistics", "resolver.timeout", 200); res.setTimeout(0, timeout); Name name = ReverseMap.fromAddress(hostIp); int type = Type.PTR; int dclass = DClass.IN; Record rec = Record.newRecord(name, type, dclass); Message query = Message.newQuery(rec); Message response = res.send(query); Record[] answers = response.getSectionArray(Section.ANSWER); if (answers.length == 0) { return hostIp; } else { return answers[0].rdataToString(); } } }
/** * Resolve an IP address to a host name. * * @param hostIp dotted decimal IPv4 address. * @return name if resolved, or the address. * @throws IOException from infrastructure. */ public static String reverseDns(String hostIp) throws IOException { Resolver res = new ExtendedResolver(); // set the timeout, defaults to 200 milliseconds int timeout = ConfigurationManager.getIntProperty("usage-statistics", "resolver.timeout", 200); res.setTimeout(0, timeout); Name name = ReverseMap.fromAddress(hostIp); int type = Type.PTR; int dclass = DClass.IN; Record rec = Record.newRecord(name, type, dclass); Message query = Message.newQuery(rec); Message response = res.send(query); Record[] answers = response.getSectionArray(Section.ANSWER); if (answers.length == 0) { return hostIp; } else { return answers[0].rdataToString(); } }