Skip to content

Commit cd78f2e

Browse files
authored
chore(config): make Routing.AcceleratedDHTClient a Flag (#10384)
1 parent 6d53507 commit cd78f2e

File tree

5 files changed

+9
-5
lines changed

5 files changed

+9
-5
lines changed

cmd/ipfs/kubo/daemon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
424424
case routingOptionNoneKwd:
425425
ncfg.Routing = libp2p.NilRouterOption
426426
case routingOptionCustomKwd:
427-
if cfg.Routing.AcceleratedDHTClient {
427+
if cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient) {
428428
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")
429429
}
430430
ncfg.Routing = libp2p.ConstructDelegatedRouting(

config/routing.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ import (
66
"runtime"
77
)
88

9+
var (
10+
DefaultAcceleratedDHTClient = false
11+
)
12+
913
// Routing defines configuration options for libp2p routing.
1014
type Routing struct {
1115
// Type sets default daemon routing mode.
@@ -15,7 +19,7 @@ type Routing struct {
1519
// When "custom" is set, user-provided Routing.Routers is used.
1620
Type *OptionalString `json:",omitempty"`
1721

18-
AcceleratedDHTClient bool
22+
AcceleratedDHTClient Flag `json:",omitempty"`
1923

2024
Routers Routers
2125

core/node/groups.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ func Online(bcfg *BuildCfg, cfg *config.Config, userResourceOverrides rcmgr.Part
286286
cfg.Experimental.StrategicProviding,
287287
cfg.Reprovider.Strategy.WithDefault(config.DefaultReproviderStrategy),
288288
cfg.Reprovider.Interval.WithDefault(config.DefaultReproviderInterval),
289-
cfg.Routing.AcceleratedDHTClient,
289+
cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient),
290290
),
291291
)
292292
}

core/node/libp2p/routing.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func BaseRouting(cfg *config.Config) interface{} {
9090
}
9191
}
9292

93-
if dualDHT != nil && cfg.Routing.AcceleratedDHTClient {
93+
if dualDHT != nil && cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient) {
9494
cfg, err := in.Repo.Config()
9595
if err != nil {
9696
return out, err

docs/config.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1610,7 +1610,7 @@ them
16101610

16111611
Default: `false`
16121612

1613-
Type: `bool` (missing means `false`)
1613+
Type: `flag`
16141614

16151615
### `Routing.Routers`
16161616

0 commit comments

Comments
 (0)