3
0
Mirror von https://github.com/PaperMC/Velocity.git synchronisiert 2024-09-29 06:30:16 +02:00

Don't resolve IP addresses in the config except for the bind one.

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-04-29 01:59:55 -04:00
Ursprung de51ea18cc
Commit 472f45df08
3 geänderte Dateien mit 16 neuen und 3 gelöschten Zeilen

Datei anzeigen

@ -242,7 +242,7 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
}
public InetSocketAddress getBind() {
return AddressUtil.parseAddress(bind);
return AddressUtil.parseAndResolveAddress(bind);
}
@Override

Datei anzeigen

@ -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)
);

Datei anzeigen

@ -10,12 +10,26 @@ public class AddressUtil {
}
/**
* Attempts to parse an IP address of the form <code>127.0.0.1:25565</code>.
* Attempts to parse an IP address of the form <code>127.0.0.1:25565</code>. 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 <code>127.0.0.1:25565</code>. 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());