@cryptotaxi247 / kubo / commits / 88d7dfec2

go-ipfs-config: config: apply review to lowpower profile

License: MIT Signed-off-by: Łukasz Magiera <magik6k@gmail.com>

Łukasz Magiera committed Oct 31, 2017 at 19:34 UTC 88d7dfec2ffd3b33890872a2a5138a37d6b2e5f8
5 files changed +19 -5
config/config.go
+1
@@ -19,6 +19,7 @@ type Config struct {
19 Addresses Addresses // local node's addresses
20 Mounts Mounts // local node's mount points
21 Discovery Discovery // local node's discovery mechanisms
22 + Routing Routing // local node's routing settings
23 Ipns Ipns // Ipns settings
24 Bootstrap []string // local nodes's bootstrap peer addresses
25 Gateway Gateway // local node's gateway server options
config/discovery.go
-3
@@ -2,9 +2,6 @@ package config
2
3 type Discovery struct {
4 MDNS MDNS
5 -
6 - //Routing sets default daemon routing mode.
7 - Routing string
5 }
6
7 type MDNS struct {
config/init.go
+4 -1
@@ -43,7 +43,10 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
43 Enabled: true,
44 Interval: 10,
45 },
46 - Routing: "dht",
46 + },
47 +
48 + Routing: Routing{
49 + Type: "dht",
50 },
51
52 // setup the node mount points.
config/profile.go
+7 -1
@@ -1,5 +1,7 @@
1 package config
2
3 +import "time"
4 +
5 // Transformer is a function which takes configuration and applies some filter to it
6 type Transformer func(c *Config) error
7
@@ -74,8 +76,12 @@ var Profiles = map[string]Transformer{
76 return nil
77 },
78 "lowpower": func(c *Config) error {
77 - c.Discovery.Routing = "dhtclient"
79 + c.Routing.Type = "dhtclient"
80 c.Reprovider.Interval = "0"
81 +
82 + c.Swarm.ConnMgr.LowWater = 20
83 + c.Swarm.ConnMgr.HighWater = 40
84 + c.Swarm.ConnMgr.GracePeriod = time.Minute.String()
85 return nil
86 },
87 }
config/routing.go new
+7
@@ -0,0 +1,7 @@
1 +package config
2 +
3 +// Routing defines configuration options for libp2p routing
4 +type Routing struct {
5 + // Type sets default daemon routing mode.
6 + Type string
7 +}