go-ipfs-config: improve AutoRelay configuration, add config option for static relays
Marten Seemann committed
Nov 14, 2021 at 16:49 UTC
dcf17eb24a7e2b81b3da2a8779609fa74ddb234b
1 file changed
+18
-1
config/swarm.go
+18
-1
@@ -22,9 +22,16 @@ type SwarmConfig struct {
22
// EnableAutoRelay enables the "auto relay user" feature.
23
// Node will find and use advertised public relays when it determines that
24
// it's not reachable from the public internet.
25
+ //
26
+ // Deprecated: This flag is deprecated and is overriden by
27
+ // `Swarm.AutoRelay.Enabled` if specified.
28
EnableAutoRelay bool
29
27
- // RelayService.* controls the "auto relay service" feature.
30
+ // AutoRelay controls the "auto relay service" feature.
31
+ // When enabled, the node will use relays if it is not publicly reachable.
32
+ AutoRelay AutoRelay
33
+
34
+ // RelayService.* controls the "relay service".
35
// When enabled, node will provide a limited relay service to other peers.
36
RelayService RelayService
37
@@ -35,6 +42,16 @@ type SwarmConfig struct {
42
ConnMgr ConnMgr
43
}
44
45
+type AutoRelay struct {
46
+ // Enables the AutoRelay.
47
+ Enabled Flag `json:",omitempty"`
48
+
49
+ // StaticRelays configures static relays to use when this node is not
50
+ // publicly reachable. If set, auto relay will not try to find any
51
+ // other relay servers.
52
+ StaticRelays []string `json:",omitempty"`
53
+}
54
+
55
// RelayService configures the resources of the circuit v2 relay.
56
// For every field a reasonable default will be defined in go-ipfs.
57
type RelayService struct {