Package org.minidns.iterative
Class ReliableDnsClient
java.lang.Object
org.minidns.AbstractDnsClient
org.minidns.iterative.ReliableDnsClient
- Direct Known Subclasses:
DnssecClient
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/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
-
Method Summary
Modifier and TypeMethodDescriptionprotected String
isResponseAcceptable
(DnsMessage response) Check if the response from the system's nameserver is acceptable.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 questionMessage) protected DnsQueryResult
Send a query request to the DNS system.void
setDataSource
(DnsDataSource dataSource) Set aDnsDataSource
to be used by the DnsClient.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
-
Constructor Details
-
ReliableDnsClient
-
ReliableDnsClient
public ReliableDnsClient()
-
-
Method Details
-
query
Description copied from class:AbstractDnsClient
Send a query request to the DNS system.- Specified by:
query
in classAbstractDnsClient
- Parameters:
q
- The query to send to the server.- Returns:
- The response (or null).
- Throws:
IOException
- if an IO error occurs.
-
newQuestion
- Specified by:
newQuestion
in classAbstractDnsClient
-
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.
-
isResponseAcceptable
Check if the response from the system's nameserver is acceptable. Must returnnull
if the response is acceptable, or a String describing why it is not acceptable. If the response is not acceptable thenReliableDnsClient
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
Description copied from class:AbstractDnsClient
Set aDnsDataSource
to be used by the DnsClient. The default implementation will direct all queries directly to the Internet. This can be used to define a non-default handling for outgoing data. This can be useful to redirect the requests to a proxy or to modify requests after or responses before they are handled by the DnsClient implementation.- Overrides:
setDataSource
in classAbstractDnsClient
- Parameters:
dataSource
- An implementation of DNSDataSource that shall be used.
-
setMode
Set the mode used when resolving queries.- Parameters:
mode
- the mode to use.
-
setUseHardcodedDnsServers
-