mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
chore(config): make Routing.AcceleratedDHTClient a Flag (#10384)
This commit is contained in:
parent
6d535072dc
commit
cd78f2eae3
@ -424,7 +424,7 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
|
||||
case routingOptionNoneKwd:
|
||||
ncfg.Routing = libp2p.NilRouterOption
|
||||
case routingOptionCustomKwd:
|
||||
if cfg.Routing.AcceleratedDHTClient {
|
||||
if cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient) {
|
||||
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")
|
||||
}
|
||||
ncfg.Routing = libp2p.ConstructDelegatedRouting(
|
||||
|
||||
@ -6,6 +6,10 @@ import (
|
||||
"runtime"
|
||||
)
|
||||
|
||||
var (
|
||||
DefaultAcceleratedDHTClient = false
|
||||
)
|
||||
|
||||
// Routing defines configuration options for libp2p routing.
|
||||
type Routing struct {
|
||||
// Type sets default daemon routing mode.
|
||||
@ -15,7 +19,7 @@ type Routing struct {
|
||||
// When "custom" is set, user-provided Routing.Routers is used.
|
||||
Type *OptionalString `json:",omitempty"`
|
||||
|
||||
AcceleratedDHTClient bool
|
||||
AcceleratedDHTClient Flag `json:",omitempty"`
|
||||
|
||||
Routers Routers
|
||||
|
||||
|
||||
@ -286,7 +286,7 @@ func Online(bcfg *BuildCfg, cfg *config.Config, userResourceOverrides rcmgr.Part
|
||||
cfg.Experimental.StrategicProviding,
|
||||
cfg.Reprovider.Strategy.WithDefault(config.DefaultReproviderStrategy),
|
||||
cfg.Reprovider.Interval.WithDefault(config.DefaultReproviderInterval),
|
||||
cfg.Routing.AcceleratedDHTClient,
|
||||
cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient),
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ func BaseRouting(cfg *config.Config) interface{} {
|
||||
}
|
||||
}
|
||||
|
||||
if dualDHT != nil && cfg.Routing.AcceleratedDHTClient {
|
||||
if dualDHT != nil && cfg.Routing.AcceleratedDHTClient.WithDefault(config.DefaultAcceleratedDHTClient) {
|
||||
cfg, err := in.Repo.Config()
|
||||
if err != nil {
|
||||
return out, err
|
||||
|
||||
@ -1610,7 +1610,7 @@ them
|
||||
|
||||
Default: `false`
|
||||
|
||||
Type: `bool` (missing means `false`)
|
||||
Type: `flag`
|
||||
|
||||
### `Routing.Routers`
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user