io.vertx.core.dns

## Class AddressResolverOptions

- java.lang.Object
- - io.vertx.core.dns.AddressResolverOptions

-     public class AddressResolverOptions
      extends Object

  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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `DEFAULT_CACHE_MAX_TIME_TO_LIVE` The default value for the cache max TTL = 0x7fffffff
    `static int` | `DEFAULT_CACHE_MIN_TIME_TO_LIVE` The default value for the 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 Summary

    Constructors
    Constructor and Description
    `AddressResolverOptions()`
    `AddressResolverOptions(AddressResolverOptions other)`
    `AddressResolverOptions(JsonObject json)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AddressResolverOptions` | `addSearchDomain(String searchDomain)` Add a DNS search domain.
    `AddressResolverOptions` | `addServer(String server)` Add a DNS server address.
    `int` | `getCacheMaxTimeToLive()`
    `int` | `getCacheMinTimeToLive()`
    `int` | `getCacheNegativeTimeToLive()`
    `String` | `getHostsPath()`
    `Buffer` | `getHostsValue()`
    `int` | `getMaxQueries()`
    `int` | `getNdots()`
    `long` | `getQueryTimeout()`
    `boolean` | `getRdFlag()`
    `List<String>` | `getSearchDomains()`
    `List<String>` | `getServers()`
    `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()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_SERVERS

          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)

    - #### DEFAULT_OPT_RESOURCE_ENABLED

          public static final boolean DEFAULT_OPT_RESOURCE_ENABLED

      The default value for `setOptResourceEnabled(boolean)` = false
      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_MIN_TIME_TO_LIVE

          public static final int DEFAULT_CACHE_MIN_TIME_TO_LIVE

      The default value for the cache min TTL = 0
      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_MAX_TIME_TO_LIVE

          public static final int DEFAULT_CACHE_MAX_TIME_TO_LIVE

      The default value for the cache max TTL = 0x7fffffff
      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE

          public static final int DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE

      The default value for the negative cache TTL = 0
      See Also:
        Constant Field Values

    - #### DEFAULT_QUERY_TIMEOUT

          public static final int DEFAULT_QUERY_TIMEOUT

      The default value for the query timeout in millis = 5000
      See Also:
        Constant Field Values

    - #### DEFAULT_MAX_QUERIES

          public static final int DEFAULT_MAX_QUERIES

      The default value for the max dns queries per query = 4
      See Also:
        Constant Field Values

    - #### DEFAULT_RD_FLAG

          public static final boolean DEFAULT_RD_FLAG

      The default value of the rd flag = true
      See Also:
        Constant Field Values

    - #### DEFAULT_SEACH_DOMAINS

          public static final List<String> DEFAULT_SEACH_DOMAINS

      The default value of search domains = null

    - #### DEFAULT_NDOTS

          public static final int DEFAULT_NDOTS

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

    - #### DEFAULT_ROTATE_SERVERS

          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_ADDRESS

          public static final boolean DEFAULT_ROUND_ROBIN_INET_ADDRESS

      The default round robin inet address = false
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### AddressResolverOptions

          public AddressResolverOptions()

    - #### AddressResolverOptions

          public AddressResolverOptions(AddressResolverOptions other)

    - #### AddressResolverOptions

          public AddressResolverOptions(JsonObject json)

  - ### Method Detail

    - #### getHostsPath

          public String getHostsPath()

      Returns:
        the path to the alternate hosts configuration file

    - #### setHostsPath

          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` - the hosts path
      Returns:
        a reference to this, so the API can be used fluently

    - #### getHostsValue

          public Buffer getHostsValue()

      Returns:
        the hosts configuration file value

    - #### setHostsValue

          public AddressResolverOptions setHostsValue(Buffer hostsValue)

      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` - the hosts content
      Returns:
        a reference to this, so the API can be used fluently

    - #### getServers

          public List<String> getServers()

      Returns:
        the list of dns server

    - #### setServers

          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` - the list of DNS servers
      Returns:
        a reference to this, so the API can be used fluently

    - #### addServer

          public AddressResolverOptions addServer(String server)

      Add a DNS server address.
      Parameters:
        `server` - the server to add
      Returns:
        a reference to this, so the API can be used fluently

    - #### isOptResourceEnabled

          public boolean isOptResourceEnabled()

      Returns:
        true if an optional record is automatically included in DNS queries

    - #### setOptResourceEnabled

          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` - true to enable, false otherwise
      Returns:
        a reference to this, so the API can be used fluently

    - #### getCacheMinTimeToLive

          public int getCacheMinTimeToLive()

      Returns:
        the cache min TTL in seconds

    - #### setCacheMinTimeToLive

          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` - the cache min TTL in seconds
      Returns:
        a reference to this, so the API can be used fluently

    - #### getCacheMaxTimeToLive

          public int getCacheMaxTimeToLive()

      Returns:
        the cache max TTL in seconds

    - #### setCacheMaxTimeToLive

          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` - the cache max TTL in seconds
      Returns:
        a reference to this, so the API can be used fluently

    - #### getCacheNegativeTimeToLive

          public int getCacheNegativeTimeToLive()

      Returns:
        the cache negative TTL in seconds

    - #### setCacheNegativeTimeToLive

          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` - the cache negative TTL in seconds
      Returns:
        a reference to this, so the API can be used fluently

    - #### getQueryTimeout

          public long getQueryTimeout()

      Returns:
        the query timeout in milliseconds

    - #### setQueryTimeout

          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` - the query timeout in milliseconds
      Returns:
        a reference to this, so the API can be used fluently

    - #### getMaxQueries

          public int getMaxQueries()

      Returns:
        the maximum number of queries to be sent during a resolution

    - #### setMaxQueries

          public AddressResolverOptions setMaxQueries(int maxQueries)

      Set the maximum number of queries when an hostname is resolved.
      Parameters:
        `maxQueries` - the max number of queries to be sent
      Returns:
        a reference to this, so the API can be used fluently

    - #### getRdFlag

          public boolean getRdFlag()

      Returns:
        the DNS queries Recursion Desired flag value

    - #### setRdFlag

          public AddressResolverOptions setRdFlag(boolean rdFlag)

      Set the DNS queries Recursion Desired flag value.
      Parameters:
        `rdFlag` - the flag value
      Returns:
        a reference to this, so the API can be used fluently

    - #### getSearchDomains

          public List<String> getSearchDomains()

      Returns:
        the list of search domains

    - #### setSearchDomains

          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` - the search domains

    - #### addSearchDomain

          public AddressResolverOptions addSearchDomain(String searchDomain)

      Add a DNS search domain.
      Parameters:
        `searchDomain` - the search domain to add
      Returns:
        a reference to this, so the API can be used fluently

    - #### getNdots

          public int getNdots()

      Returns:
        the ndots value

    - #### setNdots

          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` - the new ndots value
      Returns:
        a reference to this, so the API can be used fluently

    - #### isRotateServers

          public boolean isRotateServers()

      Returns:
        the value `true` when the dns server selection uses round robin

    - #### setRotateServers

          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:
        a reference to this, so the API can be used fluently

    - #### isRoundRobinInetAddress

          public boolean isRoundRobinInetAddress()

      Returns:
        the value `true` when the inet address selection uses round robin

    - #### setRoundRobinInetAddress

          public AddressResolverOptions setRoundRobinInetAddress(boolean roundRobinInetAddress)

      Set to `true` to enable round-robin inet address selection of the ip address to use.
      Returns:
        a reference to this, so the API can be used fluently

    - #### toJson

          public JsonObject toJson()

Copyright © 2024 Eclipse. All rights reserved.