You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: doc/API.md
+5-5
Original file line number
Diff line number
Diff line change
@@ -80,16 +80,16 @@ Creates an instance of Libp2p.
80
80
| Name | Type | Description |
81
81
|------|------|-------------|
82
82
| options |`object`| libp2p options |
83
-
| options.modules |`Array<object>`| libp2p modules to use |
83
+
| options.modules |[`Array<object>`](./CONFIGURATION.md#modules)| libp2p modules to use |
84
84
|[options.addresses]|`{ listen: Array<string>, announce: Array<string>, noAnnounce: Array<string> }`| Addresses for transport listening and to advertise to the network |
85
85
|[options.config]|`object`| libp2p modules configuration and core configuration |
|[options.datastore]|`object`| must implement [ipfs/interface-datastore](https://github.com/ipfs/interface-datastore) (in memory datastore will be used if not provided) |
Dialing in libp2p can be configured to limit the rate of dialing, and how long dials are allowed to take. The below configuration example shows the default values for the dialer.
460
+
Dialing in libp2p can be configured to limit the rate of dialing, and how long dials are allowed to take. The dialer configuration object should have the following properties:
461
+
462
+
| Name | Type | Description |
463
+
|------|------|-------------|
464
+
| maxParallelDials |`number`| How many multiaddrs we can dial in parallel. |
465
+
| maxDialsPerPeer |`number`| How many multiaddrs we can dial per peer, in parallel. |
466
+
| dialTimeout |`number`| Second dial timeout per peer in ms. |
467
+
468
+
The below configuration example shows how the dialer should be configured, with the current defaults:
Metrics are disabled in libp2p by default. You can enable and configure them as follows. Aside from enabled being `false` by default, the configuration options listed here are the current defaults.
522
+
Metrics are disabled in libp2p by default. You can enable and configure them as follows:
| computeThrottleMaxQueueSize | `number` | How many messages a stat will queue before processing. |
528
+
| computeThrottleTimeout | `number` | Time in milliseconds a stat will wait, after the last item was added, before processing. |
529
+
| movingAverageIntervals | `Array<number>` | The moving averages that will be computed. |
530
+
| maxOldPeersRetention | `number` | How many disconnected peers we will retain stats for. |
531
+
532
+
The below configuration example shows how the metrics should be configured. Aside from enabled being `false` by default, the following default configuration options are listed below:
computeThrottleMaxQueueSize:1000,// How many messages a stat will queue before processing
530
-
computeThrottleTimeout:2000,// Time in milliseconds a stat will wait, after the last item was added, before processing
531
-
movingAverageIntervals: [// The moving averages that will be computed
548
+
computeThrottleMaxQueueSize:1000,
549
+
computeThrottleTimeout:2000,
550
+
movingAverageIntervals: [
532
551
60*1000, // 1 minute
533
552
5*60*1000, // 5 minutes
534
553
15*60*1000// 15 minutes
535
554
],
536
-
maxOldPeersRetention:50// How many disconnected peers we will retain stats for
555
+
maxOldPeersRetention:50
537
556
}
538
557
})
539
558
```
@@ -544,6 +563,13 @@ PeerStore persistence is disabled in libp2p by default. You can enable and confi
544
563
545
564
The threshold number represents the maximum number of "dirty peers" allowed in the PeerStore, i.e. peers that are not updated in the datastore. In this context, browser nodes should use a threshold of 1, since they might not "stop" properly in several scenarios and the PeerStore might end up with unflushed records when the window is closed.
546
565
566
+
| Name | Type | Description |
567
+
|------|------|-------------|
568
+
| persistence | `boolean` | Is persistence enabled. |
569
+
| threshold | `number` | Number of dirty peers allowed. |
570
+
571
+
The below configuration example shows how the PeerStore should be configured. Aside from persistence being `false` by default, the following default configuration options are listed below:
0 commit comments