vertx.dns documentation
Provides functions for asynchronous DNS operations.
lookup
(lookup client-or-servers name handler)(lookup client-or-servers name type handler)
Returns the first found A (ipv4) or AAAA (ipv6) record for name.
client-or-servers can be one of:
* the client object returned by any of the functions in the
vertx.dns namespace
* a host or host:port string specifying the server
* a collection of host or host:port strings specifying dns
servers
If no port is specified, the dns default port (53) is assumed.
type can be one of :ipv4, :ipv6, or :any (the default), which limit
the lookup to ipv4, ipv6, or first found, respectively.
handler can either be a two-arity fn that will be passed the
exception-map (if any) and result of the lookup call, or a
org.vertx.java.core.Handler that will be called with the
AsyncResult object that wraps the exception and raw result.
The exception-map that may be passed to the handler will be a
map of the form:
{:type :NXDOMAIN ;; or other error type
:message "NXDOMAIN: type 3, name error"
:basis the-DnsException-object}
The result passed to a handler function will be a map of the form:
{:address "127.0.0.1"
:basis the-InetAddress-object}
Returns a client object that can be passed to other dns calls.resolve
(resolve client-or-servers name type handler)
Resolves records of type for name.
client-or-servers can be one of:
* the client object returned by any of the functions in the
vertx.dns namespace
* a host or host:port string specifying the server
* a collection of host or host:port strings specifying dns
servers
If no port is specified, the dns default port (53) is assumed.
type must be one of the following:
:A Resolves the A records for name. The handler fn will be
passed a collection of maps of the form:
{:address "127.0.0.1"
:basis the-InetAddress-object}
:AAAA Resolves the AAAA records for name. The handler fn will be
passed a collection of maps of the same form as :A.
:CNAME Resolves the CNAME records for name. The handler fn will
be passed a collection of Strings.
:MX Resolves the MX records for name. The handler fn will be
passed a collection of maps of the form:
{:priority 1
:name "mail.example.com"
:basis the-MxRecord-object}
:NS Resolves the NS records for name. The handler fn will be
passed a collection of NS servers as Strings.
:PTR Resolves the PTR records for name. The handler fn will be
passed the PTR String.
:SRV Resolves the SRV records for name. The handler fn will be
passed a collection of maps of the form:
{:priority 1
:weight 0
:port 1234
:name "someserver.example.com"
:protocol "_tcp"
:service "_http"
:target "target-name"
:basis the-SrvRecord-object}
:TXT Resolves the TXT records for name. The handler fn will be
passed a collection of TXT entries as Strings.
handler can either be a two-arity fn that will be passed the
exception-map (if any) and result from the resolve call, or a
org.vertx.java.core.Handler that will be called with the
AsyncResult object that wraps the exception and raw result.
The exception-map that may be passed to the handler will be a
map of the form:
{:type :NXDOMAIN ;; or other error type
:message "NXDOMAIN: type 3, name error"
:basis the-DnsException-object}
Returns a client object that can be passed to other dns calls.reverse-lookup
(reverse-lookup client-or-servers address handler)
Performs a reverse lookup for the given address.
client-or-servers can be one of:
* the client object returned by any of the functions in the
vertx.dns namespace
* a host or host:port string specifying the server
* a collection of host or host:port strings specifying dns
servers
If no port is specified, the dns default port (53) is assumed.
handler can either be a two-arity fn that will be passed the
exception-map (if any) and result of the lookup call, or a
org.vertx.java.core.Handler that will be called with the
AsyncResult object that wraps the exception and raw result.
The exception-map that may be passed to the handler will be a
map of the form:
{:type :NXDOMAIN ;; or other error type
:message "NXDOMAIN: type 3, name error"
:basis the-DnsException-object}
The result passed to a handler function will be a map of the form:
{:host "somehost.example.com"
:basis the-InetAddress-object}
Returns a client object that can be passed to other dns calls.