Skip to content

Commit fe41a6d

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

File tree

9 files changed

+21
-10
lines changed

9 files changed

+21
-10
lines changed

cmd/ipfs/daemon.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func daemonFunc(req cmds.Request, re cmds.ResponseEmitter) {
312312
return
313313
}
314314

315-
routingOption = cfg.Discovery.Routing
315+
routingOption = cfg.Routing.Type
316316
if routingOption == "" {
317317
routingOption = routingOptionDHTKwd
318318
}

docs/config.md

-1
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ Valid modes are:
203203
- `dht` (default)
204204
- `dhtclient`
205205
- `none`
206-
- `supernode` (deprecated)
207206

208207
## `Gateway`
209208
Options for the HTTP gateway.

repo/config/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

repo/config/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 {

repo/config/init.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
3838
Enabled: true,
3939
Interval: 10,
4040
},
41-
Routing: "dht",
41+
},
42+
43+
Routing: Routing{
44+
Type: "dht",
4245
},
4346

4447
// setup the node mount points.

repo/config/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
}

repo/config/routing.go

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
package config
2+
3+
type Routing struct {
4+
// Type sets default daemon routing mode.
5+
Type string
6+
}

test/sharness/t0020-init.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ test_expect_success "'ipfs init --profile=lowpower' succeeds" '
173173
'
174174

175175
test_expect_success "'ipfs config Discovery.Routing' looks good" '
176-
ipfs config Discovery.Routing > actual_config &&
176+
ipfs config Routing.Type > actual_config &&
177177
test $(cat actual_config) = "dhtclient"
178178
'
179179

test/sharness/t0021-config.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ CONFIG_SET_JSON_TEST='{
4545
"MDNS": {
4646
"Enabled": true,
4747
"Interval": 10
48-
},
49-
"Routing": "dht"
48+
}
5049
}'
5150

5251
test_profile_apply_revert() {

0 commit comments

Comments
 (0)