This module performs DNS name resolving to recursive name servers.
See also
This DNS client can resolve DNS records even if it is not used for normal name resolving in the node.
This is not a full-fledged resolver, only a DNS client that relies on asking trusted recursive name servers.
UDP queries are used unless resolver option
When EDNS is enabled (resolver option
For UDP queries, resolver options
For queries not using the
The following data types concern the resolver:
A string with no adjacent dots.
This is the start of a hiearchy of opaque data structures
that can be examined with access functions in
dns_msg() = DnsMsg inet_dns:msg(DnsMsg) -> [ {header, dns_header()} | {qdlist, dns_query()} | {anlist, dns_rr()} | {nslist, dns_rr()} | {arlist, dns_rr()} ] inet_dns:msg(DnsMsg, header) -> dns_header() % for example inet_dns:msg(DnsMsg, Field) -> Value dns_header() = DnsHeader inet_dns:header(DnsHeader) -> [ {id, integer()} | {qr, boolean()} | {opcode, query | iquery | status | integer()} | {aa, boolean()} | {tc, boolean()} | {rd, boolean()} | {ra, boolean()} | {pr, boolean()} | {rcode, integer(0..16)} ] inet_dns:header(DnsHeader, Field) -> Value query_type() = axfr | mailb | maila | any | rr_type() dns_query() = DnsQuery inet_dns:dns_query(DnsQuery) -> [ {domain, dns_name()} | {type, query_type()} | {class, dns_class()} ] inet_dns:dns_query(DnsQuery, Field) -> Value dns_rr() = DnsRr inet_dns:rr(DnsRr) -> DnsRrFields | DnsRrOptFields DnsRrFields = [ {domain, dns_name()} | {type, rr_type()} | {class, dns_class()} | {ttl, integer()} | {data, dns_data()} ] DnsRrOptFields = [ {domain, dns_name()} | {type, opt} | {udp_payload_size, integer()} | {ext_rcode, integer()} | {version, integer()} | {z, integer()} | {data, dns_data()} ] inet_dns:rr(DnsRr, Field) -> Value
There is an information function for the types above:
inet_dns:record_type(dns_msg()) -> msg; inet_dns:record_type(dns_header()) -> header; inet_dns:record_type(dns_query()) -> dns_query; inet_dns:record_type(dns_rr()) -> rr; inet_dns:record_type(_) -> undefined.
So,
Resolves a DNS record of the specified type for the specified host,
of class
This function uses resolver option
Backend functions used by
Backend functions used by
This function uses resolver option
If resolver option
Resolves the DNS data for the record of the specified type and class
for the specified name. On success, filters out the answer records
with the correct
Calls
Resolves a DNS record of the specified type and class for the
specified name. The returned
If
Option
If
Option
This access functions example shows how
example_lookup(Name, Class, Type) ->
case inet_res:resolve(Name, Class, Type) of
{ok,Msg} ->
[inet_dns:rr(RR, data)
|| RR <- inet_dns:msg(Msg, anlist),
inet_dns:rr(RR, type) =:= Type,
inet_dns:rr(RR, class) =:= Class];
{error,_} ->
[]
end.
These are deprecated because the annoying double meaning of the name servers/time-out argument, and because they have no decent place for a resolver options list.
Resolves a DNS record of the specified type and class for the specified name.
Resolves a DNS record of the specified type and class for the specified name.