13
0
geforkt von Mirrors/Velocity

Consider forced hosts in ping passthrough

Dieser Commit ist enthalten in:
Andrew Steinborn 2019-08-06 03:26:55 -04:00
Ursprung d8fb7c11e7
Commit 62c6adb204
2 geänderte Dateien mit 10 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -93,8 +93,9 @@ public class VelocityConfiguration extends AnnotatedConfig implements ProxyConfi
"- \"disabled\": No pass-through will be done. The velocity.toml and server-icon.png",
" will determine the initial server list ping response.",
"- \"mods\": Passes only the mod list from your backend server into the response.",
" This is the recommended replacement for announce-forge = true. If no backend",
" servers can be contacted, Velocity will not display any mod information.",
" The first server in your try list (or forced host) with a mod list will be",
" used. If no backend servers can be contacted, Velocity will not display any",
" mod information.",
"- \"all\": Passes everything from the backend server into the response. The Velocity",
" configuration is used if no servers could be contacted."
})

Datei anzeigen

@ -20,7 +20,9 @@ import com.velocitypowered.proxy.protocol.packet.StatusRequest;
import com.velocitypowered.proxy.protocol.packet.StatusResponse;
import com.velocitypowered.proxy.server.VelocityRegisteredServer;
import io.netty.buffer.ByteBuf;
import java.net.InetSocketAddress;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
@ -110,8 +112,11 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
if (passthrough == PingPassthroughMode.DISABLED) {
return CompletableFuture.completedFuture(constructLocalPing(shownVersion));
} else {
return attemptPingPassthrough(configuration.getPingPassthrough(),
configuration.getAttemptConnectionOrder(), shownVersion);
String virtualHostStr = inbound.getVirtualHost().map(InetSocketAddress::getHostString)
.orElse("");
List<String> serversToTry = server.getConfiguration().getForcedHosts().getOrDefault(
virtualHostStr, server.getConfiguration().getAttemptConnectionOrder());
return attemptPingPassthrough(configuration.getPingPassthrough(), serversToTry, shownVersion);
}
}