public abstract class DnsNameResolverBuilder<T extends DnsNameResolverBuilder<T>> extends Object
DnsNameResolver builder.| Modifier and Type | Field and Description |
|---|---|
protected io.netty.bootstrap.ChannelFactory<? extends io.netty.channel.socket.DatagramChannel> |
channelFactory |
protected io.netty.channel.EventLoop |
eventLoop |
protected HostsFileEntriesResolver |
hostsFileEntriesResolver |
protected InetSocketAddress |
localAddress |
protected int |
maxPayloadSize |
protected int |
maxQueriesPerResolve |
protected Integer |
maxTtl |
protected Integer |
minTtl |
protected DnsServerAddresses |
nameServerAddresses |
protected Integer |
negativeTtl |
protected boolean |
optResourceEnabled |
protected long |
queryTimeoutMillis |
protected boolean |
recursionDesired |
protected DnsCache |
resolveCache |
protected io.netty.channel.socket.InternetProtocolFamily[] |
resolvedAddressTypes |
protected boolean |
traceEnabled |
| Constructor and Description |
|---|
DnsNameResolverBuilder(io.netty.channel.EventLoop eventLoop)
Creates a new builder.
|
| Modifier and Type | Method and Description |
|---|---|
DnsNameResolver |
build()
Returns a new
DnsNameResolver instance. |
protected abstract DnsNameResolver |
build0(DnsCache cache) |
T |
channelFactory(io.netty.bootstrap.ChannelFactory<? extends io.netty.channel.socket.DatagramChannel> channelFactory)
Sets the
ChannelFactory that will create a DatagramChannel. |
T |
channelType(Class<? extends io.netty.channel.socket.DatagramChannel> channelType)
Sets the
ChannelFactory as a ReflectiveChannelFactory of this type. |
T |
hostsFileEntriesResolver(HostsFileEntriesResolver hostsFileEntriesResolver) |
T |
localAddress(InetSocketAddress localAddress)
Sets the local address of the
DatagramChannel |
T |
maxPayloadSize(int maxPayloadSize)
Sets the capacity of the datagram packet buffer (in bytes).
|
T |
maxQueriesPerResolve(int maxQueriesPerResolve)
Sets the maximum allowed number of DNS queries to send when resolving a host name.
|
T |
nameServerAddresses(DnsServerAddresses nameServerAddresses)
Sets the addresses of the DNS server.
|
T |
negativeTtl(int negativeTtl)
Sets the TTL of the cache for the failed DNS queries (in seconds).
|
T |
optResourceEnabled(boolean optResourceEnabled)
Enable 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.
|
T |
queryTimeoutMillis(long queryTimeoutMillis)
Sets the timeout of each DNS query performed by this resolver (in milliseconds).
|
T |
recursionDesired(boolean recursionDesired)
Sets if this resolver has to send a DNS query with the RD (recursion desired) flag set.
|
T |
resolveCache(DnsCache resolveCache)
Sets the cache for resolution results.
|
T |
resolvedAddressTypes(io.netty.channel.socket.InternetProtocolFamily... resolvedAddressTypes)
Sets the list of the protocol families of the address resolved.
|
T |
resolvedAddressTypes(Iterable<io.netty.channel.socket.InternetProtocolFamily> resolvedAddressTypes)
Sets the list of the protocol families of the address resolved.
|
T |
traceEnabled(boolean traceEnabled)
Sets 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.
|
T |
ttl(int minTtl,
int maxTtl)
Sets the minimum and maximum TTL of the cached DNS resource records (in seconds).
|
protected final io.netty.channel.EventLoop eventLoop
protected io.netty.bootstrap.ChannelFactory<? extends io.netty.channel.socket.DatagramChannel> channelFactory
protected InetSocketAddress localAddress
protected DnsServerAddresses nameServerAddresses
protected DnsCache resolveCache
protected Integer minTtl
protected Integer maxTtl
protected Integer negativeTtl
protected long queryTimeoutMillis
protected io.netty.channel.socket.InternetProtocolFamily[] resolvedAddressTypes
protected boolean recursionDesired
protected int maxQueriesPerResolve
protected boolean traceEnabled
protected int maxPayloadSize
protected boolean optResourceEnabled
protected HostsFileEntriesResolver hostsFileEntriesResolver
public DnsNameResolverBuilder(io.netty.channel.EventLoop eventLoop)
eventLoop - the EventLoop the EventLoop which will perform the communication with the DNS
servers.public T channelFactory(io.netty.bootstrap.ChannelFactory<? extends io.netty.channel.socket.DatagramChannel> channelFactory)
ChannelFactory that will create a DatagramChannel.channelFactory - the ChannelFactorythispublic T channelType(Class<? extends io.netty.channel.socket.DatagramChannel> channelType)
ChannelFactory as a ReflectiveChannelFactory of this type.
Use as an alternative to channelFactory(ChannelFactory).channelType - thispublic T localAddress(InetSocketAddress localAddress)
DatagramChannellocalAddress - the local addressthispublic T nameServerAddresses(DnsServerAddresses nameServerAddresses)
nameServerAddresses - the DNS server addressesthispublic T resolveCache(DnsCache resolveCache)
resolveCache - the DNS resolution results cachethispublic T ttl(int minTtl, int maxTtl)
0 and Integer.MAX_VALUE, which practically tells this resolver to
respect the TTL from the DNS server.minTtl - the minimum TTLmaxTtl - the maximum TTLthispublic T negativeTtl(int negativeTtl)
negativeTtl - the TTL for failed cached queriesthispublic T queryTimeoutMillis(long queryTimeoutMillis)
queryTimeoutMillis - the query timeoutthispublic T resolvedAddressTypes(io.netty.channel.socket.InternetProtocolFamily... resolvedAddressTypes)
InternetProtocolFamily.IPv4 and InternetProtocolFamily.IPv6 are specified in
the order of preference. To enforce the resolve to retrieve the address of a specific protocol family,
specify only a single InternetProtocolFamily.resolvedAddressTypes - the address typesthispublic T resolvedAddressTypes(Iterable<io.netty.channel.socket.InternetProtocolFamily> resolvedAddressTypes)
InternetProtocolFamily.IPv4 and InternetProtocolFamily.IPv6 are specified in
the order of preference. To enforce the resolve to retrieve the address of a specific protocol family,
specify only a single InternetProtocolFamily.resolvedAddressTypes - the address typesthispublic T recursionDesired(boolean recursionDesired)
recursionDesired - true if recursion is desiredthispublic T maxQueriesPerResolve(int maxQueriesPerResolve)
maxQueriesPerResolve - the max number of queriesthispublic T traceEnabled(boolean traceEnabled)
traceEnabled - true if trace is enabledthispublic T maxPayloadSize(int maxPayloadSize)
4096 bytes.maxPayloadSize - the capacity of the datagram packet bufferthispublic T optResourceEnabled(boolean optResourceEnabled)
optResourceEnabled - if optional records inclusion is enabledthispublic T hostsFileEntriesResolver(HostsFileEntriesResolver hostsFileEntriesResolver)
hostsFileEntriesResolver - the HostsFileEntriesResolver used to first check
if the hostname is locally aliased.thispublic DnsNameResolver build()
DnsNameResolver instance.DnsNameResolverprotected abstract DnsNameResolver build0(DnsCache cache)
Copyright © 2016. All Rights Reserved.