Skip to content

Commit

Permalink
go-ipfs-config: config: apply review to lowpower profile
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Łukasz Magiera <[email protected]>
  • Loading branch information
magik6k committed Mar 24, 2018
1 parent 8d8b02b commit 88d7dfe
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 0 additions & 3 deletions config/discovery.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package config

type Discovery struct {
MDNS MDNS

//Routing sets default daemon routing mode.
Routing string
}

type MDNS struct {
Expand Down
5 changes: 4 additions & 1 deletion config/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion config/profile.go
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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
},
}
Expand Down
7 changes: 7 additions & 0 deletions config/routing.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package config

// Routing defines configuration options for libp2p routing
type Routing struct {
// Type sets default daemon routing mode.
Type string
}

0 comments on commit 88d7dfe

Please sign in to comment.