Skip to content

Commit 90f82f3

Browse files
authored
docs: custom-libp2p example print peer id in swarm addresses on startup (#2775)
Since libp2p/js-libp2p#558 js-libp2p now requires peer ids to be part of dialled multiaddrs. Previously a user was able to copy/paste swarm addresses printed as part of the daemon starting up but now they can't because the peer id is not included in the console output. This PR prints the node's peer id as part of the swarm address to let people continue doing this and fixes the custom-libp2p example.
1 parent 8cf9692 commit 90f82f3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

index.js

+12
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const libp2pBundle = (opts) => {
3232
const bootstrapList = opts.config.Bootstrap
3333

3434
// Build and return our libp2p node
35+
// n.b. for full configuration options, see https://github.com/libp2p/js-libp2p/blob/master/doc/CONFIGURATION.md
3536
return new Libp2p({
3637
peerInfo,
3738
peerBook,
@@ -91,6 +92,17 @@ const libp2pBundle = (opts) => {
9192
pubsub: {
9293
enabled: true
9394
}
95+
},
96+
metrics: {
97+
enabled: true,
98+
computeThrottleMaxQueueSize: 1000, // How many messages a stat will queue before processing
99+
computeThrottleTimeout: 2000, // Time in milliseconds a stat will wait, after the last item was added, before processing
100+
movingAverageIntervals: [ // The moving averages that will be computed
101+
60 * 1000, // 1 minute
102+
5 * 60 * 1000, // 5 minutes
103+
15 * 60 * 1000 // 15 minutes
104+
],
105+
maxOldPeersRetention: 50 // How many disconnected peers we will retain stats for
94106
}
95107
})
96108
}

0 commit comments

Comments
 (0)