mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-26 21:07:45 +08:00
go-ipfs-config: config: apply review to lowpower profile
License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>
This commit is contained in:
parent
8d8b02b797
commit
88d7dfec2f
@ -19,6 +19,7 @@ type Config struct {
|
||||
Addresses Addresses // local node's addresses
|
||||
Mounts Mounts // local node's mount points
|
||||
Discovery Discovery // local node's discovery mechanisms
|
||||
Routing Routing // local node's routing settings
|
||||
Ipns Ipns // Ipns settings
|
||||
Bootstrap []string // local nodes's bootstrap peer addresses
|
||||
Gateway Gateway // local node's gateway server options
|
||||
|
||||
@ -2,9 +2,6 @@ package config
|
||||
|
||||
type Discovery struct {
|
||||
MDNS MDNS
|
||||
|
||||
//Routing sets default daemon routing mode.
|
||||
Routing string
|
||||
}
|
||||
|
||||
type MDNS struct {
|
||||
|
||||
@ -43,7 +43,10 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
|
||||
Enabled: true,
|
||||
Interval: 10,
|
||||
},
|
||||
Routing: "dht",
|
||||
},
|
||||
|
||||
Routing: Routing{
|
||||
Type: "dht",
|
||||
},
|
||||
|
||||
// setup the node mount points.
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
package config
|
||||
|
||||
import "time"
|
||||
|
||||
// Transformer is a function which takes configuration and applies some filter to it
|
||||
type Transformer func(c *Config) error
|
||||
|
||||
@ -74,8 +76,12 @@ var Profiles = map[string]Transformer{
|
||||
return nil
|
||||
},
|
||||
"lowpower": func(c *Config) error {
|
||||
c.Discovery.Routing = "dhtclient"
|
||||
c.Routing.Type = "dhtclient"
|
||||
c.Reprovider.Interval = "0"
|
||||
|
||||
c.Swarm.ConnMgr.LowWater = 20
|
||||
c.Swarm.ConnMgr.HighWater = 40
|
||||
c.Swarm.ConnMgr.GracePeriod = time.Minute.String()
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
7
config/routing.go
Normal file
7
config/routing.go
Normal file
@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
// Routing defines configuration options for libp2p routing
|
||||
type Routing struct {
|
||||
// Type sets default daemon routing mode.
|
||||
Type string
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user