use of io.netty.resolver.dns.SingletonDnsServerAddressStreamProvider in project crate by crate.
the class SrvUnicastHostsProvider method buildResolver.
private DnsNameResolver buildResolver(Settings settings) {
DnsNameResolverBuilder resolverBuilder = new DnsNameResolverBuilder(eventLoopGroup.next());
resolverBuilder.channelType(NioDatagramChannel.class);
InetSocketAddress resolverAddress = parseResolverAddress(settings);
if (resolverAddress != null) {
try {
resolverBuilder.nameServerProvider(new SingletonDnsServerAddressStreamProvider(resolverAddress));
} catch (IllegalArgumentException e) {
LOGGER.warn("Could not create custom dns resolver. Using default resolver.", e);
}
}
return resolverBuilder.build();
}
use of io.netty.resolver.dns.SingletonDnsServerAddressStreamProvider in project LogHub by fbacchella.
the class NettyNameResolver method configure.
@Override
public boolean configure(Properties properties) {
DnsNameResolverBuilder builder = new DnsNameResolverBuilder(evg.next()).queryTimeoutMillis(Math.max(timeout - 1, 1) * 1000).channelType(NioDatagramChannel.class);
try {
if (getResolver() != null) {
InetSocketAddress resolverAddr = new InetSocketAddress(InetAddress.getByName(getResolver()), 53);
builder = builder.nameServerProvider(new SingletonDnsServerAddressStreamProvider(resolverAddr));
}
} catch (UnknownHostException e) {
logger.error("Unknown resolver '{}': {}", getResolver(), e.getMessage());
return false;
}
resolver = builder.build();
CacheConfiguration config = properties.getDefaultCacheConfig("NameResolver", this).eternal(false).maxEntriesLocalHeap(cacheSize);
hostCache = properties.getCache(config);
return super.configure(properties);
}
Aggregations