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`
    `static int` | `DEFAULT_CACHE_MIN_TIME_TO_LIVE`
    `static int` | `DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE`
    `static int` | `DEFAULT_MAX_QUERIES`
    `static int` | `DEFAULT_NDOTS` The default ndots value = -1 (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)` = true
    `static int` | `DEFAULT_QUERY_TIMEOUT`
    `static boolean` | `DEFAULT_RD_FLAG`
    `static List<String>` | `DEFAULT_SEACH_DOMAINS`
    `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.
    `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()`
    `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` | `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, finalize, getClass, 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)` = true
      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_MIN_TIME_TO_LIVE

          public static final int DEFAULT_CACHE_MIN_TIME_TO_LIVE

      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_MAX_TIME_TO_LIVE

          public static final int DEFAULT_CACHE_MAX_TIME_TO_LIVE

      See Also:
        Constant Field Values

    - #### DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE

          public static final int DEFAULT_CACHE_NEGATIVE_TIME_TO_LIVE

      See Also:
        Constant Field Values

    - #### DEFAULT_QUERY_TIMEOUT

          public static final int DEFAULT_QUERY_TIMEOUT

      See Also:
        Constant Field Values

    - #### DEFAULT_MAX_QUERIES

          public static final int DEFAULT_MAX_QUERIES

      See Also:
        Constant Field Values

    - #### DEFAULT_RD_FLAG

          public static final boolean DEFAULT_RD_FLAG

      See Also:
        Constant Field Values

    - #### DEFAULT_SEACH_DOMAINS

          public static final List<String> DEFAULT_SEACH_DOMAINS

    - #### DEFAULT_NDOTS

          public static final int DEFAULT_NDOTS

      The default ndots value = -1 (loads the value from the OS on Linux otherwise use the value 1)
      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

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toJson

          public JsonObject toJson()

Copyright © 2016. All rights reserved.