Correctly switch to new relay options
This commit is contained in:
parent
4739ed9210
commit
4b2d3a0561
|
@ -9,7 +9,6 @@ import (
|
||||||
ipns "github.com/ipfs/go-ipns"
|
ipns "github.com/ipfs/go-ipns"
|
||||||
config "github.com/ipfs/ipfs-cluster/config"
|
config "github.com/ipfs/ipfs-cluster/config"
|
||||||
libp2p "github.com/libp2p/go-libp2p"
|
libp2p "github.com/libp2p/go-libp2p"
|
||||||
relay "github.com/libp2p/go-libp2p-circuit"
|
|
||||||
connmgr "github.com/libp2p/go-libp2p-connmgr"
|
connmgr "github.com/libp2p/go-libp2p-connmgr"
|
||||||
crypto "github.com/libp2p/go-libp2p-core/crypto"
|
crypto "github.com/libp2p/go-libp2p-core/crypto"
|
||||||
host "github.com/libp2p/go-libp2p-core/host"
|
host "github.com/libp2p/go-libp2p-core/host"
|
||||||
|
@ -61,11 +60,6 @@ func NewClusterHost(
|
||||||
|
|
||||||
connman := connmgr.NewConnManager(cfg.ConnMgr.LowWater, cfg.ConnMgr.HighWater, cfg.ConnMgr.GracePeriod)
|
connman := connmgr.NewConnManager(cfg.ConnMgr.LowWater, cfg.ConnMgr.HighWater, cfg.ConnMgr.GracePeriod)
|
||||||
|
|
||||||
relayOpts := []relay.RelayOpt{}
|
|
||||||
if cfg.EnableRelayHop {
|
|
||||||
relayOpts = append(relayOpts, relay.OptHop)
|
|
||||||
}
|
|
||||||
|
|
||||||
var idht *dual.DHT
|
var idht *dual.DHT
|
||||||
var err error
|
var err error
|
||||||
opts := []libp2p.Option{
|
opts := []libp2p.Option{
|
||||||
|
@ -76,12 +70,16 @@ func NewClusterHost(
|
||||||
idht, err = newDHT(ctx, h, ds)
|
idht, err = newDHT(ctx, h, ds)
|
||||||
return idht, err
|
return idht, err
|
||||||
}),
|
}),
|
||||||
|
libp2p.EnableNATService(),
|
||||||
libp2p.EnableRelay(),
|
libp2p.EnableRelay(),
|
||||||
libp2p.EnableAutoRelay(),
|
libp2p.EnableAutoRelay(),
|
||||||
libp2p.EnableRelayService(),
|
|
||||||
libp2p.EnableHolePunching(),
|
libp2p.EnableHolePunching(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if cfg.EnableRelayHop {
|
||||||
|
opts = append(opts, libp2p.EnableRelayService())
|
||||||
|
}
|
||||||
|
|
||||||
h, err := newHost(
|
h, err := newHost(
|
||||||
ctx,
|
ctx,
|
||||||
cfg.Secret,
|
cfg.Secret,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user