Class ReliableDnsClient

java.lang.Object
org.minidns.AbstractDnsClient
org.minidns.iterative.ReliableDnsClient

public class ReliableDnsClient extends org.minidns.AbstractDnsClient
A DNS client using a reliable strategy. First the configured resolver of the system are used, then, in case there is no answer, a fall back to iterative resolving is performed.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     

    Nested classes/interfaces inherited from class org.minidns.AbstractDnsClient

    org.minidns.AbstractDnsClient.IpVersionSetting
  • Field Summary

    Fields inherited from class org.minidns.AbstractDnsClient

    cache, dataSource, DEFAULT_CACHE, DEFAULT_IP_VERSION_SETTING, insecureRandom, ipVersionSetting, LOGGER, random
  • Constructor Summary

    Constructors
    Constructor
    Description
     
    ReliableDnsClient(org.minidns.DnsCache dnsCache)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected String
    isResponseAcceptable(org.minidns.dnsmessage.DnsMessage response)
    Check if the response from the system's nameserver is acceptable.
    protected boolean
    isResponseCacheable(org.minidns.dnsmessage.Question q, org.minidns.dnsqueryresult.DnsQueryResult result)
     
    protected org.minidns.dnsmessage.DnsMessage.Builder
    newQuestion(org.minidns.dnsmessage.DnsMessage.Builder questionMessage)
     
    protected org.minidns.dnsqueryresult.DnsQueryResult
    query(org.minidns.dnsmessage.DnsMessage.Builder q)
     
    void
    setDataSource(org.minidns.source.DnsDataSource dataSource)
     
    void
    Set the mode used when resolving queries.
    void
    setUseHardcodedDnsServers(boolean useHardcodedDnsServers)
     

    Methods inherited from class org.minidns.AbstractDnsClient

    getCache, getCachedIPv4AddressesFor, getCachedIPv4NameserverAddressesFor, getCachedIPv6AddressesFor, getCachedIPv6NameserverAddressesFor, getCachedNameserverRecordsFor, getDataSource, getPreferedIpVersion, getQueryFor, query, query, query, query, query, query, query, query, query, query, query, queryAsync, queryAsync, queryAsync, queryAsync, queryAsync, setDefaultIpVersion, setPreferedIpVersion

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ReliableDnsClient

      public ReliableDnsClient(org.minidns.DnsCache dnsCache)
    • ReliableDnsClient

      public ReliableDnsClient()
  • Method Details

    • query

      protected org.minidns.dnsqueryresult.DnsQueryResult query(org.minidns.dnsmessage.DnsMessage.Builder q) throws IOException
      Specified by:
      query in class org.minidns.AbstractDnsClient
      Throws:
      IOException
    • newQuestion

      protected org.minidns.dnsmessage.DnsMessage.Builder newQuestion(org.minidns.dnsmessage.DnsMessage.Builder questionMessage)
      Specified by:
      newQuestion in class org.minidns.AbstractDnsClient
    • isResponseCacheable

      protected boolean isResponseCacheable(org.minidns.dnsmessage.Question q, org.minidns.dnsqueryresult.DnsQueryResult result)
      Overrides:
      isResponseCacheable in class org.minidns.AbstractDnsClient
    • isResponseAcceptable

      protected String isResponseAcceptable(org.minidns.dnsmessage.DnsMessage response)
      Check if the response from the system's nameserver is acceptable. Must return null if the response is acceptable, or a String describing why it is not acceptable. If the response is not acceptable then ReliableDnsClient will fall back to resolve the query iteratively.
      Parameters:
      response - the response we got from the system's nameserver.
      Returns:
      null if the response is acceptable, or a String if not.
    • setDataSource

      public void setDataSource(org.minidns.source.DnsDataSource dataSource)
      Overrides:
      setDataSource in class org.minidns.AbstractDnsClient
    • setMode

      public void setMode(ReliableDnsClient.Mode mode)
      Set the mode used when resolving queries.
      Parameters:
      mode - the mode to use.
    • setUseHardcodedDnsServers

      public void setUseHardcodedDnsServers(boolean useHardcodedDnsServers)