Mirror von
https://github.com/GeyserMC/Geyser.git
synchronisiert 2024-11-03 14:50:19 +01:00
HAProxy PROXY protocol support for downstream connections (#1688)
* Implement downstream PROXY protocol support * Clarify the configuration version updating procedure * Bump netty-resolver-dns to 4.1.56.Final * Update Netty to .56 * Don't increase jar size by 2MB Co-authored-by: Camotoy <20743703+Camotoy@users.noreply.github.com>
Dieser Commit ist enthalten in:
Ursprung
dbfdae63f1
Commit
c67d91943c
@ -124,14 +124,26 @@
|
|||||||
<version>26201a4</version>
|
<version>26201a4</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
|
||||||
<groupId>io.netty</groupId>
|
|
||||||
<artifactId>netty-all</artifactId>
|
|
||||||
</exclusion>
|
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>net.kyori</groupId>
|
<groupId>net.kyori</groupId>
|
||||||
<artifactId>adventure-text-serializer-gson</artifactId>
|
<artifactId>adventure-text-serializer-gson</artifactId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
|
<exclusion>
|
||||||
|
<groupId>com.github.steveice10</groupId>
|
||||||
|
<artifactId>packetlib</artifactId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.github.steveice10</groupId>
|
||||||
|
<artifactId>PacketLib</artifactId>
|
||||||
|
<version>54f761c</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion> <!-- Move this exclusion back to MCProtocolLib it gets the latest PacketLib -->
|
||||||
|
<groupId>io.netty</groupId>
|
||||||
|
<artifactId>netty-all</artifactId>
|
||||||
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -34,7 +34,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public interface GeyserConfiguration {
|
public interface GeyserConfiguration {
|
||||||
|
|
||||||
// Modify this when you update the config
|
// Modify this when you introduce breaking changes into the config
|
||||||
int CURRENT_CONFIG_VERSION = 4;
|
int CURRENT_CONFIG_VERSION = 4;
|
||||||
|
|
||||||
IBedrockConfiguration getBedrock();
|
IBedrockConfiguration getBedrock();
|
||||||
@ -117,6 +117,8 @@ public interface GeyserConfiguration {
|
|||||||
void setPort(int port);
|
void setPort(int port);
|
||||||
|
|
||||||
String getAuthType();
|
String getAuthType();
|
||||||
|
|
||||||
|
boolean isUseProxyProtocol();
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IUserAuthenticationInfo {
|
interface IUserAuthenticationInfo {
|
||||||
|
@ -148,6 +148,9 @@ public abstract class GeyserJacksonConfiguration implements GeyserConfiguration
|
|||||||
@Setter
|
@Setter
|
||||||
@JsonProperty("auth-type")
|
@JsonProperty("auth-type")
|
||||||
private String authType = "online";
|
private String authType = "online";
|
||||||
|
|
||||||
|
@JsonProperty("use-proxy-protocol")
|
||||||
|
private boolean useProxyProtocol = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -39,6 +39,7 @@ import com.github.steveice10.mc.protocol.packet.ingame.client.player.ClientPlaye
|
|||||||
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.client.world.ClientTeleportConfirmPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket;
|
import com.github.steveice10.mc.protocol.packet.ingame.server.ServerRespawnPacket;
|
||||||
import com.github.steveice10.mc.protocol.packet.login.server.LoginSuccessPacket;
|
import com.github.steveice10.mc.protocol.packet.login.server.LoginSuccessPacket;
|
||||||
|
import com.github.steveice10.packetlib.BuiltinFlags;
|
||||||
import com.github.steveice10.packetlib.Client;
|
import com.github.steveice10.packetlib.Client;
|
||||||
import com.github.steveice10.packetlib.event.session.*;
|
import com.github.steveice10.packetlib.event.session.*;
|
||||||
import com.github.steveice10.packetlib.packet.Packet;
|
import com.github.steveice10.packetlib.packet.Packet;
|
||||||
@ -459,6 +460,10 @@ public class GeyserSession implements CommandSender {
|
|||||||
}
|
}
|
||||||
|
|
||||||
downstream = new Client(remoteServer.getAddress(), remoteServer.getPort(), protocol, new TcpSessionFactory());
|
downstream = new Client(remoteServer.getAddress(), remoteServer.getPort(), protocol, new TcpSessionFactory());
|
||||||
|
if (connector.getConfig().getRemote().isUseProxyProtocol()) {
|
||||||
|
downstream.getSession().setFlag(BuiltinFlags.ENABLE_CLIENT_PROXY_PROTOCOL, true);
|
||||||
|
downstream.getSession().setFlag(BuiltinFlags.CLIENT_PROXIED_ADDRESS, upstream.getAddress());
|
||||||
|
}
|
||||||
// Let Geyser handle sending the keep alive
|
// Let Geyser handle sending the keep alive
|
||||||
downstream.getSession().setFlag(MinecraftConstants.AUTOMATIC_KEEP_ALIVE_MANAGEMENT, false);
|
downstream.getSession().setFlag(MinecraftConstants.AUTOMATIC_KEEP_ALIVE_MANAGEMENT, false);
|
||||||
downstream.getSession().addListener(new SessionAdapter() {
|
downstream.getSession().addListener(new SessionAdapter() {
|
||||||
|
@ -32,6 +32,11 @@ remote:
|
|||||||
port: 25565
|
port: 25565
|
||||||
# Authentication type. Can be offline, online, or floodgate (see https://github.com/GeyserMC/Geyser/wiki/Floodgate).
|
# Authentication type. Can be offline, online, or floodgate (see https://github.com/GeyserMC/Geyser/wiki/Floodgate).
|
||||||
auth-type: online
|
auth-type: online
|
||||||
|
# Whether to enable PROXY protocol or not while connecting to the server.
|
||||||
|
# This is useful only when:
|
||||||
|
# 1) Your server supports PROXY protocol (it probably doesn't)
|
||||||
|
# 2) You run Velocity or BungeeCord with respective option enabled.
|
||||||
|
use-proxy-protocol: false
|
||||||
|
|
||||||
# Floodgate uses encryption to ensure use from authorised sources.
|
# Floodgate uses encryption to ensure use from authorised sources.
|
||||||
# This should point to the public key generated by Floodgate (Bungee or CraftBukkit)
|
# This should point to the public key generated by Floodgate (Bungee or CraftBukkit)
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren