fix: remove mdns_legacy & Discovery.MDNS.Interval
* fix: remove mdns_legacy We've been running both implementations for a long, long time. It is time to remove legacy version and lower the number of LAN packets IPFS node produces. See https://github.com/ipfs/go-ipfs/pull/9048#discussion_r906814717 for the Interval removal rational.
Marcin Rataj committed
Jun 27, 2022 at 04:17 UTC
61f071010021def1fbb7a52a5d42b335f45feb57
7 files changed
+19
-33
config/discovery.go
+3
-2
@@ -7,6 +7,7 @@ type Discovery struct {
7
type MDNS struct {
8
Enabled bool
9
10
- // Time in seconds between discovery rounds
11
- Interval int
10
+ // DEPRECATED: the time between discovery rounds is no longer configurable
11
+ // See: https://github.com/ipfs/go-ipfs/pull/9048#discussion_r906814717
12
+ Interval *OptionalInteger `json:",omitempty"`
13
}
config/init.go
+1
-2
@@ -43,8 +43,7 @@ func InitWithIdentity(identity Identity) (*Config, error) {
43
Identity: identity,
44
Discovery: Discovery{
45
MDNS: MDNS{
46
- Enabled: true,
47
- Interval: 10,
46
+ Enabled: true,
47
},
48
},
49
core/node/groups.go
+1
-1
@@ -159,7 +159,7 @@ func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option {
159
fx.Provide(libp2p.RelayService(enableRelayService, cfg.Swarm.RelayService)),
160
fx.Provide(libp2p.Transports(cfg.Swarm.Transports)),
161
fx.Invoke(libp2p.StartListening(cfg.Addresses.Swarm)),
162
- fx.Invoke(libp2p.SetupDiscovery(cfg.Discovery.MDNS.Enabled, cfg.Discovery.MDNS.Interval)),
162
+ fx.Invoke(libp2p.SetupDiscovery(cfg.Discovery.MDNS.Enabled)),
163
fx.Provide(libp2p.ForceReachability(cfg.Internal.Libp2pForceReachability)),
164
fx.Provide(libp2p.HolePunching(cfg.Swarm.EnableHolePunching, enableRelayClient)),
165
core/node/libp2p/discovery.go
+1
-12
@@ -7,7 +7,6 @@ import (
7
"github.com/libp2p/go-libp2p-core/host"
8
"github.com/libp2p/go-libp2p-core/peer"
9
"github.com/libp2p/go-libp2p/p2p/discovery/mdns"
10
- legacymdns "github.com/libp2p/go-libp2p/p2p/discovery/mdns_legacy"
10
11
"go.uber.org/fx"
12
@@ -37,7 +36,7 @@ func DiscoveryHandler(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host)
36
}
37
}
38
40
-func SetupDiscovery(useMdns bool, mdnsInterval int) func(helpers.MetricsCtx, fx.Lifecycle, host.Host, *discoveryHandler) error {
39
+func SetupDiscovery(useMdns bool) func(helpers.MetricsCtx, fx.Lifecycle, host.Host, *discoveryHandler) error {
40
return func(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, handler *discoveryHandler) error {
41
if useMdns {
42
service := mdns.NewMdnsService(host, mdns.ServiceName, handler)
@@ -45,16 +44,6 @@ func SetupDiscovery(useMdns bool, mdnsInterval int) func(helpers.MetricsCtx, fx.
44
log.Error("error starting mdns service: ", err)
45
return nil
46
}
48
-
49
- if mdnsInterval == 0 {
50
- mdnsInterval = 5
51
- }
52
- legacyService, err := legacymdns.NewMdnsService(mctx, host, time.Duration(mdnsInterval)*time.Second, legacymdns.ServiceTag)
53
- if err != nil {
54
- log.Error("mdns error: ", err)
55
- return nil
56
- }
57
- legacyService.RegisterNotifee(handler)
47
}
48
return nil
49
}
docs/config.md
+13
-14
@@ -5,10 +5,10 @@ is read once at node instantiation, either for an offline command, or when
5
starting the daemon. Commands that execute on a running daemon do not read the
6
config file at runtime.
7
8
-## Table of Contents
8
+# Table of Contents
9
10
- [The go-ipfs config file](#the-go-ipfs-config-file)
11
- - [Table of Contents](#table-of-contents)
11
+- [Table of Contents](#table-of-contents)
12
- [Profiles](#profiles)
13
- [Types](#types)
14
- [`flag`](#flag)
@@ -108,13 +108,15 @@ config file at runtime.
108
- [`Swarm.DisableBandwidthMetrics`](#swarmdisablebandwidthmetrics)
109
- [`Swarm.DisableNatPortMap`](#swarmdisablenatportmap)
110
- [`Swarm.EnableHolePunching`](#swarmenableholepunching)
111
+ - [`Swarm.EnableAutoRelay`](#swarmenableautorelay)
112
- [`Swarm.RelayClient`](#swarmrelayclient)
113
- [`Swarm.RelayClient.Enabled`](#swarmrelayclientenabled)
114
- [`Swarm.RelayClient.StaticRelays`](#swarmrelayclientstaticrelays)
115
- [`Swarm.RelayService`](#swarmrelayservice)
116
- [`Swarm.RelayService.Enabled`](#swarmrelayserviceenabled)
116
- - [`Swarm.RelayService.ConnectionDurationLimit`](#swarmrelayserviceconnectiondurationlimit)
117
- - [`Swarm.RelayService.ConnectionDataLimit`](#swarmrelayserviceconnectiondatalimit)
117
+ - [`Swarm.RelayService.Limit`](#swarmrelayservicelimit)
118
+ - [`Swarm.RelayService.ConnectionDurationLimit`](#swarmrelayserviceconnectiondurationlimit)
119
+ - [`Swarm.RelayService.ConnectionDataLimit`](#swarmrelayserviceconnectiondatalimit)
120
- [`Swarm.RelayService.ReservationTTL`](#swarmrelayservicereservationttl)
121
- [`Swarm.RelayService.MaxReservations`](#swarmrelayservicemaxreservations)
122
- [`Swarm.RelayService.MaxCircuits`](#swarmrelayservicemaxcircuits)
@@ -122,6 +124,8 @@ config file at runtime.
124
- [`Swarm.RelayService.MaxReservationsPerPeer`](#swarmrelayservicemaxreservationsperpeer)
125
- [`Swarm.RelayService.MaxReservationsPerIP`](#swarmrelayservicemaxreservationsperip)
126
- [`Swarm.RelayService.MaxReservationsPerASN`](#swarmrelayservicemaxreservationsperasn)
127
+ - [`Swarm.EnableRelayHop`](#swarmenablerelayhop)
128
+ - [`Swarm.DisableRelay`](#swarmdisablerelay)
129
- [`Swarm.EnableAutoNATService`](#swarmenableautonatservice)
130
- [`Swarm.ConnMgr`](#swarmconnmgr)
131
- [`Swarm.ConnMgr.Type`](#swarmconnmgrtype)
@@ -149,8 +153,6 @@ config file at runtime.
153
- [`DNS.Resolvers`](#dnsresolvers)
154
- [`DNS.MaxCacheTTL`](#dnsmaxcachettl)
155
152
-
153
-
156
## Profiles
157
158
Configuration profiles allow to tweak configuration quickly. Profiles can be
@@ -574,15 +576,15 @@ Type: `object`
576
577
## `Discovery`
578
577
-Contains options for configuring ipfs node discovery mechanisms.
579
+Contains options for configuring IPFS node discovery mechanisms.
580
581
### `Discovery.MDNS`
582
581
-Options for multicast dns peer discovery.
583
+Options for [ZeroConf](https://github.com/libp2p/zeroconf#readme) Multicast DNS-SD peer discovery.
584
585
#### `Discovery.MDNS.Enabled`
586
585
-A boolean value for whether or not mdns should be active.
587
+A boolean value for whether or not Multicast DNS-SD should be active.
588
589
Default: `true`
590
@@ -590,11 +592,8 @@ Type: `bool`
592
593
#### `Discovery.MDNS.Interval`
594
593
-The number of seconds between discovery checks.
594
-
595
-Default: `5`
596
-
597
-Type: `integer` (integer seconds, 0 means the default)
595
+**REMOVED:** this is not configurable any more
596
+in the [new mDNS implementation](https://github.com/libp2p/zeroconf#readme).
597
598
## `Gateway`
599
go.mod
-1
@@ -245,7 +245,6 @@ require (
245
github.com/whyrusleeping/cbor-gen v0.0.0-20210219115102-f37d292932f2 // indirect
246
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
247
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1 // indirect
248
- github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 // indirect
248
github.com/whyrusleeping/timecache v0.0.0-20160911033111-cfcb2f1abfee // indirect
249
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.7.0 // indirect
250
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.7.0 // indirect
go.sum
-1
@@ -1556,7 +1556,6 @@ github.com/whyrusleeping/go-sysinfo v0.0.0-20190219211824-4a357d4b90b1 h1:ctS9An
1556
github.com/whyrusleeping/go-sysinfo v0.0.0-20190219211824-4a357d4b90b1/go.mod h1:tKH72zYNt/exx6/5IQO6L9LoQ0rEjd5SbbWaDTs9Zso=
1557
github.com/whyrusleeping/mafmt v1.2.8/go.mod h1:faQJFPbLSxzD9xpA02ttW/tS9vZykNvXwGvqIpk20FA=
1558
github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4=
1559
-github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9 h1:Y1/FEOpaCpD21WxrmfeIYCFPuVPRCY2XZTWzTNHGw30=
1559
github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4=
1560
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds=
1561
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI=