Top Description Fields Constructors Methods
io.vertx.core.dns

public Class AddressResolverOptions

extends Object
Class Inheritance
Annotations
@DataObject
@JsonGen
publicConverter:false
Imports
io.vertx.codegen.annotations.DataObject, io.vertx.codegen.json.annotations.JsonGen, io.vertx.core.buffer.Buffer, io.vertx.core.impl.AddressResolver, io.vertx.core.json.JsonObject, java.util.ArrayList, .List

Configuration options for Vert.x hostname resolver. The resolver uses the local hosts file and performs DNS A and AAAA queries.
Author
Julien Viet

Field Summary

Modifier and TypeField and Description
private int
private int
private int
public static final int
DEFAULT_CACHE_MAX_TIME_TO_LIVE

The default value for the cache max TTL = 0x7fffffff

public static final int
DEFAULT_CACHE_MIN_TIME_TO_LIVE

The default value for the cache min TTL = 0

public static final int
DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE

The default value for the negative cache TTL = 0

public static final int
DEFAULT_HOSTS_REFRESH_PERIOD

The default value for the hosts refresh value in millis = 0 (disabled)

public static final int
DEFAULT_MAX_QUERIES

The default value for the max dns queries per query = 4

public static final int
DEFAULT_NDOTS

The default ndots value = loads the value from the OS on Linux otherwise use the value 1

public static final boolean
public static final int
DEFAULT_QUERY_TIMEOUT

The default value for the query timeout in millis = 5000

public static final boolean
DEFAULT_RD_FLAG

The default value of the rd flag = true

public static final boolean
DEFAULT_ROTATE_SERVERS

The default servers rotate value = loads the value from the OS on Linux otherwise use the value false

public static final boolean
DEFAULT_ROUND_ROBIN_INET_ADDRESS

The default round robin inet address = false

public static final List<String>
DEFAULT_SEACH_DOMAINS

Deprecated instead use DEFAULT_SEARCH_DOMAINS
The default value of search domains = null
public static final List<String>
DEFAULT_SEARCH_DOMAINS

The default value of search domains = null

public static final List<String>
DEFAULT_SERVERS

