Fix #1796: Disable AutoRelay

Per https://github.com/libp2p/go-libp2p/issues/1852, the AutoRelay subsystem
is now panicking on users. EnableAutoRelay must now be called with options,
otherwise it seems to panic for some people.

Disabling it is the best for now, given relays are enabled and a node must be
able to connect to others on bootstrap, perhaps it does not need to
re-discover new relays (every other node should be a relay).

In any case we should revisit relay support and related services in Cluster,
since semantics have changed a lot in libp2p, relayV2 is a thing,
hole-punching is a thing etc. etc.
This commit is contained in:
Hector Sanjuan 2022-11-14 09:40:29 +01:00
parent fd7e4ea336
commit b29f8b807a

View File

@ -9,15 +9,15 @@ import (
namespace "github.com/ipfs/go-datastore/namespace"
ipns "github.com/ipfs/go-ipns"
libp2p "github.com/libp2p/go-libp2p"
dht "github.com/libp2p/go-libp2p-kad-dht"
dual "github.com/libp2p/go-libp2p-kad-dht/dual"
pubsub "github.com/libp2p/go-libp2p-pubsub"
record "github.com/libp2p/go-libp2p-record"
crypto "github.com/libp2p/go-libp2p/core/crypto"
host "github.com/libp2p/go-libp2p/core/host"
network "github.com/libp2p/go-libp2p/core/network"
corepnet "github.com/libp2p/go-libp2p/core/pnet"
routing "github.com/libp2p/go-libp2p/core/routing"
dht "github.com/libp2p/go-libp2p-kad-dht"
dual "github.com/libp2p/go-libp2p-kad-dht/dual"
pubsub "github.com/libp2p/go-libp2p-pubsub"
record "github.com/libp2p/go-libp2p-record"
connmgr "github.com/libp2p/go-libp2p/p2p/net/connmgr"
identify "github.com/libp2p/go-libp2p/p2p/protocol/identify"
noise "github.com/libp2p/go-libp2p/p2p/security/noise"
@ -76,7 +76,9 @@ func NewClusterHost(
}),
libp2p.EnableNATService(),
libp2p.EnableRelay(),
libp2p.EnableAutoRelay(),
// breaks without passing a way to discover relays.
// https://github.com/libp2p/go-libp2p/issues/1852
// libp2p.EnableAutoRelay(),
libp2p.EnableHolePunching(),
}