dns v2.1.2 DNS

Link to this section Summary

Functions

Queries the DNS server and returns the result

Link to this section Functions

Link to this function query(domain, type \\ :a, dns_server \\ {"8.8.8.8", 53})

Queries the DNS server and returns the result

Examples:

iex> DNS.query("tungdao.com")                              # <= Queries for A records
iex> DNS.query("tungdao.com", :mx)                         # <= Queries for the MX records
iex> DNS.query("tungdao.com", :a, { "208.67.220.220", 53}) # <= Queries for A records, using OpenDNS
Link to this function resolve(domain, type \\ :a, dns_server \\ {"8.8.8.8", 53})
resolve(charlist(), atom(), {String.t(), :inet.port()}) ::
  {atom(), :inet.ip()} | {atom(), atom()}

Resolves the answer for a DNS query

Example:

iex> DNS.resolve("tungdao.com")                      # {:ok, [{1, 1, 1, 1}]}
iex> DNS.resolve("tungdao.com", :txt)                # {:ok, [['v=spf1 a mx ~all']]}
iex> DNS.resolve("tungdao.com", :a, {"8.8.8.8", 53}) # {:ok, [{1, 1, 1, 1}]}