@@ -18,6 +18,7 @@ import (
18
18
"github.com/pkg/errors"
19
19
"github.com/rs/zerolog/log"
20
20
21
+ "github.com/shutter-network/rolling-shutter/rolling-shutter/cmd/shversion"
21
22
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/encodeable/address"
22
23
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/encodeable/env"
23
24
"github.com/shutter-network/rolling-shutter/rolling-shutter/medley/encodeable/keys"
@@ -198,8 +199,10 @@ func createHost(
198
199
options := []libp2p.Option {
199
200
libp2p .Identity (& config .PrivKey .Key ),
200
201
libp2p .ListenAddrs (config .ListenAddrs ... ),
202
+ libp2p .UserAgent (fmt .Sprintf ("shutter-network/%s" , shversion .VersionShort ())),
201
203
libp2p .ConnectionManager (connectionManager ),
202
204
libp2p .ProtocolVersion (protocolVersion ),
205
+ libp2p .EnableRelay (),
203
206
libp2p .Ping (true ),
204
207
}
205
208
@@ -213,6 +216,17 @@ func createHost(
213
216
// Attempt to open ports using uPNP for NATed hosts.
214
217
libp2p .NATPortMap (),
215
218
)
219
+ if len (config .BootstrapPeers ) > 0 {
220
+ options = append (options ,
221
+ libp2p .EnableAutoRelayWithStaticRelays (config .BootstrapPeers ),
222
+ )
223
+ }
224
+ if config .IsBootstrapNode {
225
+ // Enable the Relay service on bootstrap nodes so other peers can connect through us
226
+ options = append (options ,
227
+ libp2p .EnableRelayService (),
228
+ )
229
+ }
216
230
}
217
231
218
232
p2pHost , err := libp2p .New (options ... )
0 commit comments