From 6cd251020ce9b5094133fc629237197ae323c44f Mon Sep 17 00:00:00 2001 From: RaphiMC <50594595+RaphiMC@users.noreply.github.com> Date: Wed, 24 Jul 2024 16:08:05 +0200 Subject: [PATCH] Enable RakNet compatibility mode Fixes most RakNet connection issues --- .../viaproxy/proxy/session/BedrockProxyConnection.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/net/raphimc/viaproxy/proxy/session/BedrockProxyConnection.java b/src/main/java/net/raphimc/viaproxy/proxy/session/BedrockProxyConnection.java index a555a5d..1149476 100644 --- a/src/main/java/net/raphimc/viaproxy/proxy/session/BedrockProxyConnection.java +++ b/src/main/java/net/raphimc/viaproxy/proxy/session/BedrockProxyConnection.java @@ -55,6 +55,8 @@ public void initialize(final ChannelType channelType, final Bootstrap bootstrap) .channelFactory(RakChannelFactory.client(channelClass)) .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 4_000) .option(RakChannelOption.RAK_PROTOCOL_VERSION, ProtocolConstants.BEDROCK_RAKNET_PROTOCOL_VERSION) + .option(RakChannelOption.RAK_COMPATIBILITY_MODE, true) + .option(RakChannelOption.RAK_CLIENT_INTERNAL_ADDRESSES, 20) .option(RakChannelOption.RAK_CONNECT_TIMEOUT, 4_000L) .option(RakChannelOption.RAK_SESSION_TIMEOUT, 30_000L) .option(RakChannelOption.RAK_GUID, ThreadLocalRandom.current().nextLong()) @@ -62,6 +64,10 @@ public void initialize(final ChannelType channelType, final Bootstrap bootstrap) .handler(this.channelInitializerSupplier.apply(this.handlerSupplier)); this.channelFuture = bootstrap.register().syncUninterruptibly(); + + /*if (this.getChannel().config().setOption(RakChannelOption.RAK_IP_DONT_FRAGMENT, true)) { + this.getChannel().config().setOption(RakChannelOption.RAK_MTU_SIZES, new Integer[]{1492, 1200, 576}); + }*/ } @Override