chore(config): make Routing.AcceleratedDHTClient a Flag (#10384)
Henrique Dias committed
Apr 4, 2024 at 13:59 UTC
cd78f2eae3bdd04f9265a71dac91984ae457a86d
5 files changed
+9
-5
cmd/ipfs/kubo/daemon.go
+1
-1
@@ -424,7 +424,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
424
case routingOptionNoneKwd:
425
ncfg.Routing = libp2p.NilRouterOption
426
case routingOptionCustomKwd:
427
- if cfg.Routing.AcceleratedDHTClient {
427
+ if cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient) {
428
return fmt.Errorf("Routing.AcceleratedDHTClient option is set even tho Routing.Type is custom, using custom .AcceleratedDHTClient needs to be set on DHT routers individually")
429
}
430
ncfg.Routing = libp2p.ConstructDelegatedRouting(
config/routing.go
+5
-1
@@ -6,6 +6,10 @@ import (
6
"runtime"
7
)
8
9
+var (
10
+ DefaultAcceleratedDHTClient = false
11
+)
12
+
13
// Routing defines configuration options for libp2p routing.
14
type Routing struct {
15
// Type sets default daemon routing mode.
@@ -15,7 +19,7 @@ type Routing struct {
19
// When "custom" is set, user-provided Routing.Routers is used.
20
Type *OptionalString `json:",omitempty"`
21
18
- AcceleratedDHTClient bool
22
+ AcceleratedDHTClient Flag `json:",omitempty"`
23
24
Routers Routers
25
core/node/groups.go
+1
-1
@@ -286,7 +286,7 @@ func Online(bcfg *BuildCfg, cfg *config.Config, userResourceOverrides rcmgr.Part
286
cfg.Experimental.StrategicProviding,
287
cfg.Reprovider.Strategy.WithDefault(config.DefaultReproviderStrategy),
288
cfg.Reprovider.Interval.WithDefault(config.DefaultReproviderInterval),
289
- cfg.Routing.AcceleratedDHTClient,
289
+ cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient),
290
),
291
)
292
}
core/node/libp2p/routing.go
+1
-1
@@ -90,7 +90,7 @@ func BaseRouting(cfg *config.Config) interface{} {
90
}
91
}
92
93
- if dualDHT != nil && cfg.Routing.AcceleratedDHTClient {
93
+ if dualDHT != nil && cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient) {
94
cfg, err := in.Repo.Config()
95
if err != nil {
96
return out, err
docs/config.md
+1
-1
@@ -1610,7 +1610,7 @@ them
1610
1611
Default: `false`
1612
1613
-Type: `bool` (missing means `false`)
1613
+Type: `flag`
1614
1615
### `Routing.Routers`
1616