Class 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 class  ReliableDnsClient.Mode  
      • 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
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.lang.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 setMode​(ReliableDnsClient.Mode mode)
      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 Detail

      • ReliableDnsClient

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

        public ReliableDnsClient()
    • Method Detail

      • query

        protected org.minidns.dnsqueryresult.DnsQueryResult query​(org.minidns.dnsmessage.DnsMessage.Builder q)
                                                           throws java.io.IOException
        Specified by:
        query in class org.minidns.AbstractDnsClient
        Throws:
        java.io.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 java.lang.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)