Package org.minidns.iterative
Class IterativeDnsClient
java.lang.Object
org.minidns.AbstractDnsClient
org.minidns.iterative.IterativeDnsClient
-
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
ConstructorDescriptionCreate 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
Modifier and TypeMethodDescriptionprotected static void
abortIfFatal
(IOException ioException) static List
<InetAddress> getRootServer
(char rootServerId) static List
<InetAddress> getRootServer
(char rootServerId, AbstractDnsClient.IpVersionSetting setting) protected boolean
isResponseCacheable
(Question q, DnsQueryResult result) Whether a response from the DNS system should be cached or not.protected DnsMessage.Builder
newQuestion
(DnsMessage.Builder message) protected DnsQueryResult
query
(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 Details
-
IterativeDnsClient
public IterativeDnsClient()Create a new recursive DNS client using the global default cache. -
IterativeDnsClient
Create a new recursive DNS client with the given DNS cache.- Parameters:
cache
- The backend DNS cache.
-
-
Method Details
-
query
Recursively query the DNS system for one entry.- Specified by:
query
in classAbstractDnsClient
- Parameters:
queryBuilder
- The query DNS message builder.- Returns:
- The response (or null on timeout/error).
- Throws:
IOException
- if an IO error occurs.
-
getRootServer
-
getRootServer
public static List<InetAddress> getRootServer(char rootServerId, AbstractDnsClient.IpVersionSetting setting) -
isResponseCacheable
Description copied from class:AbstractDnsClient
Whether a response from the DNS system should be cached or not.- Overrides:
isResponseCacheable
in 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
- Specified by:
newQuestion
in classAbstractDnsClient
-
abortIfFatal
- Throws:
IOException
-