Current section
Files
Jump to
Current section
Files
lib/internet_mapper/dns_lookup.ex
defmodule InternetMapper.DNSLookup do
# Direct DNS lookup without caching
def lookup(ip) when is_binary(ip) do
case :inet.gethostbyaddr(String.to_charlist(ip)) do
{:ok, {:hostent, hostname, _aliases, _addrtype, _length, _addresses}} ->
to_string(hostname)
{:error, _} ->
"N/A"
end
end
end