Reverse DNS of a client address, and whether the forward lookup of the name confirms it (forward-confirmed reverse DNS, FCrDNS).
ReverseDNS.check(resolver, {192, 0, 2, 1})
#=> {:ok, "mail.example.com"}check/3 looks up the PTR names of the address, then the addresses of
each name: A records for an IPv4 client, AAAA for IPv6. The first name
with the client's address among them is the confirmed hostname. Names
are lower-cased, and names that are not valid domains are skipped.
IPv4-mapped IPv6 addresses are checked as IPv4.
Options
:max_names- how many PTR names to check. Defaults to 10, the limit RFC 7208 §4.6.4 sets for SPF'sptr.
Summary
Functions
Looks up the reverse DNS of ip and confirms it. See the module documentation.
Returns the PTR name of ip, in in-addr.arpa or ip6.arpa.
Types
The result of check/3:
{:ok, hostname}- a PTR name whose addresses include the client.{:unconfirmed, names}- PTR names, none of which confirms it.:none- no PTR records, or none that is a valid domain name.{:error, :temporary}- a DNS error; a retry might confirm a name.
Functions
@spec check(Sovite.DNS.resolver(), :inet.ip_address(), keyword()) :: result()
Looks up the reverse DNS of ip and confirms it. See the module documentation.
@spec reverse_name(:inet.ip_address()) :: String.t()
Returns the PTR name of ip, in in-addr.arpa or ip6.arpa.
iex> Sovite.Abuse.ReverseDNS.reverse_name({192, 0, 2, 1})
"1.2.0.192.in-addr.arpa"