itzg / mc-router

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

Forward UDP packet along same port? #189

Open Merith-TK opened 1 year ago

Merith-TK commented 1 year ago

Would it be possible to add an --enable-udp flag that allows proxying UDP traffic to the server?

probably listens on port for TCP and UDP then routes, and you could specify container port for udp traffic like so

{
    "mappings": {
        // base, proxies tcp/udp to port by default
        "example.com": "example:25565",
        // geyser example for use along side above
        "example.com" : "example:19132/tcp" 
    }
}
itzg commented 1 year ago

It would need to interpret the RakNet protocol that bedrock uses on UDP to correctly route the datagrams to the associated backend. Worse still it would have to interpret and track every single datagram unlike the simplicity of Java edition's TCP stream based connections.

What's doable is if all you want is a "route all UDP traffic on the specified port to one backend".

Merith-TK commented 1 year ago

wait seriously? its that damn complicated?!

hmm... for bedrock a service like "geyserconnect" can be used for navigation, so an bedrock-container map would probably be the best bet to just forward bedrock traffic to a single container, and then let that handle the networking part, however things like Proximity Voice chat mods are probably easier?

so... proposed method of


{
    // this being anything but "" causes router to
    // listen on port 19132 and forward traffic on that
    // port to the bedrock container
    "bedrock" : "bedrock-container:19132"
    "mappings": {
        // base, proxies tcp by default, UDP if possible
        // (PlasmoVoice or SimpleVoice)
        "example.com": "example:25565"
    }
}
Merith-TK commented 1 year ago

Just noticed in the geyserconnect config there is this section at the bottom

# Enable virtual hosts to be specified to skip the server list
# Allows people to connect using addresses like
#   hypixel.net._p25565.example.com
#   hypixel.net.example.com
#   hypixel.net._o.example.com    - For offline mode
vhost:
  enabled: true
  base-domain: geyser.merith.xyz
Handrail9 commented 1 year ago

Popping in to say I have this same use-case and wondering what the current situation is. Seeing that UDP/Bedrock support might be out of scope for this project is there a better method/proxy for this? It would be helpful to add something like that to the docs/wiki even if it's not made by the same team behind your containers itzg. I can manage by opening 19132 on the container I use geyser in as at the moment i don't need it for more than one of my server, but that may change in the future. Hope to see some kind of easy solution for anyone else in the same position

itzg commented 1 year ago

I still haven't come across one, but would be very glad to add that as a pointer in the docs. I'm now thinking that searching for "raknet proxy" might be a good tactic since I believe that's the protocol/library on UDP that Bedrock is using.

BTW, team? 😀 It's just me...and a bunch of contributors. The sentiment makes me happy though.

Handrail9 commented 1 year ago

Well ykno, contributors, team, same thing right? I appreciate you a ton. Thanks for your work :)