1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-05-17 15:06:47 +08:00

feat: explicit announce-on/off profiles (#10524)

moving reprovide on/off to separate profile to avoid footgun
where node no longer announces to DHT + ipfs daemon check
that prints warning on start if reprovide system is disabled
This commit is contained in:
Marcin Rataj
2024-10-03 21:39:52 +02:00
committed by GitHub
parent 22aeb13124
commit a8ecf014a9
4 changed files with 102 additions and 33 deletions

View File

@ -174,10 +174,12 @@ functionality - performance of content discovery and data
fetching may be degraded.
`,
Transform: func(c *Config) error {
// Disable "server" services (dht, autonat, limited relay)
c.Routing.Type = NewOptionalString("autoclient")
c.AutoNAT.ServiceMode = AutoNATServiceDisabled
c.Reprovider.Interval = NewOptionalDuration(0)
c.Swarm.RelayService.Enabled = False
// Keep bare minimum connections around
lowWater := int64(20)
highWater := int64(40)
gracePeriod := time.Minute
@ -188,6 +190,29 @@ fetching may be degraded.
return nil
},
},
"announce-off": {
Description: `Disables Reprovide system (and announcing to Amino DHT).
USE WITH CAUTION:
The main use case for this is setups with manual Peering.Peers config.
Data from this node will not be announced on the DHT. This will make
DHT-based routing an data retrieval impossible if this node is the only
one hosting it, and other peers are not already connected to it.
`,
Transform: func(c *Config) error {
c.Reprovider.Interval = NewOptionalDuration(0) // 0 disables periodic reprovide
c.Experimental.StrategicProviding = true // this is not a typo (the name is counter-intuitive)
return nil
},
},
"announce-on": {
Description: `Re-enables Reprovide system (reverts announce-off profile).`,
Transform: func(c *Config) error {
c.Reprovider.Interval = NewOptionalDuration(DefaultReproviderInterval) // have to apply explicit default because nil would be ignored
c.Experimental.StrategicProviding = false // this is not a typo (the name is counter-intuitive)
return nil
},
},
"randomports": {
Description: `Use a random port number for swarm.`,