Skip to content
This repository was archived by the owner on Mar 9, 2022. It is now read-only.

Commit 11c674c

Browse files
committed
config: apply review to lowpower profile
License: MIT Signed-off-by: Łukasz Magiera <[email protected]>
1 parent 2c417e6 commit 11c674c

File tree

5 files changed

+19
-5
lines changed

5 files changed

+19
-5
lines changed

config.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ type Config struct {
1919
Addresses Addresses // local node's addresses
2020
Mounts Mounts // local node's mount points
2121
Discovery Discovery // local node's discovery mechanisms
22+
Routing Routing // local node's routing settings
2223
Ipns Ipns // Ipns settings
2324
Bootstrap []string // local nodes's bootstrap peer addresses
2425
Gateway Gateway // local node's gateway server options

discovery.go

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ package config
22

33
type Discovery struct {
44
MDNS MDNS
5-
6-
//Routing sets default daemon routing mode.
7-
Routing string
85
}
96

107
type MDNS struct {

init.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
4343
Enabled: true,
4444
Interval: 10,
4545
},
46-
Routing: "dht",
46+
},
47+
48+
Routing: Routing{
49+
Type: "dht",
4750
},
4851

4952
// setup the node mount points.

profile.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package config
22

3+
import "time"
4+
35
// Transformer is a function which takes configuration and applies some filter to it
46
type Transformer func(c *Config) error
57

@@ -74,8 +76,12 @@ var Profiles = map[string]Transformer{
7476
return nil
7577
},
7678
"lowpower": func(c *Config) error {
77-
c.Discovery.Routing = "dhtclient"
79+
c.Routing.Type = "dhtclient"
7880
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()
7985
return nil
8086
},
8187
}

routing.go

+7
Original file line numberDiff line numberDiff line change
@@ -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+
}

0 commit comments

Comments
 (0)