go-ipfs-config: default settings for the connection manager
License: MIT Signed-off-by: Jeromy <jeromyj@gmail.com>
Jeromy committed
Oct 19, 2017 at 09:15 UTC
330b646a349132f3514c940b99815a6c24e74048
1 file changed
+21
config/init.go
+21
@@ -5,6 +5,7 @@ import (
5
"errors"
6
"fmt"
7
"io"
8
+ "time"
9
10
peer "gx/ipfs/QmXYjuNuxVzXKJCfWasQk1RqkhVLDM9jtUKhqc2WPQmFSB/go-libp2p-peer"
11
ci "gx/ipfs/QmaPbCnUMBohSGo3KnxEa2bHqyJVVeEEcwtqJAYxerieBo/go-libp2p-crypto"
@@ -71,11 +72,31 @@ func Init(out io.Writer, nBitsForKeypair int) (*Config, error) {
72
Interval: "12h",
73
Strategy: "all",
74
},
75
+ Swarm: SwarmConfig{
76
+ ConnMgr: ConnMgr{
77
+ LowWater: DefaultConnMgrLowWater,
78
+ HighWater: DefaultConnMgrHighWater,
79
+ GracePeriod: DefaultConnMgrGracePeriod.String(),
80
+ Type: "basic",
81
+ },
82
+ },
83
}
84
85
return conf, nil
86
}
87
88
+// DefaultConnMgrHighWater is the default value for the connection managers
89
+// 'high water' mark
90
+const DefaultConnMgrHighWater = 900
91
+
92
+// DefaultConnMgrLowWater is the default value for the connection managers 'low
93
+// water' mark
94
+const DefaultConnMgrLowWater = 600
95
+
96
+// DefaultConnMgrGracePeriod is the default value for the connection managers
97
+// grace period
98
+const DefaultConnMgrGracePeriod = time.Second * 20
99
+
100
// DefaultDatastoreConfig is an internal function exported to aid in testing.
101
func DefaultDatastoreConfig() Datastore {
102
return Datastore{