The default list of DNS servers = null (uses system name server's list like resolve.conf otherwise Google Public DNS)

private String
private int
private Buffer
hostsValue

References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.
private int
private int
private boolean
private long
private boolean
private boolean
private boolean
private List<String>
private List<String>

Constructor Summary

AccessConstructor and Description
public
public
public
AddressResolverOptions(JsonObject json)
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Method Summary

Modifier and TypeMethod and Description
public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
addSearchDomain
(String
the search domain to add
searchDomain
)

Add a DNS search domain.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
addServer
(String
the server to add
server
)

Add a DNS server address.

public int

Returns:

the cache max TTL in seconds
getCacheMaxTimeToLive
()

public int

Returns:

the cache min TTL in seconds
getCacheMinTimeToLive
()

public int

Returns:

the cache negative TTL in seconds
getCacheNegativeTimeToLive
()

public String

Returns:

the path to the alternate hosts configuration file
getHostsPath
()

public int

Returns:

the hosts configuration refresh period in millis
getHostsRefreshPeriod
()

public Buffer

Returns:

the hosts configuration file value
getHostsValue
()
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

public int

Returns:

the maximum number of queries to be sent during a resolution
getMaxQueries
()

public int

Returns:

the ndots value
getNdots
()

public long

Returns:

the query timeout in milliseconds
getQueryTimeout
()

public boolean

Returns:

the DNS queries Recursion Desired flag value
getRdFlag
()

public List<String>

Returns:

the list of search domains
getSearchDomains
()

public List<String>

Returns:

the list of dns server
getServers
()

public boolean

Returns:

true if an optional record is automatically included in DNS queries
isOptResourceEnabled
()

public boolean

Returns:

the value true when the dns server selection uses round robin
isRotateServers
()

public boolean

Returns:

the value true when the inet address selection uses round robin
isRoundRobinInetAddress
()

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setCacheMaxTimeToLive
(int
the cache max TTL in seconds
cacheMaxTimeToLive
)

Set the cache maximum TTL value in seconds.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setCacheMinTimeToLive
(int
the cache min TTL in seconds
cacheMinTimeToLive
)

Set the cache minimum TTL value in seconds.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setCacheNegativeTimeToLive
(int
the cache negative TTL in seconds
cacheNegativeTimeToLive
)

Set the negative cache TTL value in seconds.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setHostsPath
(String
the hosts path
hostsPath
)

Set the path of an alternate hosts configuration file to use instead of the one provided by the os.

public AddressResolverOptions
setHostsRefreshPeriod(int
the hosts configuration refresh period
hostsRefreshPeriod
)

Set the hosts configuration refresh period in millis, 0 disables it.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setHostsValue
(Buffer
the hosts content
hostsValue
)
References Deprecated Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

Set an alternate hosts configuration file to use instead of the one provided by the os.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setMaxQueries
(int
the max number of queries to be sent
maxQueries
)

Set the maximum number of queries when an hostname is resolved.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setNdots
(int
the new ndots value
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.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setOptResourceEnabled
(boolean
true to enable, false otherwise
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.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setQueryTimeout
(long
the query timeout in milliseconds
queryTimeout
)

Set the query timeout in milliseconds, i.e the amount of time after a query is considered to be failed.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setRdFlag
(boolean
the flag value
rdFlag
)

Set the DNS queries Recursion Desired flag value.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setRotateServers
(boolean rotateServers)

Set to true to enable round-robin selection of the dns server to use.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setRoundRobinInetAddress
(boolean roundRobinInetAddress)

Set to true to enable round-robin inet address selection of the ip address to use.

public AddressResolverOptions
setSearchDomains(List<String>
the search domains
searchDomains
)

Set the lists of DNS search domains.

public AddressResolverOptions

Returns:

a reference to this, so the API can be used fluently
setServers
(List<String>
the list of DNS servers
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}.

public JsonObject
toJson()
References Deprecated JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheMaxTimeToLiveback to summary
private int cacheMaxTimeToLive
cacheMinTimeToLiveback to summary
private int cacheMinTimeToLive
cacheNegativeTimeToLiveback to summary
private int cacheNegativeTimeToLive
DEFAULT_CACHE_MAX_TIME_TO_LIVEback to summary
public static final int DEFAULT_CACHE_MAX_TIME_TO_LIVE

The default value for the cache max TTL = 0x7fffffff

DEFAULT_CACHE_MIN_TIME_TO_LIVEback to summary
public static final int DEFAULT_CACHE_MIN_TIME_TO_LIVE

The default value for the cache min TTL = 0

DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVEback to summary
public static final int DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE

The default value for the negative cache TTL = 0

DEFAULT_HOSTS_REFRESH_PERIODback to summary
public static final int DEFAULT_HOSTS_REFRESH_PERIOD

The default value for the hosts refresh value in millis = 0 (disabled)

DEFAULT_MAX_QUERIESback to summary
public static final int DEFAULT_MAX_QUERIES

The default value for the max dns queries per query = 4

DEFAULT_NDOTSback to summary
public static final int DEFAULT_NDOTS

The default ndots value = loads the value from the OS on Linux otherwise use the value 1

DEFAULT_OPT_RESOURCE_ENABLEDback to summary
public static final boolean DEFAULT_OPT_RESOURCE_ENABLED

The default value for setOptResourceEnabled = false

DEFAULT_QUERY_TIMEOUTback to summary
public static final int DEFAULT_QUERY_TIMEOUT

The default value for the query timeout in millis = 5000

DEFAULT_RD_FLAGback to summary
public static final boolean DEFAULT_RD_FLAG

The default value of the rd flag = true

DEFAULT_ROTATE_SERVERSback to summary
public static final boolean DEFAULT_ROTATE_SERVERS

The default servers rotate value = loads the value from the OS on Linux otherwise use the value false

DEFAULT_ROUND_ROBIN_INET_ADDRESSback to summary
public static final boolean DEFAULT_ROUND_ROBIN_INET_ADDRESS

The default round robin inet address = false

DEFAULT_SEACH_DOMAINSback to summary
public static final List<String> DEFAULT_SEACH_DOMAINS

Deprecated

instead use DEFAULT_SEARCH_DOMAINS

The default value of search domains = null

Annotations
@Deprecated
DEFAULT_SEARCH_DOMAINSback to summary
public static final List<String> DEFAULT_SEARCH_DOMAINS

The default value of search domains = null

DEFAULT_SERVERSback to summary
public static final List<String> DEFAULT_SERVERS

The default list of DNS servers = null (uses system name server's list like resolve.conf otherwise Google Public DNS)

hostsPathback to summary
private String hostsPath
hostsRefreshPeriodback to summary
private int hostsRefreshPeriod
hostsValueback to summary
private Buffer hostsValue

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

maxQueriesback to summary
private int maxQueries
ndotsback to summary
private int ndots
optResourceEnabledback to summary
private boolean optResourceEnabled
queryTimeoutback to summary
private long queryTimeout
rdFlagback to summary
private boolean rdFlag
rotateServersback to summary
private boolean rotateServers
roundRobinInetAddressback to summary
private boolean roundRobinInetAddress
searchDomainsback to summary
private List<String> searchDomains
serversback to summary
private List<String> servers

Constructor Detail

AddressResolverOptionsback to summary
public AddressResolverOptions()
AddressResolverOptionsback to summary
public AddressResolverOptions(AddressResolverOptions other)
AddressResolverOptionsback to summary
public AddressResolverOptions(JsonObject json)

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Method Detail

addSearchDomainback to summary
public AddressResolverOptions addSearchDomain(String searchDomain)

Add a DNS search domain.

Parameters
searchDomain:String

the search domain to add

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

addServerback to summary
public AddressResolverOptions addServer(String server)

Add a DNS server address.

Parameters
server:String

the server to add

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

getCacheMaxTimeToLiveback to summary
public int getCacheMaxTimeToLive()
Returns:int

the cache max TTL in seconds

getCacheMinTimeToLiveback to summary
public int getCacheMinTimeToLive()
Returns:int

the cache min TTL in seconds

getCacheNegativeTimeToLiveback to summary
public int getCacheNegativeTimeToLive()
Returns:int

the cache negative TTL in seconds

getHostsPathback to summary
public String getHostsPath()
Returns:String

the path to the alternate hosts configuration file

getHostsRefreshPeriodback to summary
public int getHostsRefreshPeriod()
Returns:int

the hosts configuration refresh period in millis

getHostsValueback to summary
public Buffer getHostsValue()

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Returns:Buffer

the hosts configuration file value

getMaxQueriesback to summary
public int getMaxQueries()
Returns:int

the maximum number of queries to be sent during a resolution

getNdotsback to summary
public int getNdots()
Returns:int

the ndots value

getQueryTimeoutback to summary
public long getQueryTimeout()
Returns:long

the query timeout in milliseconds

getRdFlagback to summary
public boolean getRdFlag()
Returns:boolean

the DNS queries Recursion Desired flag value

getSearchDomainsback to summary
public List<String> getSearchDomains()
Returns:List<String>

the list of search domains

getServersback to summary
public List<String> getServers()
Returns:List<String>

the list of dns server

isOptResourceEnabledback to summary
public boolean isOptResourceEnabled()
Returns:boolean

true if an optional record is automatically included in DNS queries

isRotateServersback to summary
public boolean isRotateServers()
Returns:boolean

the value true when the dns server selection uses round robin

isRoundRobinInetAddressback to summary
public boolean isRoundRobinInetAddress()
Returns:boolean

the value true when the inet address selection uses round robin

setCacheMaxTimeToLiveback to summary
public AddressResolverOptions setCacheMaxTimeToLive(int cacheMaxTimeToLive)

Set the cache maximum TTL value in seconds. After successful resolution IP addresses are cached with their DNS response TTL, use this to set a maximum value to all responses TTL.

Parameters
cacheMaxTimeToLive:int

the cache max TTL in seconds

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setCacheMinTimeToLiveback to summary
public AddressResolverOptions setCacheMinTimeToLive(int cacheMinTimeToLive)

Set the cache minimum TTL value in seconds. After resolution successful IP addresses are cached with their DNS response TTL, use this to set a minimum value to all responses TTL.

Parameters
cacheMinTimeToLive:int

the cache min TTL in seconds

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setCacheNegativeTimeToLiveback to summary
public AddressResolverOptions setCacheNegativeTimeToLive(int cacheNegativeTimeToLive)

Set the negative cache TTL value in seconds. After a failed hostname resolution, DNS queries won't be retried for a period of time equals to the negative TTL. This allows to reduce the response time of negative replies and reduce the amount of messages to DNS servers.

Parameters
cacheNegativeTimeToLive:int

the cache negative TTL in seconds

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setHostsPathback to summary
public AddressResolverOptions setHostsPath(String hostsPath)

Set the path of an alternate hosts configuration file to use instead of the one provided by the os.

The default value is null, so the operating system hosts config is used.

Parameters
hostsPath:String

the hosts path

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setHostsRefreshPeriodback to summary
public AddressResolverOptions setHostsRefreshPeriod(int hostsRefreshPeriod)

Set the hosts configuration refresh period in millis, 0 disables it.

The resolver caches the hosts configuration file after it has read it. When the content of this file can change, setting a positive refresh period will load the configuration file again when necessary.

Parameters
hostsRefreshPeriod:int

the hosts configuration refresh period

setHostsValueback to summary
public AddressResolverOptions setHostsValue(Buffer hostsValue)

References Deprecated

Buffer is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Set an alternate hosts configuration file to use instead of the one provided by the os.

The value should contain the hosts content literaly, for instance 127.0.0.1 localhost

The default value is null, so the operating system hosts config is used.

Parameters
hostsValue:Buffer

the hosts content

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setMaxQueriesback to summary
public AddressResolverOptions setMaxQueries(int maxQueries)

Set the maximum number of queries when an hostname is resolved.

Parameters
maxQueries:int

the max number of queries to be sent

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setNdotsback to summary
public 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.

Parameters
ndots:int

the new ndots value

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setOptResourceEnabledback to summary
public 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.

Parameters
optResourceEnabled:boolean

true to enable, false otherwise

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setQueryTimeoutback to summary
public AddressResolverOptions setQueryTimeout(long queryTimeout)

Set the query timeout in milliseconds, i.e the amount of time after a query is considered to be failed.

Parameters
queryTimeout:long

the query timeout in milliseconds

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setRdFlagback to summary
public AddressResolverOptions setRdFlag(boolean rdFlag)

Set the DNS queries Recursion Desired flag value.

Parameters
rdFlag:boolean

the flag value

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setRotateServersback to summary
public AddressResolverOptions setRotateServers(boolean rotateServers)

Set to 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.

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setRoundRobinInetAddressback to summary
public AddressResolverOptions setRoundRobinInetAddress(boolean roundRobinInetAddress)

Set to true to enable round-robin inet address selection of the ip address to use.

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

setSearchDomainsback to summary
public AddressResolverOptions setSearchDomains(List<String> searchDomains)

Set the lists of DNS search domains.

When the search domain list is null, the effective search domain list will be populated using the system DNS search domains.

Parameters
searchDomains:List<String>

the search domains

setServersback to summary
public 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}. 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".

Parameters
servers:List<String>

the list of DNS servers

Returns:AddressResolverOptions

a reference to this, so the API can be used fluently

toJsonback to summary
public JsonObject toJson()

References Deprecated

JsonObject is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.