Top Description Methods
io.vertx.core.dns

public Interface DnsClient

Known Direct Implementers
io.vertx.core.dns.impl.DnsClientImpl
Annotations
@VertxGen
Imports
io.vertx.codegen.annotations.Nullable, .Fluent, .VertxGen, io.vertx.core.AsyncResult, .Future, .Handler, java.util.List

Provides a way to asynchronously lookup information from DNS servers.

Please consult the documentation for more information on DNS clients.

The client is thread safe and can be used from any thread.

Author
Norman Maurer

Method Summary

Modifier and TypeMethod and Description
public void
close(Handler<AsyncResult<Void>> handler)

Close the client.

public Future<Void>
close()

Like close(Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently
lookup
(String
the name to resolve
name
,
Handler<AsyncResult<@Nullable String>>
the io.vertx.core.Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with the resolved address if a record was found. If non was found it will get notifed with null. If an error accours it will get failed.
handler
)

Try to lookup the A (ipv4) or AAAA (ipv6) record for the given name.

public Future<@Nullable String>
lookup(String name)

Like lookup(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently
lookup4
(String
the name to resolve
name
,
Handler<AsyncResult<@Nullable String>>
the Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with the resolved java.net.Inet4Address if a record was found. If non was found it will get notifed with null. If an error accours it will get failed.
handler
)

Try to lookup the A (ipv4) record for the given name.

public Future<@Nullable String>
lookup4(String name)

Like lookup4(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently
lookup6
(String
the name to resolve
name
,
Handler<AsyncResult<@Nullable String>>
the Handler to notify with the AsyncResult. The handler will get notified with the resolved java.net.Inet6Address if a record was found. If non was found it will get notifed with null. If an error accours it will get failed.
handler
)

Try to lookup the AAAA (ipv6) record for the given name.

public Future<@Nullable String>
lookup6(String name)

Like lookup6(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently
resolveA
(String
the name to resolve
name
,
Handler<AsyncResult<List<String>>>
the io.vertx.core.Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with a java.util.List that contains all the resolved java.net.Inet4Addresses. If none was found an empty java.util.List will be used. If an error accours it will get failed.
handler
)

Try to resolve all A (ipv4) records for the given name.

public Future<List<String>>
resolveA(String name)

Like resolveA(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently
resolveAAAA
(String
the name to resolve
name
,
Handler<AsyncResult<List<String>>>
the io.vertx.core.Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with a java.util.List that contains all the resolved java.net.Inet6Addresses. If none was found an empty java.util.List will be used. If an error accours it will get failed.
handler
)

Try to resolve all AAAA (ipv6) records for the given name.

public Future<List<String>>
resolveAAAA(String name)

Like resolveAAAA(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently.
resolveCNAME
(String
the name to resolve the CNAME for
name
,
Handler<AsyncResult<List<String>>>
the Handler to notify with the AsyncResult. The handler will get notified with the resolved String if a record was found. If none was found it will get notified with null. If an error accours it will get failed.
handler
)

Try to resolve the CNAME record for the given name.

public Future<List<String>>
resolveCNAME(String name)

Like resolveCNAME(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently.
resolveMX
(String
the name for which the MX records should be resolved
name
,
Handler<AsyncResult<List<MxRecord>>>
the io.vertx.core.Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with a List that contains all resolved MxRecords, sorted by their MxRecord#priority(). If non was found it will get notified with an empty java.util.List. If an error accours it will get failed.
handler
)

Try to resolve the MX records for the given name.

public Future<List<MxRecord>>
resolveMX(String name)

Like resolveMX(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently.
resolveNS
(String
the name for which the NS records should be resolved
name
,
Handler<AsyncResult<List<String>>>
the Handler to notify with the AsyncResult. The handler will get notified with a List that contains all resolved Strings. If none was found it will get notified with an empty java.util.List. If an error accours it will get failed.
handler
)

Try to resolve the NS records for the given name.

public Future<List<String>>
resolveNS(String name)

Like resolveNS(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently.
resolvePTR
(String
the name to resolve the PTR for
name
,
Handler<AsyncResult<@Nullable String>>
the Handler to notify with the AsyncResult. The handler will get notified with the resolved String if a record was found. If none was found it will get notified with null. If an error accours it will get failed.
handler
)

Try to resolve the PTR record for the given name.

public Future<@Nullable String>
resolvePTR(String name)

Like resolvePTR(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently.
resolveSRV
(String
the name for which the SRV records should be resolved
name
,
Handler<AsyncResult<List<SrvRecord>>>
the Handler to notify with the AsyncResult. The handler will get notified with a List that contains all resolved SrvRecords. If none was found it will get notified with an empty java.util.List. If an error accours it will get failed.
handler
)

Try to resolve the SRV records for the given name.

public Future<List<SrvRecord>>
resolveSRV(String name)

Like resolveSRV(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently.
resolveTXT
(String
the name for which the TXT records should be resolved
name
,
Handler<AsyncResult<List<String>>>
the Handler to notify with the AsyncResult. The handler will get notified with a List that contains all resolved Strings. If none was found it will get notified with an empty java.util.List. If an error accours it will get failed.
handler
)

Try to resolve the TXT records for the given name.

public Future<List<String>>
resolveTXT(String name)

Like resolveTXT(String, Handler) but returns a Future of the asynchronous result

public DnsClient

Returns:

a reference to this, so the API can be used fluently.
reverseLookup
(String
the IP address to resolve the PTR for
ipaddress
,
Handler<AsyncResult<@Nullable String>>
the Handler to notify with the AsyncResult. The handler will get notified with the resolved String if a record was found. If none was found it will get notified with null. If an error accours it will get failed.
handler
)

Try to do a reverse lookup of an IP address.

public Future<@Nullable String>
reverseLookup(String ipaddress)

Like reverseLookup(String, Handler) but returns a Future of the asynchronous result

Method Detail

closeback to summary
public void close(Handler<AsyncResult<Void>> handler)

Close the client.

closeback to summary
public Future<Void> close()

Like close(Handler) but returns a Future of the asynchronous result

lookupback to summary
public DnsClient lookup(String name, Handler<AsyncResult<@Nullable String>> handler)

Try to lookup the A (ipv4) or AAAA (ipv6) record for the given name. The first found will be used.

Parameters
name:String

the name to resolve

handler:Handler<AsyncResult<@Nullable String>>

the io.vertx.core.Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with the resolved address if a record was found. If non was found it will get notifed with null. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently

Annotations
@Fluent
lookupback to summary
public Future<@Nullable String> lookup(String name)

Like lookup(String, Handler) but returns a Future of the asynchronous result

lookup4back to summary
public DnsClient lookup4(String name, Handler<AsyncResult<@Nullable String>> handler)

Try to lookup the A (ipv4) record for the given name. The first found will be used.

Parameters
name:String

the name to resolve

handler:Handler<AsyncResult<@Nullable String>>

the Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with the resolved java.net.Inet4Address if a record was found. If non was found it will get notifed with null. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently

Annotations
@Fluent
lookup4back to summary
public Future<@Nullable String> lookup4(String name)

Like lookup4(String, Handler) but returns a Future of the asynchronous result

lookup6back to summary
public DnsClient lookup6(String name, Handler<AsyncResult<@Nullable String>> handler)

Try to lookup the AAAA (ipv6) record for the given name. The first found will be used.

Parameters
name:String

the name to resolve

handler:Handler<AsyncResult<@Nullable String>>

the Handler to notify with the AsyncResult. The handler will get notified with the resolved java.net.Inet6Address if a record was found. If non was found it will get notifed with null. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently

Annotations
@Fluent
lookup6back to summary
public Future<@Nullable String> lookup6(String name)

Like lookup6(String, Handler) but returns a Future of the asynchronous result

resolveAback to summary
public DnsClient resolveA(String name, Handler<AsyncResult<List<String>>> handler)

Try to resolve all A (ipv4) records for the given name.

Parameters
name:String

the name to resolve

handler:Handler<AsyncResult<List<String>>>

the io.vertx.core.Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with a java.util.List that contains all the resolved java.net.Inet4Addresses. If none was found an empty java.util.List will be used. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently

Annotations
@Fluent
resolveAback to summary
public Future<List<String>> resolveA(String name)

Like resolveA(String, Handler) but returns a Future of the asynchronous result

resolveAAAAback to summary
public DnsClient resolveAAAA(String name, Handler<AsyncResult<List<String>>> handler)

Try to resolve all AAAA (ipv6) records for the given name.

Parameters
name:String

the name to resolve

handler:Handler<AsyncResult<List<String>>>

the io.vertx.core.Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with a java.util.List that contains all the resolved java.net.Inet6Addresses. If none was found an empty java.util.List will be used. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently

Annotations
@Fluent
resolveAAAAback to summary
public Future<List<String>> resolveAAAA(String name)

Like resolveAAAA(String, Handler) but returns a Future of the asynchronous result

resolveCNAMEback to summary
public DnsClient resolveCNAME(String name, Handler<AsyncResult<List<String>>> handler)

Try to resolve the CNAME record for the given name.

Parameters
name:String

the name to resolve the CNAME for

handler:Handler<AsyncResult<List<String>>>

the Handler to notify with the AsyncResult. The handler will get notified with the resolved String if a record was found. If none was found it will get notified with null. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently.

Annotations
@Fluent
resolveCNAMEback to summary
public Future<List<String>> resolveCNAME(String name)

Like resolveCNAME(String, Handler) but returns a Future of the asynchronous result

resolveMXback to summary
public DnsClient resolveMX(String name, Handler<AsyncResult<List<MxRecord>>> handler)

Try to resolve the MX records for the given name.

Parameters
name:String

the name for which the MX records should be resolved

handler:Handler<AsyncResult<List<MxRecord>>>

the io.vertx.core.Handler to notify with the io.vertx.core.AsyncResult. The handler will get notified with a List that contains all resolved MxRecords, sorted by their MxRecord#priority(). If non was found it will get notified with an empty java.util.List. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently.

Annotations
@Fluent
resolveMXback to summary
public Future<List<MxRecord>> resolveMX(String name)

Like resolveMX(String, Handler) but returns a Future of the asynchronous result

resolveNSback to summary
public DnsClient resolveNS(String name, Handler<AsyncResult<List<String>>> handler)

Try to resolve the NS records for the given name.

Parameters
name:String

the name for which the NS records should be resolved

handler:Handler<AsyncResult<List<String>>>

the Handler to notify with the AsyncResult. The handler will get notified with a List that contains all resolved Strings. If none was found it will get notified with an empty java.util.List. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently.

Annotations
@Fluent
resolveNSback to summary
public Future<List<String>> resolveNS(String name)

Like resolveNS(String, Handler) but returns a Future of the asynchronous result

resolvePTRback to summary
public DnsClient resolvePTR(String name, Handler<AsyncResult<@Nullable String>> handler)

Try to resolve the PTR record for the given name.

Parameters
name:String

the name to resolve the PTR for

handler:Handler<AsyncResult<@Nullable String>>

the Handler to notify with the AsyncResult. The handler will get notified with the resolved String if a record was found. If none was found it will get notified with null. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently.

Annotations
@Fluent
resolvePTRback to summary
public Future<@Nullable String> resolvePTR(String name)

Like resolvePTR(String, Handler) but returns a Future of the asynchronous result

resolveSRVback to summary
public DnsClient resolveSRV(String name, Handler<AsyncResult<List<SrvRecord>>> handler)

Try to resolve the SRV records for the given name.

Parameters
name:String

the name for which the SRV records should be resolved

handler:Handler<AsyncResult<List<SrvRecord>>>

the Handler to notify with the AsyncResult. The handler will get notified with a List that contains all resolved SrvRecords. If none was found it will get notified with an empty java.util.List. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently.

Annotations
@Fluent
resolveSRVback to summary
public Future<List<SrvRecord>> resolveSRV(String name)

Like resolveSRV(String, Handler) but returns a Future of the asynchronous result

resolveTXTback to summary
public DnsClient resolveTXT(String name, Handler<AsyncResult<List<String>>> handler)

Try to resolve the TXT records for the given name.

Parameters
name:String

the name for which the TXT records should be resolved

handler:Handler<AsyncResult<List<String>>>

the Handler to notify with the AsyncResult. The handler will get notified with a List that contains all resolved Strings. If none was found it will get notified with an empty java.util.List. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently.

Annotations
@Fluent
resolveTXTback to summary
public Future<List<String>> resolveTXT(String name)

Like resolveTXT(String, Handler) but returns a Future of the asynchronous result

reverseLookupback to summary
public DnsClient reverseLookup(String ipaddress, Handler<AsyncResult<@Nullable String>> handler)

Try to do a reverse lookup of an IP address. This is basically the same as doing trying to resolve a PTR record but allows you to just pass in the IP address and not a valid ptr query string.

Parameters
ipaddress:String

the IP address to resolve the PTR for

handler:Handler<AsyncResult<@Nullable String>>

the Handler to notify with the AsyncResult. The handler will get notified with the resolved String if a record was found. If none was found it will get notified with null. If an error accours it will get failed.

Returns:DnsClient

a reference to this, so the API can be used fluently.

Annotations
@Fluent
reverseLookupback to summary
public Future<@Nullable String> reverseLookup(String ipaddress)

Like reverseLookup(String, Handler) but returns a Future of the asynchronous result