PretendoNetwork / nex-protocols-common-go

Reusable implementations of NEX methods found in many servers
GNU Affero General Public License v3.0
19 stars 8 forks source link

[Enhancement]: Filter clients in sessions by network properties #43

Open jonbarrow opened 3 weeks ago

jonbarrow commented 3 weeks ago

Checked Existing

What enhancement would you like to see?

Check players network properties to try and only match players who have compatible networks. Many users report having 118-XXXX class errors. These are related to p2p networking issues. In a lot of cases we can't do anything about this, however it seems like in other cases we can.

Any other details to share? (OPTIONAL)

Now that @DaniElectra has documented the real names of all the PIA errors, we can start to shed some light on why these errors happen.

Some of the most common errors I see people having are:

Errors 0502, 0521 and 0562 all seem pretty generic, likely nothing we can do there afaik. However errors 0513, 0516 and 0519 all have pretty detailed names which shed light on the underlying issue.

Taking a look at the docs for StationURL shows that there's 3 main things we can use for this filtering:

These can be used to tell us what kind of network setup a client is using, which should be roughly enough to determine if 2 clients can connect or not. The error codes also seem to support this:

If we do more filtering to only match clients with compatible networks then we will almost certainly see a reduction in 118-XXXX errors in general. https://en.wikipedia.org/wiki/Network_address_translation may also be of some use here.

Some potential downsides/issues/questions to this are:

ashquarky commented 3 weeks ago

For reference, this blogpost from Tailscale is great and defines all these NAT terms (eim, edm, cones, etc.) and explains why they have compatibility issues https://tailscale.com/blog/how-nat-traversal-works

We can't follow their advice on how to traverse since we don't control the clients, but the information is very good for understanding this