@UnstableApi
    protected final Consumer<DnsNameResolverBuilder> buildConfigurator(EventLoopGroup eventLoopGroup) {

        if (queryTimeoutMillisForEachAttempt > -1) {
            checkState(queryTimeoutMillis >= queryTimeoutMillisForEachAttempt,
                       "queryTimeoutMillis: %s, queryTimeoutMillisForEachAttempt: %s (expected: " +
                       "queryTimeoutMillis >= queryTimeoutMillisForEachAttempt)",
                       queryTimeoutMillis, queryTimeoutMillisForEachAttempt);
        }

        final MeterRegistry meterRegistry = firstNonNull(this.meterRegistry, Flags.meterRegistry());

        final boolean traceEnabled = this.traceEnabled;
        final long queryTimeoutMillis = this.queryTimeoutMillis;
        final long queryTimeoutMillisForEachAttempt = this.queryTimeoutMillisForEachAttempt;
        final boolean recursionDesired = this.recursionDesired;
        final int maxQueriesPerResolve = this.maxQueriesPerResolve;
        final int maxPayloadSize = this.maxPayloadSize;
        final boolean optResourceEnabled = this.optResourceEnabled;
        final DnsServerAddressStreamProvider serverAddressStreamProvider = this.serverAddressStreamProvider;
        final DnsQueryLifecycleObserverFactory dnsQueryLifecycleObserverFactory =
                this.dnsQueryLifecycleObserverFactory;
        final boolean dnsQueryMetricsEnabled = this.dnsQueryMetricsEnabled;
        final boolean decodeIdn = this.decodeIdn;

        Class<? extends SocketChannel> socketChannelType = this.socketChannelType;
        if (socketChannelType == null) {
            socketChannelType = TransportType.socketChannelType(eventLoopGroup);
        }
        final Class<? extends SocketChannel> finalSocketChannelType = socketChannelType;

        return builder -> {
            builder.datagramChannelType(TransportType.datagramChannelType(eventLoopGroup))
                   .socketChannelType(finalSocketChannelType, retrySocketChannelOnTimeout)
                   // Disable all caches provided by Netty and use DnsCache instead.
                   .resolveCache(NoopDnsCache.INSTANCE)
                   .authoritativeDnsServerCache(NoopAuthoritativeDnsServerCache.INSTANCE)
                   .cnameCache(NoopDnsCnameCache.INSTANCE)
                   .traceEnabled(traceEnabled)
                   .completeOncePreferredResolved(true)
                   .recursionDesired(recursionDesired)
                   .maxQueriesPerResolve(maxQueriesPerResolve)
                   .maxPayloadSize(maxPayloadSize)
                   .optResourceEnabled(optResourceEnabled)
                   // Disable DnsNameResolver from resolving host files and use HostsFileDnsResolver instead.
                   .hostsFileEntriesResolver(NoopHostFileEntriesResolver.INSTANCE)
                   .nameServerProvider(serverAddressStreamProvider)
                   // Disable DnsNameResolver from resolving search domains and use SearchDomainDnsResolver
                   // instead.
                   .searchDomains(ImmutableList.of())
                   .decodeIdn(decodeIdn);

            if (queryTimeoutMillisForEachAttempt > 0 && queryTimeoutMillisForEachAttempt < Long.MAX_VALUE) {
                builder.queryTimeoutMillis(queryTimeoutMillisForEachAttempt);
            } else {
                if (queryTimeoutMillis == 0 || queryTimeoutMillis == Long.MAX_VALUE) {
                    builder.queryTimeoutMillis(0);
                } else {
                    builder.queryTimeoutMillis(queryTimeoutMillis);
                }
            }

            DnsQueryLifecycleObserverFactory observerFactory = dnsQueryLifecycleObserverFactory;
            if (dnsQueryMetricsEnabled) {
                final DefaultDnsQueryLifecycleObserverFactory defaultObserverFactory =
                        new DefaultDnsQueryLifecycleObserverFactory(
                                meterRegistry, new MeterIdPrefix("armeria.client.dns.queries"));
                if (observerFactory == null) {
                    observerFactory = defaultObserverFactory;
                } else {
                    observerFactory = new BiDnsQueryLifecycleObserverFactory(
                            observerFactory, defaultObserverFactory);
                }
            }
            if (observerFactory != null) {
                builder.dnsQueryLifecycleObserverFactory(observerFactory);
            }
            final DnsNameResolverChannelStrategy datagramChannelStrategy = this.datagramChannelStrategy;
            if (datagramChannelStrategy != null) {
                builder.datagramChannelStrategy(datagramChannelStrategy);
            }
        };
    }
Builds a configurator that configures a {@link DnsNameResolverBuilder} with the properties set.
core/src/main/java/com/linecorp/armeria/client/AbstractDnsResolverBuilder.java