Workaround world connection issues caused by routers that lack Hairpin NAT support#1359
Open
Subsonic154 wants to merge 7 commits into
Open
Workaround world connection issues caused by routers that lack Hairpin NAT support#1359Subsonic154 wants to merge 7 commits into
Subsonic154 wants to merge 7 commits into
Conversation
…ort when connecting from the same network.
Contributor
Author
|
Connections seem to be working fine on the test server instance this PR spun up, if that's a close enough representation of a container environment to know this doesn't break that, let me know and I'll mark this ready for merge. |
Contributor
Author
|
I'm fairly confident this is safe now, so marking as ready for review. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This acts as a built-in workaround to world connection issues caused by this network configuration (which usually can't be fixed by the user without getting a new router, only worked around). I ran into this when I started having other people connect to my dev server for play-testing changes and figured I'd do something about it.
What this does is use separate world server forwarding logic depending on if the connection is coming from the local network or not, if the connection is from outside of the local network, it should behave the same as before, I've tested this extensively and nothing appears to be broken. If the connection is from the local network it uses different logic, localhost connections just get forwarded back to localhost, ignoring the public address, connections from other machines on the local network get forwarded to a new local address parameter in application.conf instead.
Adding a local/private address parameter to the config is not how I would've liked to have implemented this fix for other machines on the local network, but it's the only solution I could come up with that was cross-OS compatible without system file tweaks, and I wanted to keep setup simple.
If there's a better way I could've handled any of the changes here please reach out.