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 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_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` | `addServer(String server)` Add a DNS server address.
    `boolean` | `equals(Object o)`
    `int` | `getCacheMaxTimeToLive()`
    `int` | `getCacheMinTimeToLive()`
    `int` | `getCacheNegativeTimeToLive()`
    `String` | `getHostsPath()`
    `Buffer` | `getHostsValue()`
    `int` | `getMaxQueries()`
    `long` | `getQueryTimeout()`
    `boolean` | `getRdFlag()`
    `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` | `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` | `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

  - ### 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

    - #### 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.