org.xbill.DNS.Address Java Examples
The following examples show how to use
org.xbill.DNS.Address.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DNSLookupService.java From openvisualtraceroute with GNU Lesser General Public License v3.0 | 5 votes |
public static void main(final String[] args) throws UnknownHostException { long t = System.nanoTime(); System.out.println(Address.getByName("www.google.fr").getHostAddress() + " " + (System.nanoTime() - t)); t = System.nanoTime(); System.out.println(InetAddress.getByName("www.google.fr").getHostAddress() + " " + (System.nanoTime() - t)); }
Example #2
Source File: DnsJavaResolver.java From BUbiNG with Apache License 2.0 | 5 votes |
@Override public InetAddress[] resolve(String hostname) throws UnknownHostException { if ("localhost".equals(hostname)) return Frontier.LOOPBACK; // DnsJava does not understand dotted-notation IP addresses with additional zeroes (e.g., 127.0.0.01). if (RuntimeConfiguration.DOTTED_ADDRESS.matcher(hostname).matches()) return InetAddress.getAllByName(hostname); // This avoid expensive trials with domain suffixes (but must not be applied to dotted-notation IP addresses). hostname = hostname.endsWith(".") ? hostname : hostname + "."; return Address.getAllByName(hostname); }
Example #3
Source File: Dnsbl.java From mireka with Apache License 2.0 | 5 votes |
/** * @return null if the host is not listed */ private InetAddress queryARecord() { try { return Address.getByName(queryDomain); } catch (UnknownHostException e) { return null; } }
Example #4
Source File: DNSLookupService.java From openvisualtraceroute with GNU Lesser General Public License v3.0 | 4 votes |
public InetAddress getIp(final String name) throws UnknownHostException { return Address.getByName(name); }
Example #5
Source File: CustomDns.java From KinoCast with MIT License | 4 votes |
@Override public List<InetAddress> lookup(String hostname) throws UnknownHostException { // I'm initializing the DNS resolvers here to take advantage of this method being called in a background-thread managed by OkHttp init(); return Collections.singletonList(Address.getByName(hostname)); }