Closed Stebalien closed 4 years ago
Why?
It is useful for driving relay discovery (say for autorelay); couple that with a relay filters, and we can have a very simple mechanism for setting up relay forwarding.
We don't use this for AutoRelay, we don't even expose the relays we find. AutoRelay now discovers its own relays via identify events.
(sorry, I just like deleting code) KILL KILL KILL!
This was a misfeature that looks great in demos but isn't useful (and wastes bandwidth and could potentially cause other DoS issues) in practice.
First, random relays we discover are unlikely to support active relaying. This means that picking a random relay is usually going to fail because the random relay won't already be connected to the target.
Second, there are two use-cases for relaying:
For the first case, we only want to use the relays specified by the target peers. For the second case, we'd need to modify either libp2p's dialer logic (in the swarm) to prefix all addresses with the specified relay.
The current logic covers neither use-case so I'm removing it.