Class DNSLookup

java.lang.Object
net.apartium.cocoabeans.utils.DNSLookup

@AvailableSince("0.0.45") public class DNSLookup extends Object
A utility for performing DNS lookups
See Also:
  • Constructor Details

    • DNSLookup

      public DNSLookup(InitialDirContext context)
      Create a DNSLookup class with custom options
      Parameters:
      context - initial dir context
  • Method Details

    • withDefaultOptions

      public static DNSLookup withDefaultOptions()
      Create a DNSLookup instance with sane defaults
      Returns:
      a new DNSLookup instance
    • reverseLookup

      public String reverseLookup(InetAddress address) throws NamingException
      Perform a reverse DNS lookup on given address
      Parameters:
      address - address to lookup
      Returns:
      reverse hostname
      Throws:
      NamingException - if a problem has occurred during lookup
    • lookup

      public List<String> lookup(String hostName, String recordType) throws NamingException
      Perform a simple forward lookup
      Parameters:
      hostName - hostname to lookup
      recordType - record type
      Returns:
      lookup results
      Throws:
      NamingException - if there were dns lookup issues
      NameNotFoundException - if name is not found