Package org.minidns.iterative
Class IterativeDnsClient
- java.lang.Object
-
- org.minidns.AbstractDnsClient
-
- org.minidns.iterative.IterativeDnsClient
-
public class IterativeDnsClient extends AbstractDnsClient
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.minidns.AbstractDnsClient
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 IterativeDnsClient()Create a new recursive DNS client using the global default cache.IterativeDnsClient(DnsCache cache)Create a new recursive DNS client with the given DNS cache.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidabortIfFatal(IOException ioException)static List<InetAddress>getRootServer(char rootServerId)static List<InetAddress>getRootServer(char rootServerId, AbstractDnsClient.IpVersionSetting setting)protected booleanisResponseCacheable(Question q, DnsQueryResult result)Whether a response from the DNS system should be cached or not.protected DnsMessage.BuildernewQuestion(DnsMessage.Builder message)protected DnsQueryResultquery(DnsMessage.Builder queryBuilder)Recursively query the DNS system for one entry.-
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, setDataSource, setDefaultIpVersion, setPreferedIpVersion
-
-
-
-
Constructor Detail
-
IterativeDnsClient
public IterativeDnsClient()
Create a new recursive DNS client using the global default cache.
-
IterativeDnsClient
public IterativeDnsClient(DnsCache cache)
Create a new recursive DNS client with the given DNS cache.- Parameters:
cache- The backend DNS cache.
-
-
Method Detail
-
query
protected DnsQueryResult query(DnsMessage.Builder queryBuilder) throws IOException
Recursively query the DNS system for one entry.- Specified by:
queryin classAbstractDnsClient- Parameters:
queryBuilder- The query DNS message builder.- Returns:
- The response (or null on timeout/error).
- Throws:
IOException- if an IO error occurs.
-
getRootServer
public static List<InetAddress> getRootServer(char rootServerId)
-
getRootServer
public static List<InetAddress> getRootServer(char rootServerId, AbstractDnsClient.IpVersionSetting setting)
-
isResponseCacheable
protected boolean isResponseCacheable(Question q, DnsQueryResult result)
Description copied from class:AbstractDnsClientWhether a response from the DNS system should be cached or not.- Overrides:
isResponseCacheablein classAbstractDnsClient- Parameters:
q- The question the response message should answer.result- The DNS query result.- Returns:
- True, if the response should be cached, false otherwise.
-
newQuestion
protected DnsMessage.Builder newQuestion(DnsMessage.Builder message)
- Specified by:
newQuestionin classAbstractDnsClient
-
abortIfFatal
protected static void abortIfFatal(IOException ioException) throws IOException
- Throws:
IOException
-
-