-
Notifications
You must be signed in to change notification settings - Fork 274
[Feature]: NAT punching for easier connection #5938
Description
Describe the Problem
UPnP doesn't always work, and not everyone can access their router settings to forward ports. It's also not the safest to do port forwarding, as that can expose your machine to attacks even when you aren't playing.
The Solution you'd like
NAT punching is a pretty simple way to get around hosting issues, without port forwarding or any configuration required by the dm/players. It is also safer, as it only allows connections between the specific clients you want to accept.
This does require a minimal coordination server, but it might even be possible to just use a free cloudflare worker, as it doesn't really require serious runtime or resources.
The actual nat punching code should be just a couple lines, it's just: connect to the server, get the dm's ip and port, and connect to it twice.
Alternatives that you've considered.
Not doing it, I guess? Many game servers don't use this method, and you were presumably fine without it as well.
Additional Context
No response