public class AddressResolverOptions extends Object
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CACHE_MAX_TIME_TO_LIVE
The default value for the negative cache max TTL = 0x7fffffff
|
static int |
DEFAULT_CACHE_MIN_TIME_TO_LIVE
The default value for the negative cache min TTL = 0
|
static int |
DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE
The default value for the negative cache TTL = 0
|
static int |
DEFAULT_MAX_QUERIES
The default value for the max dns queries per query = 4
|
static int |
DEFAULT_NDOTS
The default ndots value = loads the value from the OS on Linux otherwise use the value 1
|
static boolean |
DEFAULT_OPT_RESOURCE_ENABLED
The default value for
setOptResourceEnabled(boolean) = false |
static int |
DEFAULT_QUERY_TIMEOUT
The default value for the query timeout in millis = 5000
|
static boolean |
DEFAULT_RD_FLAG
The default value of the rd flag = true
|
static boolean |
DEFAULT_ROTATE_SERVERS
The default servers rotate value = loads the value from the OS on Linux otherwise use the value false
|
static boolean |
DEFAULT_ROUND_ROBIN_INET_ADDRESS
The default round robin inet address = false
|
static List<String> |
DEFAULT_SEACH_DOMAINS
The default value of search domains = null
|
static List<String> |
DEFAULT_SERVERS
The default list of DNS servers = null (uses system name server's list like resolve.conf otherwise Google Public DNS)
|
Constructor and Description |
---|
AddressResolverOptions() |
AddressResolverOptions(AddressResolverOptions other) |
AddressResolverOptions(JsonObject json) |
Modifier and Type | Method and Description |
---|---|
AddressResolverOptions |
addSearchDomain(String searchDomain)
Add a DNS search domain.
|
AddressResolverOptions |
addServer(String server)
Add a DNS server address.
|
boolean |
equals(Object o) |
int |
getCacheMaxTimeToLive() |
int |
getCacheMinTimeToLive() |
int |
getCacheNegativeTimeToLive() |
String |
getHostsPath() |
Buffer |
getHostsValue() |
int |
getMaxQueries() |
int |
getNdots() |
long |
getQueryTimeout() |
boolean |
getRdFlag() |
List<String> |
getSearchDomains() |
List<String> |
getServers() |
int |
hashCode() |
boolean |
isOptResourceEnabled() |
boolean |
isRotateServers() |
boolean |
isRoundRobinInetAddress() |
AddressResolverOptions |
setCacheMaxTimeToLive(int cacheMaxTimeToLive)
Set the cache maximum TTL value in seconds.
|
AddressResolverOptions |
setCacheMinTimeToLive(int cacheMinTimeToLive)
Set the cache minimum TTL value in seconds.
|
AddressResolverOptions |
setCacheNegativeTimeToLive(int cacheNegativeTimeToLive)
Set the negative cache TTL value in seconds.
|
AddressResolverOptions |
setHostsPath(String hostsPath)
Set the path of an alternate hosts configuration file to use instead of the one provided by the os.
|
AddressResolverOptions |
setHostsValue(Buffer hostsValue)
Set an alternate hosts configuration file to use instead of the one provided by the os.
|
AddressResolverOptions |
setMaxQueries(int maxQueries)
Set the maximum number of queries when an hostname is resolved.
|
AddressResolverOptions |
setNdots(int ndots)
Set the ndots value used when resolving using search domains, the default value is
-1 which
determines the value from the OS on Linux or uses the value 1 . |
AddressResolverOptions |
setOptResourceEnabled(boolean optResourceEnabled)
Set to true to enable the automatic inclusion in DNS queries of an optional record that hints
the remote DNS server about how much data the resolver can read per response.
|
AddressResolverOptions |
setQueryTimeout(long queryTimeout)
Set the query timeout in milliseconds, i.e the amount of time after a query is considered to be failed.
|
AddressResolverOptions |
setRdFlag(boolean rdFlag)
Set the DNS queries Recursion Desired flag value.
|
AddressResolverOptions |
setRotateServers(boolean rotateServers)
Set to
true to enable round-robin selection of the dns server to use. |
AddressResolverOptions |
setRoundRobinInetAddress(boolean roundRobinInetAddress)
Set to
true to enable round-robin inet address selection of the ip address to use. |
AddressResolverOptions |
setSearchDomains(List<String> searchDomains)
Set the lists of DNS search domains.
|
AddressResolverOptions |
setServers(List<String> servers)
Set the list of DNS server addresses, an address is the IP of the dns server, followed by an optional
colon and a port, e.g
8.8.8.8 or {code 192.168.0.1:40000}. |
JsonObject |
toJson() |
public static final List<String> DEFAULT_SERVERS
public static final boolean DEFAULT_OPT_RESOURCE_ENABLED
setOptResourceEnabled(boolean)
= falsepublic static final int DEFAULT_CACHE_MIN_TIME_TO_LIVE
public static final int DEFAULT_CACHE_MAX_TIME_TO_LIVE
public static final int DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE
public static final int DEFAULT_QUERY_TIMEOUT
public static final int DEFAULT_MAX_QUERIES
public static final boolean DEFAULT_RD_FLAG
public static final List<String> DEFAULT_SEACH_DOMAINS
public static final int DEFAULT_NDOTS
public static final boolean DEFAULT_ROTATE_SERVERS
public static final boolean DEFAULT_ROUND_ROBIN_INET_ADDRESS
public AddressResolverOptions()
public AddressResolverOptions(AddressResolverOptions other)
public AddressResolverOptions(JsonObject json)
public String getHostsPath()
public AddressResolverOptions setHostsPath(String hostsPath)
hostsPath
- the hosts pathpublic Buffer getHostsValue()
public AddressResolverOptions setHostsValue(Buffer hostsValue)
hostsValue
- the hosts contentpublic AddressResolverOptions setServers(List<String> servers)
8.8.8.8
or {code 192.168.0.1:40000}. When the list is empty, the resolver
will use the list of the system DNS server addresses from the environment, if that list cannot be retrieved
it will use Google's public DNS servers "8.8.8.8"
and "8.8.4.4"
.servers
- the list of DNS serverspublic AddressResolverOptions addServer(String server)
server
- the server to addpublic boolean isOptResourceEnabled()
public AddressResolverOptions setOptResourceEnabled(boolean optResourceEnabled)
optResourceEnabled
- true to enable, false otherwisepublic int getCacheMinTimeToLive()
public AddressResolverOptions setCacheMinTimeToLive(int cacheMinTimeToLive)
cacheMinTimeToLive
- the cache min TTL in secondspublic int getCacheMaxTimeToLive()
public AddressResolverOptions setCacheMaxTimeToLive(int cacheMaxTimeToLive)
cacheMaxTimeToLive
- the cache max TTL in secondspublic int getCacheNegativeTimeToLive()
public AddressResolverOptions setCacheNegativeTimeToLive(int cacheNegativeTimeToLive)
cacheNegativeTimeToLive
- the cache negative TTL in secondspublic long getQueryTimeout()
public AddressResolverOptions setQueryTimeout(long queryTimeout)
queryTimeout
- the query timeout in millisecondspublic int getMaxQueries()
public AddressResolverOptions setMaxQueries(int maxQueries)
maxQueries
- the max number of queries to be sentpublic boolean getRdFlag()
public AddressResolverOptions setRdFlag(boolean rdFlag)
rdFlag
- the flag valuepublic AddressResolverOptions setSearchDomains(List<String> searchDomains)
searchDomains
- the search domainspublic AddressResolverOptions addSearchDomain(String searchDomain)
searchDomain
- the search domain to addpublic int getNdots()
public AddressResolverOptions setNdots(int ndots)
-1
which
determines the value from the OS on Linux or uses the value 1
.ndots
- the new ndots valuepublic boolean isRotateServers()
true
when the dns server selection uses round robinpublic AddressResolverOptions setRotateServers(boolean rotateServers)
true
to enable round-robin selection of the dns server to use. It spreads the query load
among the servers and avoids all lookup to hit the first server of the list.public boolean isRoundRobinInetAddress()
true
when the inet address selection uses round robinpublic AddressResolverOptions setRoundRobinInetAddress(boolean roundRobinInetAddress)
true
to enable round-robin inet address selection of the ip address to use.public JsonObject toJson()
Copyright © 2023 Eclipse. All rights reserved.