itzg / mc-router

Routes Minecraft client connections to backend servers based upon the requested server address
MIT License
559 stars 36 forks source link

Documentation for PROXY protocol is missing #38

Open jemand771 opened 2 years ago

jemand771 commented 2 years ago

While searching for a way to forward the client IP I found #22 (issue: #13) which has already been released, but the README doesn't contain any info about it. First of all, the usage code block would need something like this:

  -use-proxy-protocol
        Send PROXY protocol to backend servers (env USE_PROXY_PROTOCOL)

And maybe some additional info on configuring the actual minecraft servers to accept the proxy protocol. (I realize that this might be vastly different between server "flavors", but at least a general hint in the right direction would be helpful anyway) The way I have it now, I can't connect to a fabric 1.18.1 server behind mc-router when I enable the proxy protocol, but this might be a config error.

itzg commented 2 years ago

cc @Gabitzuu

Gabitzuu commented 2 years ago

Hi. Yes, I forgot to add the README part regarding PROXY protocol. Basically, your server has to accept this protocol, either by itself (eg. Bungeecord/Waterfall/Velocity *iirc), or by using a plugin (SpigotProxy/FabricProxy-Lite) Sadly, I'm not familiarized with Fabric, so I can't really help you, but this might help: https://www.curseforge.com/minecraft/mc-mods/fabricproxy-lite

jemand771 commented 2 years ago

thanks for the quick reply, I'll have to play around with this a bit more. So far I couldn't get it working at all (even with spigot/paper) but I didn't spend much time troubleshooting yet.

Does mc-router implement the "new" (often called "modern") or the legacy forwarding? Most plugins/mods let you configure which one to use (and I should probably pick the right one)

itzg commented 2 years ago

@jemand771 it's currently PROXY v2, but I vaguely remember what you mean about some alternate client IP forwarding protocols for Bungee type scenarios. So it might turn out the particular support you're needing isn't here yet.

itzg commented 2 years ago

Hmm, the ip_forward feature seems to work by encoding it into the host field of the handshake. That would be doable here in mc-router

https://github.com/SpigotMC/BungeeCord/blob/9c95d4ba43ba84d10e8bb7d7c92d7e6c5f161ed2/proxy/src/main/java/net/md_5/bungee/ServerConnector.java#L108