Klasse DnsLookupExtensions

java.lang.Object
io.github.astrapi69.net.dns.DnsLookupExtensions

public final class DnsLookupExtensions extends Object
Utility class for performing DNS lookups, reverse lookups, and running external DNS commands like nslookup and dig
  • Felddetails

    • PUBLIC_DNS_SERVER_OF_GOOGLE

      public static final String PUBLIC_DNS_SERVER_OF_GOOGLE
      Public DNS server of Google
      Siehe auch:
  • Methodendetails

    • resolveDomain

      public static List<String> resolveDomain(String domain) throws UnknownHostException
      Resolves a domain name using the default system DNS resolver
      Parameter:
      domain - the domain name (e.g., "google.com")
      Gibt zurück:
      the resolved IP addresses
      Löst aus:
      UnknownHostException - if the domain cannot be resolved
    • reverseLookup

      public static String reverseLookup(String ipAddress) throws UnknownHostException
      Performs a reverse DNS lookup to find the hostname for a given IP address
      Parameter:
      ipAddress - the IP address (e.g., "8.8.8.8")
      Gibt zurück:
      the resolved hostname
      Löst aus:
      UnknownHostException - if the IP address cannot be resolved
    • runNslookup

      public static String runNslookup(String domain) throws IOException
      Runs the nslookup command for a given domain and returns the output
      Parameter:
      domain - the domain to look up (e.g., "google.com")
      Gibt zurück:
      the output of the nslookup command
      Löst aus:
      IOException - if an error occurs while executing the command
    • runDig

      public static String runDig(String domain) throws IOException
      Runs the dig command for a given domain and returns the output
      Parameter:
      domain - the domain to look up (e.g., "google.com")
      Gibt zurück:
      the output of the dig command
      Löst aus:
      IOException - if an error occurs while executing the command