go-ipfs-config: feat: add a transports section for enabling/disabling/prioritizing transports
Steven Allen committed
Jun 15, 2020 at 13:41 UTC
4f3aeb74286ae89137af690f2ea0aec989639c7b
1 file changed
+61
-6
config/swarm.go
+61
-6
@@ -1,19 +1,74 @@
1
package config
2
3
type SwarmConfig struct {
4
- AddrFilters []string
4
+ // AddrFilters specifies a set libp2p addresses that we should never
5
+ // dial or receive connections from.
6
+ AddrFilters []string
7
+
8
+ // DisableBandwidthMetrics disables recording of bandwidth metrics for a
9
+ // slight reduction in memory usage. You probably don't need to set this
10
+ // flag.
11
DisableBandwidthMetrics bool
6
- DisableNatPortMap bool
7
- DisableRelay bool
8
- EnableRelayHop bool
12
10
- // autorelay functionality
11
- // if true, then the libp2p host will be constructed with autorelay functionality.
13
+ // DisableNatPortMap turns off NAT port mapping (UPnP, etc.).
14
+ DisableNatPortMap bool
15
+
16
+ // DisableRelay explicitly disables the relay transport.
17
+ //
18
+ // Deprecated: This flag is deprecated and is overridden by
19
+ // `Transports.Relay` if specified.
20
+ DisableRelay bool `json:",omitempty"`
21
+
22
+ // EnableRelayHop makes this node act as a public relay, relaying
23
+ // traffic between other nodes.
24
+ EnableRelayHop bool
25
+
26
+ // EnableAutoRelay enables the "auto relay" feature.
27
+ //
28
+ // When both EnableAutoRelay and RelayHop are set, this go-ipfs node
29
+ // will advertise itself as a public relay, instead of finding and using
30
+ // advertised public relays.
31
EnableAutoRelay bool
32
33
+ // Transports contains flags to enable/disable libp2p transports.
34
+ Transports Transports
35
+
36
+ // ConnMgr configures the connection manager.
37
ConnMgr ConnMgr
38
}
39
40
+type Transports struct {
41
+ // Network specifies the base transports we'll use for dialing. To
42
+ // listen on a transport, add the transport to your Addresses.Swarm.
43
+ Network struct {
44
+ // All default to on.
45
+ QUIC Flag `json:",omitempty"`
46
+ TCP Flag `json:",omitempty"`
47
+ Websocket Flag `json:",omitempty"`
48
+ Relay Flag `json:",omitempty"`
49
+ }
50
+
51
+ // Security specifies the transports used to encrypt insecure network
52
+ // transports.
53
+ Security struct {
54
+ // Defaults to 100.
55
+ TLS Priority `json:",omitempty"`
56
+ // Defaults to 200.
57
+ SECIO Priority `json:",omitempty"`
58
+ // Defaults to 300.
59
+ Noise Priority `json:",omitempty"`
60
+ }
61
+
62
+ // Multiplexers specifies the transports used to multiplex multiple
63
+ // connections over a single duplex connection.
64
+ Multiplex struct {
65
+ // Defaults to 100.
66
+ Yamux Priority `json:",omitempty"`
67
+ // Defaults to 200.
68
+ Mplex Priority `json:",omitempty"`
69
+ }
70
+}
71
+
72
// ConnMgr defines configuration options for the libp2p connection manager
73
type ConnMgr struct {
74
Type string