/** * Resolves the specified host name and port into a list of address. * * @param inetHost the name to resolve * @param additionals additional records ({@code OPT}) * * @return the list of the address as the result of the resolution */ public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals) { return resolveAll(inetHost, additionals, executor().<List<InetAddress>>newPromise()); }
/** * Resolves the specified name into an address. * * @param inetHost the name to resolve * @param additionals additional records ({@code OPT}) * * @return the address as the result of the resolution */ public final Future<InetAddress> resolve(String inetHost, Iterable<DnsRecord> additionals) { return resolve(inetHost, additionals, executor().<InetAddress>newPromise()); }
/** * Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike * {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers. * If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured * {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the * {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned. * * @param question the question * * @return the list of the {@link DnsRecord}s as the result of the resolution */ public final Future<List<DnsRecord>> resolveAll(DnsQuestion question) { return resolveAll(question, EMPTY_ADDITIONALS, executor().<List<DnsRecord>>newPromise()); }
/** * Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike * {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers. * If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured * {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the * {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned. * * @param question the question * @param additionals additional records ({@code OPT}) * * @return the list of the {@link DnsRecord}s as the result of the resolution */ public final Future<List<DnsRecord>> resolveAll(DnsQuestion question, Iterable<DnsRecord> additionals) { return resolveAll(question, additionals, executor().<List<DnsRecord>>newPromise()); }
/** * Resolves the specified name into an address. * * @param inetHost the name to resolve * @param additionals additional records ({@code OPT}) * * @return the address as the result of the resolution */ public final Future<InetAddress> resolve(String inetHost, Iterable<DnsRecord> additionals) { return resolve(inetHost, additionals, executor().<InetAddress>newPromise()); }
/** * Resolves the specified host name and port into a list of address. * * @param inetHost the name to resolve * @param additionals additional records ({@code OPT}) * * @return the list of the address as the result of the resolution */ public final Future<List<InetAddress>> resolveAll(String inetHost, Iterable<DnsRecord> additionals) { return resolveAll(inetHost, additionals, executor().<List<InetAddress>>newPromise()); }
/** * Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike * {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers. * If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured * {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the * {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned. * * @param question the question * * @return the list of the {@link DnsRecord}s as the result of the resolution */ public final Future<List<DnsRecord>> resolveAll(DnsQuestion question) { return resolveAll(question, EMPTY_ADDITIONALS, executor().<List<DnsRecord>>newPromise()); }
/** * Resolves the {@link DnsRecord}s that are matched by the specified {@link DnsQuestion}. Unlike * {@link #query(DnsQuestion)}, this method handles redirection, CNAMEs and multiple name servers. * If the specified {@link DnsQuestion} is {@code A} or {@code AAAA}, this method looks up the configured * {@link HostsFileEntries} before sending a query to the name servers. If a match is found in the * {@link HostsFileEntries}, a synthetic {@code A} or {@code AAAA} record will be returned. * * @param question the question * @param additionals additional records ({@code OPT}) * * @return the list of the {@link DnsRecord}s as the result of the resolution */ public final Future<List<DnsRecord>> resolveAll(DnsQuestion question, Iterable<DnsRecord> additionals) { return resolveAll(question, additionals, executor().<List<DnsRecord>>newPromise()); }
private void doResolveUncached(String hostname, DnsRecord[] additionals, final Promise<InetAddress> promise, DnsCache resolveCache) { final Promise<List<InetAddress>> allPromise = executor().newPromise(); doResolveAllUncached(hostname, additionals, allPromise, resolveCache); allPromise.addListener(new FutureListener<List<InetAddress>>() { @Override public void operationComplete(Future<List<InetAddress>> future) { if (future.isSuccess()) { trySuccess(promise, future.getNow().get(0)); } else { tryFailure(promise, future.cause()); } } }); }
private void doResolveAllUncached(final String hostname, final DnsRecord[] additionals, final Promise<List<InetAddress>> promise, final DnsCache resolveCache) { // Call doResolveUncached0(...) in the EventLoop as we may need to submit multiple queries which would need // to submit multiple Runnable at the end if we are not already on the EventLoop. EventExecutor executor = executor(); if (executor.inEventLoop()) { doResolveAllUncached0(hostname, additionals, promise, resolveCache); } else { executor.execute(new Runnable() { @Override public void run() { doResolveAllUncached0(hostname, additionals, promise, resolveCache); } }); } }
private void doResolveAllUncached0(String hostname, DnsRecord[] additionals, Promise<List<InetAddress>> promise, DnsCache resolveCache) { assert executor().inEventLoop(); final DnsServerAddressStream nameServerAddrs = dnsServerAddressStreamProvider.nameServerAddressStream(hostname); new DnsAddressResolveContext(this, hostname, additionals, nameServerAddrs, resolveCache, authoritativeDnsServerCache).resolve(promise); }
private void doResolveUncached(String hostname, DnsRecord[] additionals, final Promise<InetAddress> promise, DnsCache resolveCache) { final Promise<List<InetAddress>> allPromise = executor().newPromise(); doResolveAllUncached(hostname, additionals, allPromise, resolveCache); allPromise.addListener(new FutureListener<List<InetAddress>>() { @Override public void operationComplete(Future<List<InetAddress>> future) { if (future.isSuccess()) { trySuccess(promise, future.getNow().get(0)); } else { tryFailure(promise, future.cause()); } } }); }
if (serverName.address == null) { cacheUnresolved(serverName, authoritativeCache, parent.executor());
final Future<AddressedEnvelope<DnsResponse, InetSocketAddress>> resolveFuture = parent.executor() .newSucceededFuture(null); queriesInProgress.add(resolveFuture); Promise<List<InetAddress>> resolverPromise = parent.executor().newPromise(); resolverPromise.addListener(new FutureListener<List<InetAddress>>() { @Override
cache(serverName, authoritativeCache, parent.executor()); return;
@Override public void operationComplete(Future<List<T>> future) { Throwable cause = future.cause(); if (cause == null) { promise.trySuccess(future.getNow()); } else { if (DnsNameResolver.isTransportOrTimeoutError(cause)) { promise.tryFailure(new SearchDomainUnknownHostException(cause, hostname)); } else if (searchDomainIdx < searchDomains.length) { Promise<List<T>> newPromise = parent.executor().newPromise(); newPromise.addListener(this); doSearchDomainQuery(hostname + '.' + searchDomains[searchDomainIdx++], newPromise); } else if (!startWithoutSearchDomain) { internalResolve(hostname, promise); } else { promise.tryFailure(new SearchDomainUnknownHostException(cause, hostname)); } } } });
@Override public void operationComplete(Future<List<T>> future) { Throwable cause = future.cause(); if (cause == null) { promise.trySuccess(future.getNow()); } else { if (DnsNameResolver.isTransportOrTimeoutError(cause)) { promise.tryFailure(new SearchDomainUnknownHostException(cause, hostname)); } else if (searchDomainIdx < searchDomains.length) { Promise<List<T>> newPromise = parent.executor().newPromise(); newPromise.addListener(this); doSearchDomainQuery(hostname + '.' + searchDomains[searchDomainIdx++], newPromise); } else if (!startWithoutSearchDomain) { internalResolve(hostname, promise); } else { promise.tryFailure(new SearchDomainUnknownHostException(cause, hostname)); } } } });
final int initialSearchDomainIdx = startWithoutSearchDomain ? 0 : 1; final Promise<List<T>> searchDomainPromise = parent.executor().newPromise(); searchDomainPromise.addListener(new FutureListener<List<T>>() { private int searchDomainIdx = initialSearchDomainIdx;
onResponseCNAME(question, buildAliasMap(envelope.content(), cnameCache(), parent.executor()), queryLifecycleObserver, promise); return;