/** * Finds PTR records (reverse dns lookups) for the ip address. * * @param ip ip address to lookup. * @return The host name found for the ip address. * @throws UnknownHostException occurs when id is not available in DNS */ public String getHostByAddr(byte[] ip) throws UnknownHostException { try { String addr = DnsUtils.numericToTextFormat(ip); Record[] records = new Lookup(addr, Type.PTR).run(); if (records == null) { throw new UnknownHostException(addr); } PTRRecord ptr = (PTRRecord) records[0]; return ptr.getTarget().toString(); } catch (TextParseException e) { throw new UnknownHostException(e.getMessage()); } } }
Record getObject() { return new PTRRecord(); }
/** Gets the target of the PTR Record */ public Name getTarget() { return getSingleName(); }
additionalNames.add(ptr.getTarget()); break; case Type.SRV: PTRRecord ptr = (PTRRecord) record; if (ptr.getTTL() > 0) ServiceInstance[] instances = extractServiceInstances(querier.send(Message.newQuery(Record.newRecord(ptr.getTarget(), Type.ANY, dclass)))); if (instances.length > 0) service = (ServiceInstance) services.get(ptr.getTarget()); if (service != null)
/** * Performs a reverse DNS lookup. * * @param addr The ip address to lookup. * @return The host name found for the ip address. */ public String getHostByAddr(byte[] addr) throws UnknownHostException, IOException { Name name = ReverseMap.fromAddress(InetAddress.getByAddress(addr)); Record[] records = Lookup.lookupRecords(name, Type.PTR); if (records == null || records.length == 0) { throw new UnknownHostException(); } return ((PTRRecord) records[0]).getTarget().toString(); } }
Record getObject() { return new PTRRecord(); }
/** Gets the target of the PTR Record */ public Name getTarget() { return getSingleName(); }
/** * Performs a reverse DNS lookup. * @param addr The ip address to lookup. * @return The host name found for the ip address. */ public String getHostByAddr(byte [] addr) throws UnknownHostException { Name name = ReverseMap.fromAddress(InetAddress.getByAddress(addr)); Record [] records = new Lookup(name, Type.PTR).run(); if (records == null) throw new UnknownHostException(); return ((PTRRecord) records[0]).getTarget().toString(); } }
/** * Creates a DNS PTR record. * * @param name the record name. * @param target the record target/value. * @return an A record. */ @Override public PTRRecord create(Name name, Name target) { return new PTRRecord(name, DClass.IN, ttl, target); } }
/** Gets the target of the PTR Record */ public Name getTarget() { return getSingleName(); }
/** * Performs a reverse DNS lookup. * @param addr The ip address to lookup. * @return The host name found for the ip address. */ public String getHostByAddr(byte [] addr) throws UnknownHostException { Name name = ReverseMap.fromAddress(InetAddress.getByAddress(addr)); Record [] records = new Lookup(name, Type.PTR).run(); if (records == null) throw new UnknownHostException(); return ((PTRRecord) records[0]).getTarget().toString(); } }
Record getObject() { return new PTRRecord(); }
/** Gets the target of the PTR Record */ public Name getTarget() { return getSingleName(); }
/** * Performs a reverse DNS lookup. * @param addr The ip address to lookup. * @return The host name found for the ip address. */ public String getHostByAddr(byte [] addr) throws UnknownHostException { Name name = ReverseMap.fromAddress(InetAddress.getByAddress(addr)); Record [] records = new Lookup(name, Type.PTR).run(); if (records == null) throw new UnknownHostException(); return ((PTRRecord) records[0]).getTarget().toString(); } }
Record getObject() { return new PTRRecord(); }
/** * Determines the hostname for an address * @param addr The address to look up * @return The associated host name * @exception UnknownHostException There is no hostname for the address */ public static String getHostName(InetAddress addr) throws UnknownHostException { Name name = ReverseMap.fromAddress(addr); Record [] records = new Lookup(name, Type.PTR).run(); if (records == null) throw new UnknownHostException("unknown address"); PTRRecord ptr = (PTRRecord) records[0]; return ptr.getTarget().toString(); }
records.add(new PTRRecord(typeName, DClass.IN, DEFAULT_SRV_TTL, shortSRVName)); if (!fullTypeName.equals(typeName)) records.add(new PTRRecord(fullTypeName, DClass.IN, DEFAULT_SRV_TTL, shortSRVName)); records.add(new PTRRecord(new Name(SERVICES_NAME + "." + domain), DClass.IN, DEFAULT_SRV_TTL, typeName)); if (!fullTypeName.equals(typeName)) records.add(new PTRRecord(new Name(SERVICES_NAME + "." + domain), DClass.IN, DEFAULT_SRV_TTL, fullTypeName));
/** * Determines the hostname for an address * @param addr The address to look up * @return The associated host name * @exception UnknownHostException There is no hostname for the address */ public static String getHostName(InetAddress addr) throws UnknownHostException { Name name = ReverseMap.fromAddress(addr); Record [] records = new Lookup(name, Type.PTR).run(); if (records == null) throw new UnknownHostException("unknown address"); PTRRecord ptr = (PTRRecord) records[0]; return ptr.getTarget().toString(); }