diff --git a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java index aa3410cee..806ea190b 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/config/VelocityConfiguration.java @@ -242,7 +242,7 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi } public InetSocketAddress getBind() { - return AddressUtil.parseAddress(bind); + return AddressUtil.parseAndResolveAddress(bind); } @Override 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 fb0a66236..f5ef6ea81 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/network/ConnectionManager.java @@ -51,7 +51,6 @@ public final class ConnectionManager { this.resolverGroup = new DnsAddressResolverGroup( new DnsNameResolverBuilder() .channelType(this.transportType.datagramChannelClass) - .ttl(300, 86400) .negativeTtl(15) .ndots(1) ); diff --git a/proxy/src/main/java/com/velocitypowered/proxy/util/AddressUtil.java b/proxy/src/main/java/com/velocitypowered/proxy/util/AddressUtil.java index 06fb1cd45..8874509aa 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/util/AddressUtil.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/util/AddressUtil.java @@ -10,12 +10,26 @@ public class AddressUtil { } /** - * Attempts to parse an IP address of the form 127.0.0.1:25565. + * Attempts to parse an IP address of the form 127.0.0.1:25565. The returned + * {@link InetSocketAddress} is not resolved. * * @param ip the IP to parse * @return the parsed address */ public static InetSocketAddress parseAddress(String ip) { + Preconditions.checkNotNull(ip, "ip"); + URI uri = URI.create("tcp://" + ip); + return InetSocketAddress.createUnresolved(uri.getHost(), uri.getPort()); + } + + /** + * Attempts to parse an IP address of the form 127.0.0.1:25565. The returned + * {@link InetSocketAddress} is resolved. + * + * @param ip the IP to parse + * @return the parsed address + */ + public static InetSocketAddress parseAndResolveAddress(String ip) { Preconditions.checkNotNull(ip, "ip"); URI uri = URI.create("tcp://" + ip); return new InetSocketAddress(uri.getHost(), uri.getPort());