Package reactor.netty.transport
Interface NameResolverProvider.NameResolverSpec
- Enclosing class:
- NameResolverProvider
public static interface NameResolverProvider.NameResolverSpec
-
Method Summary
Modifier and TypeMethodDescriptionbindAddressSupplier
(Supplier<? extends @Nullable SocketAddress> bindAddressSupplier) Set a new local address supplier that supply the address to bind to.build()
Build a newNameResolverProvider
.cacheMaxTimeToLive
(Duration cacheMaxTimeToLive) Sets the max time to live of the cached DNS resource records (resolution: seconds).cacheMinTimeToLive
(Duration cacheMinTimeToLive) Sets the min time to live of the cached DNS resource records (resolution: seconds).cacheNegativeTimeToLive
(Duration cacheNegativeTimeToLive) Sets the time to live of the cache for the failed DNS queries (resolution: seconds).completeOncePreferredResolved
(boolean enable) Iftrue
, the resolver notifies the returnedFuture
as soon as all queries for the preferred address type are complete.datagramChannelStrategy
(DnsNameResolverChannelStrategy datagramChannelStrategy) Sets the strategy that is used to determine how aDatagramChannel
is used by the resolver for sending queries over UDP protocol.disableOptionalRecord
(boolean disable) Disables the automatic inclusion of an optional record that tries to hint the remote DNS server about how much data the resolver can read per response.disableRecursionDesired
(boolean disable) Specifies whether this resolver has to send a DNS query with the recursion desired (RD) flag set.dnsAddressResolverGroupProvider
(Function<DnsNameResolverBuilder, DnsAddressResolverGroup> dnsAddressResolverGroupProvider) Sets the custom function to build theDnsAddressResolverGroup
given aDnsNameResolverBuilder
.hostsFileEntriesResolver
(HostsFileEntriesResolver hostsFileEntriesResolver) Specifies a customHostsFileEntriesResolver
to be used for hosts file entries.maxPayloadSize
(int maxPayloadSize) Sets the capacity of the datagram packet buffer (in bytes).maxQueriesPerResolve
(int maxQueriesPerResolve) Sets the maximum allowed number of DNS queries to send when resolving a host name.ndots
(int ndots) Sets the number of dots which must appear in a name before an initial absolute query is made.queryTimeout
(Duration queryTimeout) Sets the timeout of each DNS query performed by this resolver (resolution: milliseconds).resolveCache
(DnsCache resolveCache) Sets the resolve cache to use for DNS resolution.resolvedAddressTypes
(ResolvedAddressTypes resolvedAddressTypes) Sets the list of the protocol families of the address resolved.retryTcpOnTimeout
(boolean enable) Specifies whether this resolver will also fallback to TCP if a timeout is detected.roundRobinSelection
(boolean enable) Enables anAddressResolverGroup
ofDnsNameResolver
s that supports random selection of destination addresses if multiple are provided by the nameserver.runOn
(EventLoopGroup eventLoopGroup) Performs the communication with the DNS servers on the givenEventLoopGroup
.runOn
(LoopResources loopResources) Performs the communication with the DNS servers on a suppliedEventLoopGroup
from theLoopResources
container.runOn
(LoopResources loopResources, boolean preferNative) Performs the communication with the DNS servers on a suppliedEventLoopGroup
from theLoopResources
container.searchDomains
(List<String> searchDomains) Sets the list of search domains of the resolver.Sets a specific category and log level to be used by this resolver when generating a detailed trace information in case of resolution failure.
-
Method Details
-
bindAddressSupplier
NameResolverProvider.NameResolverSpec bindAddressSupplier(Supplier<? extends @Nullable SocketAddress> bindAddressSupplier) Set a new local address supplier that supply the address to bind to. Ifnull
is provided by the supplier, there will be no bind operation. By default, the host is configured for any local address, and the system picks up an ephemeral port.- Parameters:
bindAddressSupplier
- A supplier of local address to bind to- Returns:
this
- Since:
- 1.0.14
-
build
NameResolverProvider build()Build a newNameResolverProvider
.- Returns:
- a new
NameResolverProvider
-
cacheMaxTimeToLive
Sets the max time to live of the cached DNS resource records (resolution: seconds). If the time to live of the DNS resource record returned by the DNS server is greater than this max time to live, this resolver will ignore the time to live from the DNS server and will use this max time to live. Default toNameResolverProvider.Build.DEFAULT_CACHE_MAX_TIME_TO_LIVE
.- Parameters:
cacheMaxTimeToLive
- the maximum time to live (resolution: seconds)- Returns:
this
-
cacheMinTimeToLive
Sets the min time to live of the cached DNS resource records (resolution: seconds). If the time to live of the DNS resource record returned by the DNS server is less than this min time to live, this resolver will ignore the time to live from the DNS server and will use this min time to live. Default toNameResolverProvider.Build.DEFAULT_CACHE_MIN_TIME_TO_LIVE
.- Parameters:
cacheMinTimeToLive
- the minimum time to live (resolution: seconds)- Returns:
this
-
cacheNegativeTimeToLive
Sets the time to live of the cache for the failed DNS queries (resolution: seconds). Default toNameResolverProvider.Build.DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE
.- Parameters:
cacheNegativeTimeToLive
- the time to live of the cache for the failed DNS queries (resolution: seconds)- Returns:
this
-
completeOncePreferredResolved
Iftrue
, the resolver notifies the returnedFuture
as soon as all queries for the preferred address type are complete. Iffalse
, the resolver notifies the returnedFuture
when all possible address types are complete. This configuration is applicable forSimpleNameResolver.resolveAll(String)
. By default, this is enabled.- Parameters:
enable
-true
to enable,false
to disable- Returns:
this
-
datagramChannelStrategy
NameResolverProvider.NameResolverSpec datagramChannelStrategy(DnsNameResolverChannelStrategy datagramChannelStrategy) Sets the strategy that is used to determine how aDatagramChannel
is used by the resolver for sending queries over UDP protocol. Default toDnsNameResolverChannelStrategy.ChannelPerResolver
- Parameters:
datagramChannelStrategy
- theDnsNameResolverChannelStrategy
to use when doing queries over UDP protocol- Returns:
this
- Since:
- 1.2.3
-
disableOptionalRecord
Disables the automatic inclusion of an optional record that tries to hint the remote DNS server about how much data the resolver can read per response. By default, this is enabled.- Parameters:
disable
- true if an optional record is not included- Returns:
this
-
disableRecursionDesired
Specifies whether this resolver has to send a DNS query with the recursion desired (RD) flag set. By default, this is enabled.- Parameters:
disable
- true if RD flag is not set- Returns:
this
-
dnsAddressResolverGroupProvider
NameResolverProvider.NameResolverSpec dnsAddressResolverGroupProvider(Function<DnsNameResolverBuilder, DnsAddressResolverGroup> dnsAddressResolverGroupProvider) Sets the custom function to build theDnsAddressResolverGroup
given aDnsNameResolverBuilder
.- Parameters:
dnsAddressResolverGroupProvider
- theDnsAddressResolverGroup
provider function- Returns:
this
- Since:
- 1.1.6
-
hostsFileEntriesResolver
NameResolverProvider.NameResolverSpec hostsFileEntriesResolver(HostsFileEntriesResolver hostsFileEntriesResolver) Specifies a customHostsFileEntriesResolver
to be used for hosts file entries. Default toDefaultHostsFileEntriesResolver
.- Parameters:
hostsFileEntriesResolver
- theHostsFileEntriesResolver
to be used for hosts file entries- Returns:
this
- Since:
- 1.0.12
-
maxPayloadSize
Sets the capacity of the datagram packet buffer (in bytes). Default toNameResolverProvider.Build.DEFAULT_MAX_PAYLOAD_SIZE
.- Parameters:
maxPayloadSize
- the capacity of the datagram packet buffer- Returns:
this
- Throws:
IllegalArgumentException
- ifmaxPayloadSize
is not positive
-
maxQueriesPerResolve
Sets the maximum allowed number of DNS queries to send when resolving a host name. Default toNameResolverProvider.Build.DEFAULT_MAX_QUERIES_PER_RESOLVE
.- Parameters:
maxQueriesPerResolve
- the max number of queries- Returns:
this
- Throws:
IllegalArgumentException
- ifmaxQueriesPerResolve
is not positive
-
ndots
Sets the number of dots which must appear in a name before an initial absolute query is made. Default toNameResolverProvider.Build.DEFAULT_NDOTS
which determines the value from the OS on Unix or uses the value1
.- Parameters:
ndots
- the ndots value- Returns:
this
- Throws:
IllegalArgumentException
- ifndots
is less than -1
-
queryTimeout
Sets the timeout of each DNS query performed by this resolver (resolution: milliseconds). Default toNameResolverProvider.Build.DEFAULT_QUERY_TIMEOUT
.- Parameters:
queryTimeout
- the query timeout (resolution: milliseconds)- Returns:
this
-
resolveCache
Sets the resolve cache to use for DNS resolution.- Parameters:
resolveCache
- the resolution DNS cache- Returns:
this
- Since:
- 1.0.27
-
resolvedAddressTypes
NameResolverProvider.NameResolverSpec resolvedAddressTypes(ResolvedAddressTypes resolvedAddressTypes) Sets the list of the protocol families of the address resolved.- Parameters:
resolvedAddressTypes
- the address types- Returns:
this
-
retryTcpOnTimeout
Specifies whether this resolver will also fallback to TCP if a timeout is detected. By default, the resolver will only try to use TCP if the response is marked as truncated.- Parameters:
enable
- if true this resolver will also fallback to TCP if a timeout is detected, if false the resolver will only try to use TCP if the response is marked as truncated.- Returns:
this
- Since:
- 1.1.17
-
roundRobinSelection
Enables anAddressResolverGroup
ofDnsNameResolver
s that supports random selection of destination addresses if multiple are provided by the nameserver. SeeRoundRobinDnsAddressResolverGroup
. Default toDnsAddressResolverGroup
.- Parameters:
enable
-true
to enable,false
to disable- Returns:
this
-
runOn
Performs the communication with the DNS servers on the givenEventLoopGroup
.- Parameters:
eventLoopGroup
- theEventLoopGroup
- Returns:
this
-
runOn
Performs the communication with the DNS servers on a suppliedEventLoopGroup
from theLoopResources
container. Will prefer native (epoll/io_uring/kqueue) implementation if available unless the environment propertyreactor.netty.native
is set tofalse
.- Parameters:
loopResources
- theLoopResources
- Returns:
this
-
runOn
Performs the communication with the DNS servers on a suppliedEventLoopGroup
from theLoopResources
container.- Parameters:
loopResources
- theLoopResources
preferNative
- should prefer running on epoll, io_uring or kqueue instead of java NIO- Returns:
this
-
searchDomains
Sets the list of search domains of the resolver. By default, the effective search domain list will be populated using the system DNS search domains.- Parameters:
searchDomains
- the search domains- Returns:
this
-
trace
Sets a specific category and log level to be used by this resolver when generating a detailed trace information in case of resolution failure.- Parameters:
category
- the logger categorylevel
- the logger level- Returns:
this
-