Class DNSUtils

java.lang.Object
org.apache.drill.exec.udfs.DNSUtils

public class DNSUtils extends Object
Utility class which contains various methods for performing DNS resolution and WHOIS lookups in Drill UDFs.
  • Constructor Details

    • DNSUtils

      public DNSUtils()
  • Method Details

    • getDNS

      public static void getDNS(String domainName, String resolverName, BaseWriter.ComplexWriter out, DrillBuf buffer) throws org.xbill.DNS.TextParseException
      Performs the actual DNS lookup and returns the results in a BaseWriter.ComplexWriter. If the resolver is not null, we will use the provided resolver. If a resolver is not provided, we'll use the local cache.

      Relating to the resolver, you can specify an IP or host, or you can use a name of a known resolver. Known resolvers are:

      • cloudflare
      • cloudflare_secondary
      • google
      • google_secondary
      • verisign
      • verisign_secondary
      • yandex
      • yandex_secondary

      Parameters:
      domainName - A String of a domain for which you want to look up.
      resolverName - A String containing the resolver name.
      out - The BaseWriter.ComplexWriter to which the DNS results will be written.
      buffer - The DrillBuf to which the data will be written.
      Throws:
      org.xbill.DNS.TextParseException - If the resolver is unparsable, throw an exception.
    • getDNS

      public static void getDNS(String domainName, BaseWriter.ComplexWriter out, DrillBuf buffer) throws org.xbill.DNS.TextParseException
      Performs the actual DNS lookup and returns the results in a BaseWriter.ComplexWriter. Uses the local cache as the DNS resolver.
      Parameters:
      domainName - A String of a domain for which you want to look up.
      out - The BaseWriter.ComplexWriter to which the DNS results will be written.
      buffer - The DrillBuf to which the data will be written.
      Throws:
      org.xbill.DNS.TextParseException - If the domain is unparsable, throw an exception.
    • whois

      public static void whois(String domainName, BaseWriter.ComplexWriter out, DrillBuf buffer)
      Performs a WHOIS lookup and populates the results into a Drill map. This method uses a default server.
      Parameters:
      domainName - The input domain name.
      out - A BaseWriter.ComplexWriter to which the results will be written
      buffer - A DrillBuf which contains the output
    • whois

      public static void whois(String domainName, String whoisServer, BaseWriter.ComplexWriter out, DrillBuf buffer)
      Performs a WHOIS lookup and populates the results into a Drill map. This method uses a default server.
      Parameters:
      domainName - The input domain name.
      whoisServer - A String containing the whois server
      out - A BaseWriter.ComplexWriter to which the results will be written
      buffer - A DrillBuf which contains the output