go-libp2p-circuit
go-libp2p-circuit copied to clipboard
Don't add 1 weight to both sides of connections we're relaying
When relaying a connection between two peers, we currently add 1 weight in the connection manager to both connections involved. Instead, we should just give peers using us a flag weight of 1 total.
Not sure what you mean here -- shouldn't both connections get some weight?
Note that the rules for the relays themselves are quite different from normal node; we want to preserve the connections with the highest load.
Also note that we can't assign fractional values to tags (say 0.5), so this can't work.
IMO, all users of a relay should be considered equal. Otherwise, an abuser could make a bunch of fake relay connections to boost their score.
Honestly, we should probably prefer peers with fewer connections.
I can make it upsert tags up to (say) 10, and above that overflow to an internal counter for house keeping activities (ie when to upser the tag to 0). This way peers with a number of relay connections get a small boost, but once they have enough connections they are considered equal.
SGTM.