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", "- \"disabled\": No pass-through will be done. The velocity.toml and server-icon.png",
" will determine the initial server list ping response.", " will determine the initial server list ping response.",
"- \"mods\": Passes only the mod list from your backend server into the 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", " The first server in your try list (or forced host) with a mod list will be",
" servers can be contacted, Velocity will not display any mod information.", " 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", "- \"all\": Passes everything from the backend server into the response. The Velocity",
" configuration is used if no servers could be contacted." " 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.protocol.packet.StatusResponse;
import com.velocitypowered.proxy.server.VelocityRegisteredServer; import com.velocitypowered.proxy.server.VelocityRegisteredServer;
import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBuf;
import java.net.InetSocketAddress;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@ -110,8 +112,11 @@ public class StatusSessionHandler implements MinecraftSessionHandler {
if (passthrough == PingPassthroughMode.DISABLED) { if (passthrough == PingPassthroughMode.DISABLED) {
return CompletableFuture.completedFuture(constructLocalPing(shownVersion)); return CompletableFuture.completedFuture(constructLocalPing(shownVersion));
} else { } else {
return attemptPingPassthrough(configuration.getPingPassthrough(), String virtualHostStr = inbound.getVirtualHost().map(InetSocketAddress::getHostString)
configuration.getAttemptConnectionOrder(), shownVersion); .orElse("");
List<String> serversToTry = server.getConfiguration().getForcedHosts().getOrDefault(
virtualHostStr, server.getConfiguration().getAttemptConnectionOrder());
return attemptPingPassthrough(configuration.getPingPassthrough(), serversToTry, shownVersion);
} }
} }