@UnstableApi public class DnsNameResolver extends InetNameResolver
InetNameResolver.| Constructor and Description |
|---|
DnsNameResolver(io.netty.channel.EventLoop eventLoop,
io.netty.bootstrap.ChannelFactory<? extends DatagramChannel> channelFactory,
DnsServerAddresses nameServerAddresses,
DnsCache resolveCache,
DnsCache authoritativeDnsServerCache,
long queryTimeoutMillis,
InternetProtocolFamily2[] resolvedAddressTypes,
boolean recursionDesired,
int maxQueriesPerResolve,
boolean traceEnabled,
int maxPayloadSize,
boolean optResourceEnabled,
HostsFileEntriesResolver hostsFileEntriesResolver,
String[] searchDomains,
int ndots,
boolean decodeIdn)
Creates a new DNS-based name resolver that communicates with the specified list of DNS servers.
|
DnsNameResolver(io.netty.channel.EventLoop eventLoop,
io.netty.bootstrap.ChannelFactory<? extends DatagramChannel> channelFactory,
DnsServerAddresses nameServerAddresses,
DnsCache resolveCache,
long queryTimeoutMillis,
InternetProtocolFamily2[] resolvedAddressTypes,
boolean recursionDesired,
int maxQueriesPerResolve,
boolean traceEnabled,
int maxPayloadSize,
boolean optResourceEnabled,
HostsFileEntriesResolver hostsFileEntriesResolver,
String[] searchDomains,
int ndots)
|
| Modifier and Type | Method and Description |
|---|---|
DnsCache |
authoritativeDnsServerCache()
Returns the cache used for authoritative DNS servers for a domain.
|
void |
close()
Closes the internal datagram channel used for sending and receiving DNS messages, and clears all DNS resource
records from the cache.
|
protected void |
doResolve(String inetHost,
DnsRecord[] additionals,
io.netty.util.concurrent.Promise<InetAddress> promise,
DnsCache resolveCache)
Hook designed for extensibility so one can pass a different cache on each resolution attempt
instead of using the global one.
|
protected void |
doResolve(String inetHost,
io.netty.util.concurrent.Promise<InetAddress> promise) |
protected void |
doResolveAll(String inetHost,
DnsRecord[] additionals,
io.netty.util.concurrent.Promise<List<InetAddress>> promise,
DnsCache resolveCache)
Hook designed for extensibility so one can pass a different cache on each resolution attempt
instead of using the global one.
|
protected void |
doResolveAll(String inetHost,
io.netty.util.concurrent.Promise<List<InetAddress>> promise) |
protected io.netty.channel.EventLoop |
executor() |
HostsFileEntriesResolver |
hostsFileEntriesResolver()
Returns the component that tries to resolve hostnames against the hosts file prior to asking to
remotes DNS servers.
|
boolean |
isOptResourceEnabled()
Returns the automatic inclusion of a optional records that tries to give the remote DNS server a hint about how
much data the resolver can read per response is enabled.
|
boolean |
isRecursionDesired()
Returns
true if and only if this resolver sends a DNS query with the RD (recursion desired) flag set. |
boolean |
isTraceEnabled()
Returns if this resolver should generate the detailed trace information in an exception message so that
it is easier to understand the cause of resolution failure.
|
protected InetAddress |
loopbackAddress() |
int |
maxPayloadSize()
Returns the capacity of the datagram packet buffer (in bytes).
|
int |
maxQueriesPerResolve()
Returns the maximum allowed number of DNS queries to send when resolving a host name.
|
io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> |
query(DnsQuestion question)
Sends a DNS query with the specified question.
|
io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> |
query(DnsQuestion question,
Iterable<DnsRecord> additionals)
Sends a DNS query with the specified question with additional records.
|
io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> |
query(DnsQuestion question,
io.netty.util.concurrent.Promise<io.netty.channel.AddressedEnvelope<? extends DnsResponse,InetSocketAddress>> promise)
Sends a DNS query with the specified question.
|
io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> |
query(InetSocketAddress nameServerAddr,
DnsQuestion question)
Sends a DNS query with the specified question using the specified name server list.
|
io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> |
query(InetSocketAddress nameServerAddr,
DnsQuestion question,
Iterable<DnsRecord> additionals)
Sends a DNS query with the specified question with additional records using the specified name server list.
|
io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> |
query(InetSocketAddress nameServerAddr,
DnsQuestion question,
Iterable<DnsRecord> additionals,
io.netty.util.concurrent.Promise<io.netty.channel.AddressedEnvelope<? extends DnsResponse,InetSocketAddress>> promise)
Sends a DNS query with the specified question with additional records using the specified name server list.
|
io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> |
query(InetSocketAddress nameServerAddr,
DnsQuestion question,
io.netty.util.concurrent.Promise<io.netty.channel.AddressedEnvelope<? extends DnsResponse,InetSocketAddress>> promise)
Sends a DNS query with the specified question using the specified name server list.
|
long |
queryTimeoutMillis()
Returns the timeout of each DNS query performed by this resolver (in milliseconds).
|
io.netty.util.concurrent.Future<InetAddress> |
resolve(String inetHost,
Iterable<DnsRecord> additionals)
Resolves the specified name into an address.
|
io.netty.util.concurrent.Future<InetAddress> |
resolve(String inetHost,
Iterable<DnsRecord> additionals,
io.netty.util.concurrent.Promise<InetAddress> promise)
Resolves the specified name into an address.
|
io.netty.util.concurrent.Future<List<InetAddress>> |
resolveAll(String inetHost,
Iterable<DnsRecord> additionals)
Resolves the specified host name and port into a list of address.
|
io.netty.util.concurrent.Future<List<InetAddress>> |
resolveAll(String inetHost,
Iterable<DnsRecord> additionals,
io.netty.util.concurrent.Promise<List<InetAddress>> promise)
Resolves the specified host name and port into a list of address.
|
DnsCache |
resolveCache()
Returns the resolution cache.
|
List<InternetProtocolFamily2> |
resolvedAddressTypes()
Returns the list of the protocol families of the address resolved by
SimpleNameResolver.resolve(String)
in the order of preference. |
asAddressResolver, resolve, resolveAllresolve, resolveAll@Deprecated public DnsNameResolver(io.netty.channel.EventLoop eventLoop, io.netty.bootstrap.ChannelFactory<? extends DatagramChannel> channelFactory, DnsServerAddresses nameServerAddresses, DnsCache resolveCache, long queryTimeoutMillis, InternetProtocolFamily2[] resolvedAddressTypes, boolean recursionDesired, int maxQueriesPerResolve, boolean traceEnabled, int maxPayloadSize, boolean optResourceEnabled, HostsFileEntriesResolver hostsFileEntriesResolver, String[] searchDomains, int ndots)
eventLoop - the EventLoop which will perform the communication with the DNS serverschannelFactory - the ChannelFactory that will create a DatagramChannelnameServerAddresses - the addresses of the DNS server. For each DNS query, a new stream is created from
this to determine which DNS server should be contacted for the next retry in case
of failure.resolveCache - the DNS resolved entries cachequeryTimeoutMillis - timeout of each DNS query in millisresolvedAddressTypes - list of the protocol familiesrecursionDesired - if recursion desired flag must be setmaxQueriesPerResolve - the maximum allowed number of DNS queries for a given name resolutiontraceEnabled - if trace is enabledmaxPayloadSize - the capacity of the datagram packet bufferoptResourceEnabled - if automatic inclusion of a optional records is enabledhostsFileEntriesResolver - the HostsFileEntriesResolver used to check for local aliasessearchDomains - the list of search domainndots - the ndots valuepublic DnsNameResolver(io.netty.channel.EventLoop eventLoop,
io.netty.bootstrap.ChannelFactory<? extends DatagramChannel> channelFactory,
DnsServerAddresses nameServerAddresses,
DnsCache resolveCache,
DnsCache authoritativeDnsServerCache,
long queryTimeoutMillis,
InternetProtocolFamily2[] resolvedAddressTypes,
boolean recursionDesired,
int maxQueriesPerResolve,
boolean traceEnabled,
int maxPayloadSize,
boolean optResourceEnabled,
HostsFileEntriesResolver hostsFileEntriesResolver,
String[] searchDomains,
int ndots,
boolean decodeIdn)
eventLoop - the EventLoop which will perform the communication with the DNS serverschannelFactory - the ChannelFactory that will create a DatagramChannelnameServerAddresses - the addresses of the DNS server. For each DNS query, a new stream is created from
this to determine which DNS server should be contacted for the next retry in case
of failure.resolveCache - the DNS resolved entries cacheauthoritativeDnsServerCache - the cache used to find the authoritative DNS server for a domainqueryTimeoutMillis - timeout of each DNS query in millisresolvedAddressTypes - list of the protocol familiesrecursionDesired - if recursion desired flag must be setmaxQueriesPerResolve - the maximum allowed number of DNS queries for a given name resolutiontraceEnabled - if trace is enabledmaxPayloadSize - the capacity of the datagram packet bufferoptResourceEnabled - if automatic inclusion of a optional records is enabledhostsFileEntriesResolver - the HostsFileEntriesResolver used to check for local aliasessearchDomains - the list of search domainndots - the ndots valuedecodeIdn - true if domain / host names should be decoded to unicode when received.
See rfc3492.public DnsCache resolveCache()
public DnsCache authoritativeDnsServerCache()
public long queryTimeoutMillis()
public List<InternetProtocolFamily2> resolvedAddressTypes()
SimpleNameResolver.resolve(String)
in the order of preference.
The default value depends on the value of the system property "java.net.preferIPv6Addresses".public boolean isRecursionDesired()
true if and only if this resolver sends a DNS query with the RD (recursion desired) flag set.
The default value is true.public int maxQueriesPerResolve()
8.public boolean isTraceEnabled()
true.public int maxPayloadSize()
4096 bytes.public boolean isOptResourceEnabled()
public HostsFileEntriesResolver hostsFileEntriesResolver()
public void close()
close in interface NameResolver<InetAddress>close in interface Closeableclose in interface AutoCloseableclose in class SimpleNameResolver<InetAddress>protected io.netty.channel.EventLoop executor()
executor in class SimpleNameResolver<InetAddress>public final io.netty.util.concurrent.Future<InetAddress> resolve(String inetHost, Iterable<DnsRecord> additionals)
inetHost - the name to resolveadditionals - additional records (OPT)public final io.netty.util.concurrent.Future<InetAddress> resolve(String inetHost, Iterable<DnsRecord> additionals, io.netty.util.concurrent.Promise<InetAddress> promise)
inetHost - the name to resolveadditionals - additional records (OPT)promise - the Promise which will be fulfilled when the name resolution is finishedpublic final io.netty.util.concurrent.Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals)
inetHost - the name to resolveadditionals - additional records (OPT)public final io.netty.util.concurrent.Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals, io.netty.util.concurrent.Promise<List<InetAddress>> promise)
inetHost - the name to resolveadditionals - additional records (OPT)promise - the Promise which will be fulfilled when the name resolution is finishedprotected void doResolve(String inetHost, io.netty.util.concurrent.Promise<InetAddress> promise) throws Exception
doResolve in class SimpleNameResolver<InetAddress>Exceptionprotected final InetAddress loopbackAddress()
loopbackAddress in class InetNameResolverprotected void doResolve(String inetHost, DnsRecord[] additionals, io.netty.util.concurrent.Promise<InetAddress> promise, DnsCache resolveCache) throws Exception
Exceptionprotected void doResolveAll(String inetHost, io.netty.util.concurrent.Promise<List<InetAddress>> promise) throws Exception
doResolveAll in class SimpleNameResolver<InetAddress>Exceptionprotected void doResolveAll(String inetHost, DnsRecord[] additionals, io.netty.util.concurrent.Promise<List<InetAddress>> promise, DnsCache resolveCache) throws Exception
Exceptionpublic io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> query(DnsQuestion question)
public io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> query(DnsQuestion question, Iterable<DnsRecord> additionals)
public io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> query(DnsQuestion question, io.netty.util.concurrent.Promise<io.netty.channel.AddressedEnvelope<? extends DnsResponse,InetSocketAddress>> promise)
public io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> query(InetSocketAddress nameServerAddr, DnsQuestion question)
public io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> query(InetSocketAddress nameServerAddr, DnsQuestion question, Iterable<DnsRecord> additionals)
public io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> query(InetSocketAddress nameServerAddr, DnsQuestion question, io.netty.util.concurrent.Promise<io.netty.channel.AddressedEnvelope<? extends DnsResponse,InetSocketAddress>> promise)
public io.netty.util.concurrent.Future<io.netty.channel.AddressedEnvelope<DnsResponse,InetSocketAddress>> query(InetSocketAddress nameServerAddr, DnsQuestion question, Iterable<DnsRecord> additionals, io.netty.util.concurrent.Promise<io.netty.channel.AddressedEnvelope<? extends DnsResponse,InetSocketAddress>> promise)
Copyright © 2017. All Rights Reserved.