public class DirContextDnsResolver extends Object implements DnsResolver, Closeable
com.sun.jndi.dns.DnsContextFactory. This resolver resolves hostnames to IPv4 and IPv6
addresses using A, AAAA and CNAME records. Java IP stack preferences are read from system properties
and taken into account when resolving names.
The default configuration uses system-configured DNS server addresses to perform lookups but server adresses can be specified
using DirContextDnsResolver(Iterable). Custom DNS servers can be specified by using
DirContextDnsResolver(String) or DirContextDnsResolver(Iterable).
| Constructor and Description |
|---|
DirContextDnsResolver()
Creates a new
DirContextDnsResolver using system-configured DNS servers. |
DirContextDnsResolver(boolean preferIpv4,
boolean preferIpv6,
Properties properties)
Creates a new
DirContextDnsResolver for the given stack preference and properties. |
DirContextDnsResolver(Iterable<String> dnsServers)
Creates a new
DirContextDnsResolver using a collection of DNS servers. |
DirContextDnsResolver(String dnsServer)
Creates a new
DirContextDnsResolver using a collection of DNS servers. |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
InetAddress[] |
resolve(String host)
Perform hostname to address resolution.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitjvmDefault, unresolvedpublic DirContextDnsResolver()
DirContextDnsResolver using system-configured DNS servers.public DirContextDnsResolver(String dnsServer)
DirContextDnsResolver using a collection of DNS servers.dnsServer - must not be null and not empty.public DirContextDnsResolver(Iterable<String> dnsServers)
DirContextDnsResolver using a collection of DNS servers.dnsServers - must not be null and not empty.public DirContextDnsResolver(boolean preferIpv4,
boolean preferIpv6,
Properties properties)
DirContextDnsResolver for the given stack preference and properties.preferIpv4 - flag to prefer IPv4 over IPv6 address resolution.preferIpv6 - flag to prefer IPv6 over IPv4 address resolution.properties - custom properties for creating the context, must not be null.public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic InetAddress[] resolve(String host) throws UnknownHostException
resolve in interface DnsResolverhost - the hostname, must not be empty or null.adressesUnknownHostExceptionCopyright © 2019 lettuce.io. All rights reserved.