简体   繁体   中英

TCP Reverse Proxy Minecaft not sending original IP

I have created a reverse proxy but I've encountered the issue with it sending the server's IP to the destination Minecraft server opposed to the Minecraft player's IP that is connecting to the reverse proxy.

I've looked at ProxyPipe's & InAbates ( https://github.com/ducc/InAbate/blob/master/src/main/java/com/inabate/bungee/PlayerListener.java ) Bukkit plugins to try and figure out how they're setting the player's original IP but I've had no luck.

I have also looked at the Minecraft Protocol Handshakes wiki but it doesn't have an explanation on how to set the connecting IP.

If someone could point me in the right direction of how I should send the player's real IP to the Bukkit server/Bungee server so I can read the original IP from a Bukkit/Bungee plugin that would be great.

My current code: https://gitlab.com/shaunagostinho/MinecraftReverseProxy

BungeeCord explicitly hacks/encodes the players ip address into the packets being sent, it's not just a trivial reverse proxy.

This feature is known as IP-Forwarding.

The problem is, the vanilla Minecraft server doesn't recognize it.

So whichever Minecraft server backend you are using needs to understand the encoding, and replace the ip address it associates with the player to the ip address given by bungee.

Bungeecord:

https://github.com/SpigotMC/BungeeCord/blob/dce4ea193ad461832094f4368829e927db578265/proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java#L266

https://github.com/SpigotMC/BungeeCord/blob/e93323ddbc8f22f1efa0647e2fc03adc66c7c488/proxy/src/main/java/net/md_5/bungee/ServerConnector.java#L92

Spigot:

https://hub.spigotmc.org/stash/projects/SPIGOT/repos/spigot/browse/CraftBukkit-Patches/0043-BungeeCord-Support.patch#6,33

So you can see that it forwards, IP address, UUID, and json containing the GameProfile Properties.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM