Class DnsResolveTest


  • public class DnsResolveTest
    extends java.lang.Object
    Resolve a host name to the corresponding IPV4 and IPV6 addresses and get the TTL(s). In addition, it also measures how long the DNS queries take.
    • Constructor Summary

      Constructors 
      Constructor Description
      DnsResolveTest​(java.lang.String dnsServer)
      Create a new instance.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearResolveLog()
      Clear the resolve log.
      JsonArray getResolvedAAAARecords()
      Get a JSON array of the resolved AAAA records which contains for each array element the resolved IP address and the TTL.
      JsonArray getResolvedARecords()
      Get a JSON array of the resolved A records which contains for each array element the resolved IP address and the TTL.
      java.util.ArrayList<java.lang.String> getResolveLog()
      Get the resolve log.
      long getResolveTimeMillis()
      Get the resolve time of the last performed resolve.
      boolean resolveRecordTypeA​(java.lang.String hostname)
      Resolve the IPv4 addresses for a host name.
      boolean resolveRecordTypeAAAA​(java.lang.String hostname)
      Resolve the IPv6 addresses for a host name.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DnsResolveTest

        public DnsResolveTest​(java.lang.String dnsServer)
        Create a new instance.
        Parameters:
        dnsServer - the IP address or host name of the DNS server.
    • Method Detail

      • resolveRecordTypeA

        public boolean resolveRecordTypeA​(java.lang.String hostname)
        Resolve the IPv4 addresses for a host name.
        Parameters:
        hostname - the host name
        Returns:
        true if at least one IPv4 address could be resolved, else false
        See Also:
        getResolvedARecords()
      • getResolvedARecords

        public JsonArray getResolvedARecords()
        Get a JSON array of the resolved A records which contains for each array element the resolved IP address and the TTL.
        Returns:
        a JSON array of the resolved A records which contains for each array element the resolved IP address and the TTL
        See Also:
        resolveRecordTypeA(String)
      • resolveRecordTypeAAAA

        public boolean resolveRecordTypeAAAA​(java.lang.String hostname)
        Resolve the IPv6 addresses for a host name.
        Parameters:
        hostname - the host name
        Returns:
        true if at least one IPv6 address could be resolved, else false
        See Also:
        getResolvedAAAARecords()
      • getResolvedAAAARecords

        public JsonArray getResolvedAAAARecords()
        Get a JSON array of the resolved AAAA records which contains for each array element the resolved IP address and the TTL.
        Returns:
        a JSON array of the resolved AAAA records which contains for each array element the resolved IP address and the TTL
        See Also:
        resolveRecordTypeAAAA(String)
      • getResolveLog

        public java.util.ArrayList<java.lang.String> getResolveLog()
        Get the resolve log.
        Returns:
        the resolve log
      • clearResolveLog

        public void clearResolveLog()
        Clear the resolve log.
      • getResolveTimeMillis

        public long getResolveTimeMillis()
        Get the resolve time of the last performed resolve.
        Returns:
        the resolve time of the last performed resolve in milliseconds, or -1 if no such data are available