@cryptotaxi247 / kubo / commits / 4d956d2ba

update for changed relay defaults

License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Oct 24, 2018 at 10:49 UTC 4d956d2ba92c864bcc8c825c02f2f7f4748d1e3b
1 file changed +11 -7
core/core.go
+11 -7
@@ -241,17 +241,21 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
241 if !cfg.Swarm.DisableNatPortMap {
242 libp2pOpts = append(libp2pOpts, libp2p.NATPortMap())
243 }
244 - if !cfg.Swarm.DisableRelay {
245 - var opts []circuit.RelayOpt
246 - if cfg.Swarm.EnableRelayHop {
247 - opts = append(opts, circuit.OptHop)
248 - }
249 - libp2pOpts = append(libp2pOpts, libp2p.EnableRelay(opts...))
250 - }
244
245 // disable the default listen addrs
246 libp2pOpts = append(libp2pOpts, libp2p.NoListenAddrs)
247
248 + if cfg.Swarm.DisableRelay {
249 + // Enabled by default.
250 + libp2pOpts = append(libp2pOpts, libp2p.DisableRelay())
251 + } else {
252 + relayOpts := []circuit.RelayOpt{circuit.OptDiscovery}
253 + if cfg.Swarm.EnableRelayHop {
254 + relayOpts = append(relayOpts, circuit.OptHop)
255 + }
256 + libp2pOpts = append(libp2pOpts, libp2p.EnableRelay(relayOpts...))
257 + }
258 +
259 // explicitly enable the default transports
260 libp2pOpts = append(libp2pOpts, libp2p.DefaultTransports)
261