From 8517d58673682a153961cc03b64580a1992732d5 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 27 Apr 2019 20:37:26 -0400 Subject: [PATCH] Reduce erroneous DNS lookups for Velocity in Kubernetes. --- .../proxy/network/ConnectionManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java b/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java index 520a09f13..fb0a66236 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java @@ -11,8 +11,8 @@ import io.netty.channel.ChannelFutureListener; import io.netty.channel.ChannelOption; import io.netty.channel.EventLoopGroup; import io.netty.channel.WriteBufferWaterMark; -import io.netty.resolver.dns.DefaultDnsServerAddressStreamProvider; import io.netty.resolver.dns.DnsAddressResolverGroup; +import io.netty.resolver.dns.DnsNameResolverBuilder; import java.net.InetSocketAddress; import java.util.HashMap; import java.util.Map; @@ -48,8 +48,13 @@ public final class ConnectionManager { this.workerGroup = this.transportType.createEventLoopGroup(TransportType.Type.WORKER); this.serverChannelInitializer = new ServerChannelInitializerHolder( new ServerChannelInitializer(this.server)); - this.resolverGroup = new DnsAddressResolverGroup(this.transportType.datagramChannelClass, - DefaultDnsServerAddressStreamProvider.INSTANCE); + this.resolverGroup = new DnsAddressResolverGroup( + new DnsNameResolverBuilder() + .channelType(this.transportType.datagramChannelClass) + .ttl(300, 86400) + .negativeTtl(15) + .ndots(1) + ); } public void logChannelInformation() {