Search in sources :

Example 1 with DnsResolverProvider

use of io.vertx.core.impl.resolver.DnsResolverProvider in project vert.x by eclipse.

the class VertxImpl method createDnsClient.

@Override
public DnsClient createDnsClient(DnsClientOptions options) {
    String host = options.getHost();
    int port = options.getPort();
    if (host == null || port < 0) {
        DnsResolverProvider provider = new DnsResolverProvider(this, addressResolverOptions);
        InetSocketAddress address = provider.nameServerAddresses().get(0);
        // provide the host and port
        options = new DnsClientOptions(options).setHost(address.getAddress().getHostAddress()).setPort(address.getPort());
    }
    return new DnsClientImpl(this, options);
}
Also used : DnsClientOptions(io.vertx.core.dns.DnsClientOptions) DnsClientImpl(io.vertx.core.dns.impl.DnsClientImpl) InetSocketAddress(java.net.InetSocketAddress) DnsResolverProvider(io.vertx.core.impl.resolver.DnsResolverProvider)

Aggregations

DnsClientOptions (io.vertx.core.dns.DnsClientOptions)1 DnsClientImpl (io.vertx.core.dns.impl.DnsClientImpl)1 DnsResolverProvider (io.vertx.core.impl.resolver.DnsResolverProvider)1 InetSocketAddress (java.net.InetSocketAddress)1