Package org.minidns
Class DnsClient
java.lang.Object
org.minidns.AbstractDnsClient
org.minidns.DnsClient
A minimal DNS client for SRV/A/AAAA/NS and CNAME lookups, with IDN support.
This circumvents the missing javax.naming package on android.
-
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 TypeMethodDescriptionstatic boolean
addBlacklistedDnsServer
(String dnsServer) static void
addDnsServerLookupMechanism
(DnsServerLookupMechanism dnsServerLookup) findDNS()
Retrieve a list of currently configured DNS servers IP addresses.static List
<InetAddress> Retrieve a list of currently configured DNS server addresses.static Question
getReverseIpLookupQuestionFor
(Inet4Address inet4Address) static Question
getReverseIpLookupQuestionFor
(Inet6Address inet6Address) static Question
getReverseIpLookupQuestionFor
(InetAddress inetAddress) boolean
boolean
boolean
protected DnsMessage.Builder
newQuestion
(DnsMessage.Builder message) query
(DnsMessage.Builder queryBuilder) Send a query request to the DNS system.protected MiniDnsFuture
<DnsQueryResult, IOException> queryAsync
(DnsMessage.Builder queryBuilder) Default implementation of an asynchronous DNS query which just wraps the synchronous case.static boolean
removeBlacklistedDnsServer
(String dnsServer) static boolean
removeDNSServerLookupMechanism
(DnsServerLookupMechanism dnsServerLookup) void
setAskForDnssec
(boolean askForDnssec) void
setDisableResultFilter
(boolean disableResultFilter) void
setUseHardcodedDnsServers
(boolean useHardcodedDnsServers) Methods inherited from class org.minidns.AbstractDnsClient
getCache, getCachedIPv4AddressesFor, getCachedIPv4NameserverAddressesFor, getCachedIPv6AddressesFor, getCachedIPv6NameserverAddressesFor, getCachedNameserverRecordsFor, getDataSource, getPreferedIpVersion, getQueryFor, isResponseCacheable, query, query, query, query, query, query, query, query, query, query, query, queryAsync, queryAsync, queryAsync, queryAsync, setDataSource, setDefaultIpVersion, setPreferedIpVersion
-
Constructor Details
-
DnsClient
public DnsClient()Create a new DNS client using the global default cache. -
DnsClient
-
-
Method Details
-
newQuestion
- Specified by:
newQuestion
in classAbstractDnsClient
-
query
Description copied from class:AbstractDnsClient
Send a query request to the DNS system.- Specified by:
query
in classAbstractDnsClient
- Parameters:
queryBuilder
- The query to send to the server.- Returns:
- The response (or null).
- Throws:
IOException
- if an IO error occurs.
-
queryAsync
Description copied from class:AbstractDnsClient
Default implementation of an asynchronous DNS query which just wraps the synchronous case.Subclasses override this method to support true asynchronous queries.
- Overrides:
queryAsync
in classAbstractDnsClient
- Parameters:
queryBuilder
- the query.- Returns:
- a future for this query.
-
findDNS
Retrieve a list of currently configured DNS servers IP addresses. This method does verify that only IP addresses are returned and nothing else (e.g. DNS names).The addresses are discovered by using one (or more) of the configured
DnsServerLookupMechanism
s.- Returns:
- A list of DNS server IP addresses configured for this system.
-
findDnsAddresses
Retrieve a list of currently configured DNS server addresses.Note that unlike
findDNS()
, the list returned by this method will take the IP version setting into account, and order the list by the preferred address types (IPv4/v6). The returned list is modifiable.- Returns:
- A list of DNS server addresses.
- See Also:
-
addDnsServerLookupMechanism
-
removeDNSServerLookupMechanism
-
addBlacklistedDnsServer
-
removeBlacklistedDnsServer
-
isAskForDnssec
-
setAskForDnssec
-
isDisableResultFilter
-
setDisableResultFilter
-
isUseHardcodedDnsServersEnabled
-
setUseHardcodedDnsServers
-
getRandomHardcodedIpv4DnsServer
-
getRandomHarcodedIpv6DnsServer
-
getReverseIpLookupQuestionFor
-
getReverseIpLookupQuestionFor
-
getReverseIpLookupQuestionFor
-