Skip to content

Commit

Permalink
docs: remove mplex from docs
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Sep 11, 2024
1 parent 3b43a37 commit b6681bd
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 101 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ List of packages currently in existence for libp2p
| [`@chainsafe/libp2p-noise`](//github.com/ChainSafe/js-libp2p-noise) | [![npm](https://img.shields.io/npm/v/%40chainsafe%2Flibp2p-noise.svg?maxAge=86400&style=flat-square)](//github.com/ChainSafe/js-libp2p-noise/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40chainsafe%2Flibp2p-noise?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40chainsafe%2Flibp2p-noise) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/ChainSafe/js-libp2p-noise/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/ChainSafe/js-libp2p-noise/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/ChainSafe/js-libp2p-noise/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/ChainSafe/js-libp2p-noise) |
| [`@libp2p/plaintext`](//github.com/libp2p/js-libp2p/tree/main/packages/connection-encrypter-plaintext) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fplaintext.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p/tree/main/packages/connection-encrypter-plaintext/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fplaintext?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fplaintext) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/tree/main/packages/connection-encrypter-plaintext/main.yml?branch=main&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p/tree/main/packages/connection-encrypter-plaintext/actions?query=branch%3Amain+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p/tree/main/packages/connection-encrypter-plaintext/branch/main/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p/tree/main/packages/connection-encrypter-plaintext) |
| **stream multiplexers** |
| [`@libp2p/mplex`](//github.com/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fmplex.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fmplex?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fmplex) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex/main.yml?branch=main&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex/actions?query=branch%3Amain+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex/branch/main/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex) |
| [`@chainsafe/libp2p-yamux`](//github.com/ChainSafe/js-libp2p-yamux) | [![npm](https://img.shields.io/npm/v/%40chainsafe%2Flibp2p-yamux.svg?maxAge=86400&style=flat-square)](//github.com/ChainSafe/js-libp2p-yamux/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40chainsafe%2Flibp2p-yamux?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40chainsafe%2Flibp2p-yamux) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/ChainSafe/js-libp2p-yamux/js-test-and-release.yml?branch=master&label=ci&style=flat-square)](//github.com/ChainSafe/js-libp2p-yamux/actions?query=branch%3Amaster+workflow%3Aci+) | [![codecov](https://codecov.io/gh/ChainSafe/js-libp2p-yamux/branch/master/graph/badge.svg?style=flat-square)](https://codecov.io/gh/ChainSafe/js-libp2p-yamux) |
| **peer discovery** |
| [`@libp2p/bootstrap`](//github.com/libp2p/js-libp2p/tree/main/packages/peer-discovery-bootstrap) | [![npm](https://img.shields.io/npm/v/%40libp2p%2Fbootstrap.svg?maxAge=86400&style=flat-square)](//github.com/libp2p/js-libp2p/tree/main/packages/peer-discovery-bootstrap/releases) | [![Deps](https://img.shields.io/librariesio/release/npm/%40libp2p%2Fbootstrap?logo=Libraries.io&logoColor=white&style=flat-square)](//libraries.io/npm/%40libp2p%2Fbootstrap) | [![GitHub CI](https://img.shields.io/github/actions/workflow/status/libp2p/js-libp2p/tree/main/packages/peer-discovery-bootstrap/main.yml?branch=main&label=ci&style=flat-square)](//github.com/libp2p/js-libp2p/tree/main/packages/peer-discovery-bootstrap/actions?query=branch%3Amain+workflow%3Aci+) | [![codecov](https://codecov.io/gh/libp2p/js-libp2p/tree/main/packages/peer-discovery-bootstrap/branch/main/graph/badge.svg?style=flat-square)](https://codecov.io/gh/libp2p/js-libp2p/tree/main/packages/peer-discovery-bootstrap) |
Expand Down
9 changes: 4 additions & 5 deletions doc/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
js-libp2p is comprised of a number of components that work together to provide functionality such as dailling peers, managing connections, registering protocols, storing information about peers and much more. This document aims to provide a high level overview of the components and how they interact with each other.

- [Libp2p Architecture](#libp2p-architecture)
- [Component Diagram](#component-diagram)
- [Sequence Diagrams](#sequence-diagrams)
- [Dialing a Peer](#dialing-a-peer)
- [Opening a stream on a connection](#opening-a-stream-on-a-connection)
- [Component Diagram](#component-diagram)
- [Sequence Diagrams](#sequence-diagrams)
- [Dialing a Peer](#dialing-a-peer)
- [Opening a stream on a connection](#opening-a-stream-on-a-connection)

## Component Diagram

Expand Down Expand Up @@ -57,7 +57,6 @@ flowchart TB
subgraph Multiplexer[Stream Multiplexers]
direction TB
Yamux
Mplex
end
Multiplexer ~~~ Encryption ~~~ Transports
Expand Down
55 changes: 15 additions & 40 deletions doc/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ If you want to know more about libp2p transports, you should read the following
Some available stream multiplexers are:

- [@libp2p/mplex](https://github.com/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex)
- [@chainsafe/libp2p-yamux](https://github.com/chainsafe/js-libp2p-yamux)

Some transports such as WebRTC and WebTransport come with their own built-in stream multiplexing capabilities.
Expand All @@ -100,7 +99,7 @@ If you want to know more about libp2p stream multiplexing, you should read the f

- https://docs.libp2p.io/concepts/stream-multiplexing
- https://github.com/libp2p/specs/tree/master/connections
- https://github.com/libp2p/specs/tree/master/mplex
- https://github.com/libp2p/specs/tree/master/yamux

#### Muxer Selection

Expand Down Expand Up @@ -239,7 +238,7 @@ It's important to note that some services depend on others in order to function
// Creating a libp2p node with:
// listen on tcp ports 9001 and 9002 on all interfaces
// transport: websockets + tcp
// stream-muxing: mplex
// stream-muxing: yamux
// crypto-channel: noise
// discovery: multicast-dns
// dht: kad-dht
Expand All @@ -248,7 +247,6 @@ It's important to note that some services depend on others in order to function
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { webSockets } from '@libp2p/websockets'
import { mplex } from '@libp2p/mplex'
import { noise } from '@chainsafe/libp2p-noise'
import { mdns } from '@libp2p/mdns'
import { kadDHT } from '@libp2p/kad-dht'
Expand All @@ -266,7 +264,7 @@ const node = await createLibp2p({
tcp(),
webSockets()
],
streamMuxers: [yamux(), mplex()],
streamMuxers: [yamux()],
connectionEncrypters: [noise()],
peerDiscovery: [MulticastDNS],
services: {
Expand All @@ -281,15 +279,14 @@ const node = await createLibp2p({
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { mdns } from '@libp2p/mdns'
import { bootstrap } from '@libp2p/bootstrap'

const node = await createLibp2p({
transports: [tcp()],
streamMuxers: [yamux(), mplex()],
streamMuxers: [yamux()],
connectionEncrypters: [noise()],
peerDiscovery: [
mdns({
Expand Down Expand Up @@ -321,7 +318,6 @@ Potential methods for discovering peers include:
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { gossipsub } from 'libp2p-gossipsub'
Expand All @@ -333,8 +329,7 @@ const node = await createLibp2p({
tcp()
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand All @@ -360,7 +355,6 @@ The kadDHT service requires the Identify service to discover other peers that su
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { noise } from '@chainsafe/libp2p-noise'
import { kadDHT } from '@libp2p/kad-dht'
import { identify } from '@libp2p/identify'
Expand All @@ -370,8 +364,7 @@ const node = await createLibp2p({
tcp()
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand All @@ -391,7 +384,6 @@ const node = await createLibp2p({
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { create as ipfsHttpClient } from 'ipfs-http-client'
Expand All @@ -418,8 +410,7 @@ const node = await createLibp2p({
tcp()
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand Down Expand Up @@ -447,7 +438,6 @@ Thus, it is recommended to include the Identify service in your services configu
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { circuitRelayTransport, circuitRelayServer } from '@libp2p/circuit-relay-v2'
Expand All @@ -463,8 +453,7 @@ const node = await createLibp2p({
})
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand Down Expand Up @@ -505,7 +494,6 @@ In this configuration the libp2p node will search the network for one relay with
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'
Expand All @@ -518,8 +506,7 @@ const node = await createLibp2p({
})
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand All @@ -534,7 +521,6 @@ In this configuration the libp2p node is a circuit relay client which connects t
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { noise } from '@chainsafe/libp2p-noise'
import { circuitRelayTransport } from '@libp2p/circuit-relay-v2'

Expand All @@ -549,8 +535,7 @@ const node = await createLibp2p({
]
},
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand All @@ -572,7 +557,6 @@ The keychain will store keys encrypted in the datastore which default is an in m
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { FsDatastore } from 'datastore-fs';
Expand All @@ -586,8 +570,7 @@ const node = await createLibp2p({
tcp()
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand All @@ -610,7 +593,6 @@ See the [API docs](https://libp2p.github.io/js-libp2p/interfaces/index._internal
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'

Expand All @@ -619,8 +601,7 @@ const node = await createLibp2p({
tcp()
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand Down Expand Up @@ -759,7 +740,6 @@ The Transport Manager is responsible for managing the libp2p transports life cyc
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { FaultTolerance } from '@libp2p/interface-transport'
Expand All @@ -769,8 +749,7 @@ const node = await createLibp2p({
tcp()
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand Down Expand Up @@ -798,7 +777,6 @@ The below configuration example shows how the metrics should be configured. Asid
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'

Expand All @@ -807,8 +785,7 @@ const node = await createLibp2p({
tcp()
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand Down Expand Up @@ -843,7 +820,6 @@ The below configuration example shows how the PeerStore should be configured. As
```js
import { createLibp2p } from 'libp2p'
import { tcp } from '@libp2p/tcp'
import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { LevelDatastore } from 'datastore-level'
Expand All @@ -857,8 +833,7 @@ const node = await createLibp2p({
tcp()
],
streamMuxers: [
yamux(),
mplex()
yamux()
],
connectionEncrypters: [
noise()
Expand Down
2 changes: 1 addition & 1 deletion doc/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ If you want to know more about libp2p stream multiplexing, you should read the f

- https://docs.libp2p.io/concepts/stream-multiplexing
- https://github.com/libp2p/specs/tree/master/connections
- https://github.com/libp2p/specs/tree/master/mplex
- https://github.com/libp2p/specs/tree/master/yamux
</details>

#### Running Libp2p
Expand Down
45 changes: 0 additions & 45 deletions doc/LIMITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ This is important for [DoS](https://en.wikipedia.org/wiki/Denial-of-service_atta
- [Closing connections](#closing-connections)
- [Inbound connection threshold](#inbound-connection-threshold)
- [Stream limits](#stream-limits)
- [Mplex](#mplex)
- [Yamux](#yamux)
- [Protocol limits](#protocol-limits)
- [Transport specific limits](#transport-specific-limits)
Expand Down Expand Up @@ -101,50 +100,6 @@ libp2p stream multiplexers impose limits on the amount of streams that can be op

These settings are done on a per-muxer basis, please see the README of the relevant muxer you are using.

### Mplex

[@libp2p/mplex](https://github.com/libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex) supports the following.

All fields are optional. The default values are defined in [@libp2p/mplex/src/mplex.ts](https://github.com/libp2p/js-libp2p/blob/main/packages/stream-multiplexer-mplex/src/mplex.ts) - please see that file for the current values.

```TypeScript
import { createLibp2p } from 'libp2p'
import { mplex } from '@libp2p/mplex'

const node = await createLibp2p({
streamMuxers: [
mplex({
/**
* The total number of inbound protocol streams that can be opened on a given connection
*/
maxInboundStreams: 100,

/**
* The total number of outbound protocol streams that can be opened on a given connection
*/
maxOutboundStreams: 100,

/**
* How much incoming data in bytes to buffer while attempting to parse messages - peers sending many small messages in batches may cause this buffer to grow
*/
maxUnprocessedMessageQueueSize: 50,

/**
* How much message data in bytes to buffer after parsing - slow stream consumers may cause this buffer to grow
*/
maxStreamBufferSize: 20,

/**
* Mplex does not support backpressure so to protect ourselves, if `maxInboundStreams` is
* hit and the remote opens more than this many streams per second, close the connection
*/
disconnectThreshold: 20,
}),
],
});

```

### Yamux

[@chainsafe/libp2p-yamux](https://github.com/Chainsafe/js-libp2p-yamux) supports the following.
Expand Down
2 changes: 1 addition & 1 deletion interop/chromium-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
}
],
"secureChannels": ["noise"],
"muxers": ["mplex", "yamux"]
"muxers": ["yamux", "mplex"]
}
4 changes: 2 additions & 2 deletions interop/webkit-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"noise"
],
"muxers": [
"mplex",
"yamux"
"yamux",
"mplex"
]
}
1 change: 0 additions & 1 deletion packages/libp2p/package-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
["libp2p/js-libp2p/tree/main/packages/connection-encrypter-plaintext", "@libp2p/plaintext", "main", "main.yml"],

"stream multiplexers",
["libp2p/js-libp2p/tree/main/packages/stream-multiplexer-mplex", "@libp2p/mplex", "main", "main.yml"],
["ChainSafe/js-libp2p-yamux", "@chainsafe/libp2p-yamux", "master", "js-test-and-release.yml"],

"peer discovery",
Expand Down
3 changes: 1 addition & 2 deletions packages/protocol-perf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ The PerfService implements the [perf protocol](https://github.com/libp2p/specs/b
```typescript
import { noise } from '@chainsafe/libp2p-noise'
import { yamux } from '@chainsafe/libp2p-yamux'
import { mplex } from '@libp2p/mplex'
import { tcp } from '@libp2p/tcp'
import { createLibp2p, type Libp2p } from 'libp2p'
import { plaintext } from '@libp2p/plaintext'
Expand All @@ -55,7 +54,7 @@ async function createNode (): Promise<Libp2p<{ perf: Perf }>> {
noise(), plaintext()
],
streamMuxers: [
yamux(), mplex()
yamux()
],
services: {
perf: perf()
Expand Down
Loading

0 comments on commit b6681bd

Please sign in to comment.