diff --git a/core/node/groups.go b/core/node/groups.go index 0cc32934ad9..d80c5fc268a 100644 --- a/core/node/groups.go +++ b/core/node/groups.go @@ -130,7 +130,6 @@ func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option { fx.Provide(libp2p.AddrFilters(cfg.Swarm.AddrFilters)), fx.Provide(libp2p.AddrsFactory(cfg.Addresses.Announce, cfg.Addresses.AppendAnnounce, cfg.Addresses.NoAnnounce)), fx.Provide(libp2p.SmuxTransport(cfg.Swarm.Transports)), - fx.Provide(libp2p.Relay(enableRelay, cfg.Swarm.EnableRelayHop)), fx.Provide(libp2p.Transports(cfg.Swarm.Transports)), fx.Invoke(libp2p.StartListening(cfg.Addresses.Swarm)), fx.Invoke(libp2p.SetupDiscovery(cfg.Discovery.MDNS.Enabled, cfg.Discovery.MDNS.Interval)), diff --git a/core/node/libp2p/nat.go b/core/node/libp2p/nat.go index 9fe74d91cb3..ce0ca345f70 100644 --- a/core/node/libp2p/nat.go +++ b/core/node/libp2p/nat.go @@ -3,7 +3,7 @@ package libp2p import ( "time" - "github.com/ipfs/go-ipfs-config" + config "github.com/ipfs/go-ipfs-config" "github.com/libp2p/go-libp2p" ) @@ -13,14 +13,12 @@ func AutoNATService(throttle *config.AutoNATThrottleConfig) func() Libp2pOpts { return func() (opts Libp2pOpts) { opts.Opts = append(opts.Opts, libp2p.EnableNATService()) if throttle != nil { - global := throttle.GlobalLimit - peer := throttle.PeerLimit - interval := time.Duration(throttle.Interval) - if interval == 0 { - interval = time.Minute - } opts.Opts = append(opts.Opts, - libp2p.AutoNATServiceRateLimit(global, peer, interval), + libp2p.AutoNATServiceRateLimit( + throttle.GlobalLimit, + throttle.PeerLimit, + throttle.Interval.WithDefault(time.Minute), + ), ) } return opts