libp2p / go-libp2p-circuit

Circuit Switching for libp2p
MIT License
48 stars 16 forks source link

feat: remove relay discovery and unspecified relay dialing #101

Closed Stebalien closed 4 years ago

Stebalien commented 4 years ago

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:

  1. Connecting to undialable nodes.
  2. Relaying all outbound traffic.

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.

Stebalien commented 4 years ago

Why?

vyzo commented 4 years ago

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.

Stebalien commented 4 years ago

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.

Stebalien commented 4 years ago

(sorry, I just like deleting code) KILL KILL KILL!