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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanaddBlacklistedDnsServer(String dnsServer) static voidaddDnsServerLookupMechanism(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 QuestiongetReverseIpLookupQuestionFor(Inet4Address inet4Address) static QuestiongetReverseIpLookupQuestionFor(Inet6Address inet6Address) static QuestiongetReverseIpLookupQuestionFor(InetAddress inetAddress) booleanbooleanbooleanprotected DnsMessage.BuildernewQuestion(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 booleanremoveBlacklistedDnsServer(String dnsServer) static booleanremoveDNSServerLookupMechanism(DnsServerLookupMechanism dnsServerLookup) voidsetAskForDnssec(boolean askForDnssec) voidsetDisableResultFilter(boolean disableResultFilter) voidsetUseHardcodedDnsServers(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:
newQuestionin classAbstractDnsClient
-
query
Description copied from class:AbstractDnsClientSend a query request to the DNS system.- Specified by:
queryin 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:AbstractDnsClientDefault implementation of an asynchronous DNS query which just wraps the synchronous case.Subclasses override this method to support true asynchronous queries.
- Overrides:
queryAsyncin 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
DnsServerLookupMechanisms.- 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
-