Re-adding IPv6 support
Intro
With v1.4.0 all connections are now IPv4 forced due to issues with IPv6. This issue is to discuss re-adding IPv6 support and track the progress of doing so.
Goal
The goal would be to allow both IPv4 and IPv6 connections when connecting to a server falling back to the other one if one of the two does not work.
Benefits
Due to it's way larger address space, IPv6 does not suffer from CGNAT issues, allowing more players to host servers. Further IPv6 will only become more widespread and as such making sure we support it will help future proofing the project.
Due to the scarcity of IPv4 addresses cloud providers also started charging for any/additional IPv4 addresses, increasing costs for server hosters.
Additionally there could also be players that are limited to IPv6 who would be unable to play without IPv6 support but I'm not aware of such cases.
Drawbacks
A significant portion of users in Northstar might be limited to IPv4 only (speaking of myself here as well). As such when re-adding IPv6 support we will have to fully support both IPv4 and IPv6 on all layers, resulting in additional complexity in the codebase.
Further issues will arise if a server or client only supports one of the two, especially when IPv4 is not supported for some reason. In particular an IPv4-only client won't be able to connect to an IPv6-only server and as such measures need to be taken to properly inform a player why they are not able to connect to a particular server.
Implementation details
Dropping IPv4 in favour of IPv6 would be complete non-sense and as such the only solution is to add support for both.
This means:
- Master server needs to reachable via both IPv4 and IPv6.
- Game servers offering both IPv4 and IPv6 need to register both addresses under the same name on the master server.
(IPv4-only could still be used as a fall-back due to its wider support) - When a client tries to connect to a game server, master server needs to provide both IPv4 and IPv6 addresses of the game server
- Client needs to try connecting to both in case one of the two connections (IPv4 or IPv6) fails.
- Again the example of a client limited to IPv4.
- Or misconfigured game server that didn't open the right ports for one of the two
During initial roll-out it may be wise to still require servers to be accessible via IPv4 but allowing them to additionally offer a IPv6 connection.
Pitfalls and potential problems
- What happens if the IPv4 and IPv6 addresses a host offers point to different servers? Or is this a non-issue anyway
- There will definitely be situations where hosts will mess up configuration, such as enabling port forwarding for only one of the two addresses. How do we best help a host in spotting such a miconfiguration?
- Offering clients multiple addresses for a game server will likely require a change in the client that is not backwards compatible. As such IPv6 support can only be part of a major release.
Closing words
IPv6 support would be a long term goal that requires a decent amount of effort with currently very little reward. This might however change in the future. For now, any changes made to the networking code used to interact between client, game server, and master server should be made with eventual IPv6 support in the future in mind.
Another benefit: People will be able to host servers through IPv6 tunnels even if they can't port forward. The only problem is this won't work for IPv4.
Marking a server as IPv6-only could also be done with some sort of "tag", if #131 is considered :3