Announce only clear IP winner #292
Merged
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.
Description
Routers have a wide variety of mechanisms for routing behind a NAT. When sending traffic, some can use random source ports, some can round-robin between a variety of ports. In the cases where a router uses a handful of mapped ports to send traffic from, the PONG responses from our peers can indicate a handful of candidates that could be our reachable external address.
In general, if there are multiple candidates for our true external contactable address, then this likely means that none of them are actually contactable, rather the SNAT configuration of the router hasn't been configured correctly. Any peer trying to contact us from these multiple competing ports, will likely to fail (Symmetric NAT'ing).
Therefore, this PR adjusts the logic behind choosing what is a viable external contactable address.
The following conditions must now be met:
20%30%If there are two candidates above the threshold, none are chosen.The idea here is to ignore scenarios where there are multiple competing sockets as these all are likely invalid.
EDIT: I've decided the last condition is too strict. It likely could be manipulated. Instead I've shifted the difference between majority and next highest majority to be 30%.