Skip to content

Commit 25d935e

Browse files
authored
docs: add limit configuration documentation (#1421)
To help people better configure their libp2p nodes to defend against malicious peers, document all the limit settings and protections in one place.
1 parent 6615efa commit 25d935e

File tree

3 files changed

+284
-25
lines changed

3 files changed

+284
-25
lines changed

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ If you are looking for the documentation of the latest release, you can view the
4545
- [Install](#install)
4646
- [Usage](#usage)
4747
- [Configuration](#configuration)
48+
- [Limits](#limits)
4849
- [API](#api)
4950
- [Getting started](#getting-started)
5051
- [Tutorials and Examples](#tutorials-and-examples)
@@ -85,6 +86,10 @@ npm install libp2p
8586

8687
For all the information on how you can configure libp2p see [CONFIGURATION.md](./doc/CONFIGURATION.md).
8788

89+
### Limits
90+
91+
For help configuring your node to resist malicious network peers, see [LIMITS.md](./doc/LIMITS.md)
92+
8893
### API
8994

9095
The specification is available on [API.md](./doc/API.md).

doc/CONFIGURATION.md

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#
1+
# Configuration <!-- omit in toc -->
22

33
- [Overview](#overview)
44
- [Modules](#modules)
@@ -35,6 +35,7 @@
3535
- [UPnP and NAT-PMP](#upnp-and-nat-pmp)
3636
- [Configuring protocol name](#configuring-protocol-name)
3737
- [Configuration examples](#configuration-examples)
38+
- [Limits](#limits)
3839

3940
## Overview
4041

@@ -67,13 +68,11 @@ Bear in mind that a **transport** and **connection encryption** module are **req
6768
6869
Some available transports are:
6970

70-
- [libp2p/js-libp2p-tcp](https://github.com/libp2p/js-libp2p-tcp)
71-
- [libp2p/js-libp2p-webrtc-star](https://github.com/libp2p/js-libp2p-webrtc-star)
72-
- [libp2p/js-libp2p-webrtc-direct](https://github.com/libp2p/js-libp2p-webrtc-direct)
73-
- [libp2p/js-libp2p-websockets](https://github.com/libp2p/js-libp2p-websockets)
74-
- [libp2p/js-libp2p-utp](https://github.com/libp2p/js-libp2p-utp) (Work in Progress)
75-
76-
You should take into consideration that `js-libp2p-tcp` and `js-libp2p-utp` are not available in a **browser** environment.
71+
- [@libp2p/tcp](https://github.com/libp2p/js-libp2p-tcp) (not available in browsers)
72+
- [@libp2p/webrtc-star](https://github.com/libp2p/js-libp2p-webrtc-star)
73+
- [@libp2p/webrtc-direct](https://github.com/libp2p/js-libp2p-webrtc-direct)
74+
- [@libp2p/websockets](https://github.com/libp2p/js-libp2p-websockets)
75+
- [@libp2p/webtransport](https://github.com/libp2p/js-libp2p-webtransport) (Work in Progress)
7776

7877
If none of the available transports fulfills your needs, you can create a libp2p compatible transport. A libp2p transport just needs to be compliant with the [Transport Interface](https://github.com/libp2p/js-interfaces/tree/master/src/transport).
7978

@@ -88,7 +87,8 @@ If you want to know more about libp2p transports, you should read the following
8887
8988
Some available stream multiplexers are:
9089

91-
- [libp2p/js-libp2p-mplex](https://github.com/libp2p/js-libp2p-mplex)
90+
- [@libp2p/mplex](https://github.com/libp2p/js-libp2p-mplex)
91+
- [@chainsafe/libp2p-yamux](https://github.com/chainsafe/js-libp2p-yamux)
9292

9393
If none of the available stream multiplexers fulfills your needs, you can create a libp2p compatible stream multiplexer. A libp2p multiplexer just needs to be compliant with the [Stream Muxer Interface](https://github.com/libp2p/js-interfaces/tree/master/src/stream-muxer).
9494

@@ -104,8 +104,8 @@ If you want to know more about libp2p stream multiplexing, you should read the f
104104
105105
Some available connection encryption protocols:
106106

107-
- [NodeFactoryIo/js-libp2p-noise](https://github.com/NodeFactoryIo/js-libp2p-noise)
108-
- [libp2p/js-libp2p-secio](https://github.com/libp2p/js-libp2p-secio) ⚠️ [DEPRECATED](https://blog.ipfs.io/2020-08-07-deprecating-secio)
107+
- [@chainsafe/libp2p-noise](https://github.com/chainsafe/js-libp2p-noise)
108+
- [Plaintext](https://github.com/libp2p/js-libp2p/blob/master/src/insecure/index.ts) (Not for production use)
109109

110110
If none of the available connection encryption mechanisms fulfills your needs, you can create a libp2p compatible one. A libp2p connection encryption protocol just needs to be compliant with the [Crypto Interface](https://github.com/libp2p/js-interfaces/tree/master/src/crypto).
111111

@@ -120,11 +120,11 @@ If you want to know more about libp2p connection encryption, you should read the
120120
121121
Some available peer discovery modules are:
122122

123-
- [js-libp2p-mdns](https://github.com/libp2p/js-libp2p-mdns)
124-
- [js-libp2p-bootstrap](https://github.com/libp2p/js-libp2p-bootstrap)
125-
- [js-libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht)
126-
- [js-libp2p-webrtc-star](https://github.com/libp2p/js-libp2p-webrtc-star)
127-
- [discv5](https://github.com/chainsafe/discv5)
123+
- [@libp2p/mdns](https://github.com/libp2p/js-libp2p-mdns)
124+
- [@libp2p/bootstrap](https://github.com/libp2p/js-libp2p-bootstrap)
125+
- [@libp2p/kad-dht](https://github.com/libp2p/js-libp2p-kad-dht)
126+
- [@libp2p/webrtc-star](https://github.com/libp2p/js-libp2p-webrtc-star)
127+
- [@chainsafe/discv5](https://github.com/chainsafe/discv5)
128128

129129
**Note**: `peer-discovery` services within transports (such as `js-libp2p-webrtc-star`) are automatically gathered from the `transport`, via it's `discovery` property. As such, they do not need to be added in the discovery modules. However, these transports can also be configured and disabled as the other ones.
130130

@@ -140,8 +140,8 @@ If you want to know more about libp2p peer discovery, you should read the follow
140140
141141
Some available content routing modules are:
142142

143-
- [js-libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht)
144-
- [js-libp2p-delegated-content-routing](https://github.com/libp2p/js-libp2p-delegated-content-routing)
143+
- [@libp2p/kad-dht](https://github.com/libp2p/js-libp2p-kad-dht)
144+
- [@libp2p/delegated-content-routing](https://github.com/libp2p/js-libp2p-delegated-content-routing)
145145

146146
If none of the available content routing protocols fulfills your needs, you can create a libp2p compatible one. A libp2p content routing protocol just needs to be compliant with the [Content Routing Interface](https://github.com/libp2p/js-interfaces/tree/master/src/content-routing). **(WIP: This module is not yet implemented)**
147147

@@ -155,8 +155,8 @@ If you want to know more about libp2p content routing, you should read the follo
155155
156156
Some available peer routing modules are:
157157

158-
- [js-libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht)
159-
- [js-libp2p-delegated-peer-routing](https://github.com/libp2p/js-libp2p-delegated-peer-routing)
158+
- [@libp2p/kad-dht](https://github.com/libp2p/js-libp2p-kad-dht)
159+
- [@libp2p/delegated-peer-routing](https://github.com/libp2p/js-libp2p-delegated-peer-routing)
160160

161161
If none of the available peer routing protocols fulfills your needs, you can create a libp2p compatible one. A libp2p peer routing protocol just needs to be compliant with the [Peer Routing Interface](https://github.com/libp2p/js-interfaces/tree/master/src/peer-routing). **(WIP: This module is not yet implemented)**
162162

@@ -168,7 +168,7 @@ If you want to know more about libp2p peer routing, you should read the followin
168168

169169
> A DHT can provide content and peer routing capabilities in a p2p system, as well as peer discovery capabilities.
170170
171-
The DHT implementation currently available is [libp2p/js-libp2p-kad-dht](https://github.com/libp2p/js-libp2p-kad-dht). This implementation is largely based on the Kademlia whitepaper, augmented with notions from S/Kademlia, Coral and mainlineDHT.
171+
The DHT implementation currently available is [@libp2p/kad-dht](https://github.com/libp2p/js-libp2p-kad-dht). This implementation is largely based on the Kademlia whitepaper, augmented with notions from S/Kademlia, Coral and mainlineDHT.
172172

173173
If this DHT implementation does not fulfill your needs and you want to create or use your own implementation, please get in touch with us through a github issue. We plan to work on improving the ability to bring your own DHT in a future release.
174174

@@ -183,10 +183,10 @@ If you want to know more about libp2p DHT, you should read the following content
183183
184184
Some available pubsub routers are:
185185

186-
- [libp2p/js-libp2p-floodsub](https://github.com/libp2p/js-libp2p-floodsub)
187-
- [ChainSafe/js-libp2p-gossipsub](https://github.com/ChainSafe/js-libp2p-gossipsub)
186+
- [@chainsafe/libp2p-gossipsub](https://github.com/ChainSafe/js-libp2p-gossipsub)
187+
- [@libp2p/floodsub](https://github.com/libp2p/js-libp2p-floodsub) (Not for production use)
188188

189-
If none of the available pubsub routers fulfills your needs, you can create a libp2p compatible one. A libp2p pubsub router just needs to be created on top of [libp2p/js-libp2p-pubsub](https://github.com/libp2p/js-libp2p-pubsub), which ensures `js-libp2p` API expectations.
189+
If none of the available pubsub routers fulfills your needs, you can create a libp2p compatible one. A libp2p pubsub router just needs to be created on top of [@libp2p/pubsub](https://github.com/libp2p/js-libp2p-pubsub), which ensures `js-libp2p` API expectations.
190190

191191
If you want to know more about libp2p pubsub, you should read the following content:
192192

@@ -380,7 +380,6 @@ import { create as ipfsHttpClient } from 'ipfs-http-client'
380380
import { DelegatedPeerRouting } from '@libp2p/delegated-peer-routing'
381381
import { DelegatedContentRouting} from '@libp2p/delegated-content-routing'
382382

383-
384383
// create a peerId
385384
const peerId = await PeerId.create()
386385

@@ -909,3 +908,7 @@ As libp2p is designed to be a modular networking library, its usage will vary ba
909908
If you have developed a project using `js-libp2p`, please consider submitting your configuration to this list so that it can be found easily by other users.
910909
911910
The [examples](../examples) are also a good source of help for finding a configuration that suits your needs.
911+
912+
## Limits
913+
914+
Configuring the various limits of your node is important to protect it when it is part of hostile of adversarial networks. See [LIMITS.md](./LIMITS.md) for a full breakdown of the various built in protections and safeguards.

0 commit comments

Comments
 (0)