Skip to content

Commit 4bd36ef

Browse files
authored
Merge branch 'libp2p:main' into feat/track-protocol-stream-open-close-counters
2 parents ca003f0 + b2f2db1 commit 4bd36ef

File tree

175 files changed

+7825
-1026
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+7825
-1026
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ jobs:
4040
- run: npm run --if-present lint
4141
- run: npm run --if-present dep-check
4242
- run: npm run --if-present docs:no-publish
43+
- run: git diff --exit-code
4344
- run: npm run --if-present doc-check
4445
- run: npm run --if-present spell-check
4546

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ yarn.lock
1010
interop/*-image.json
1111
.tmp-compiled-docs
1212
tsconfig-doc-check.aegir.json
13+
.lycheecache

.release-please-manifest.json

Lines changed: 49 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,51 @@
11
{
2-
"packages/config": "1.1.25",
3-
"packages/connection-encrypter-plaintext": "3.0.13",
4-
"packages/connection-encrypter-tls": "3.0.13",
5-
"packages/crypto": "5.1.13",
6-
"packages/floodsub": "11.0.14",
7-
"packages/gossipsub": "15.0.15",
8-
"packages/interface": "3.1.0",
9-
"packages/interface-compliance-tests": "7.0.14",
10-
"packages/interface-internal": "3.0.13",
11-
"packages/interop": "14.0.15",
12-
"packages/kad-dht": "16.1.6",
13-
"packages/keychain": "6.0.10",
14-
"packages/libp2p": "3.1.6",
15-
"packages/libp2p-daemon": "6.0.15",
16-
"packages/libp2p-daemon-client": "10.0.15",
17-
"packages/libp2p-daemon-protocol": "8.0.3",
18-
"packages/libp2p-daemon-server": "9.0.15",
19-
"packages/logger": "6.2.2",
20-
"packages/metrics-opentelemetry": "2.0.14",
21-
"packages/metrics-prometheus": "5.0.14",
22-
"packages/metrics-simple": "2.0.10",
23-
"packages/multistream-select": "7.0.13",
24-
"packages/peer-collections": "7.0.13",
25-
"packages/peer-discovery-bootstrap": "12.0.14",
26-
"packages/peer-discovery-mdns": "12.0.14",
27-
"packages/peer-id": "6.0.4",
28-
"packages/peer-record": "9.0.5",
29-
"packages/peer-store": "12.0.13",
30-
"packages/pnet": "3.0.14",
31-
"packages/protocol-autonat": "3.0.13",
32-
"packages/protocol-autonat-v2": "2.0.13",
33-
"packages/protocol-dcutr": "3.0.13",
34-
"packages/protocol-echo": "3.0.14",
35-
"packages/protocol-fetch": "4.0.13",
36-
"packages/protocol-identify": "4.0.13",
37-
"packages/protocol-perf": "5.0.14",
38-
"packages/protocol-ping": "3.0.13",
39-
"packages/record": "4.0.9",
40-
"packages/stream-multiplexer-mplex": "12.0.14",
41-
"packages/transport-circuit-relay-v2": "4.1.6",
42-
"packages/transport-memory": "2.0.13",
43-
"packages/transport-tcp": "11.0.13",
44-
"packages/transport-webrtc": "6.0.14",
45-
"packages/transport-websockets": "10.1.6",
46-
"packages/transport-webtransport": "6.0.15",
47-
"packages/upnp-nat": "4.0.13",
48-
"packages/utils": "7.0.13",
49-
"packages/integration-tests": "1.1.6",
50-
"interop": "1.0.15"
2+
"packages/config": "1.1.26",
3+
"packages/connection-encrypter-plaintext": "3.0.14",
4+
"packages/connection-encrypter-tls": "3.0.14",
5+
"packages/crypto": "5.1.14",
6+
"packages/floodsub": "11.0.15",
7+
"packages/gossipsub": "15.0.16",
8+
"packages/interface": "3.1.1",
9+
"packages/interface-compliance-tests": "7.0.15",
10+
"packages/interface-internal": "3.0.14",
11+
"packages/interop": "14.0.16",
12+
"packages/kad-dht": "16.1.7",
13+
"packages/keychain": "6.0.11",
14+
"packages/libp2p": "3.1.7",
15+
"packages/libp2p-daemon": "6.0.16",
16+
"packages/libp2p-daemon-client": "10.0.16",
17+
"packages/libp2p-daemon-protocol": "8.0.4",
18+
"packages/libp2p-daemon-server": "9.0.16",
19+
"packages/logger": "6.2.3",
20+
"packages/metrics-opentelemetry": "2.0.15",
21+
"packages/metrics-prometheus": "5.0.15",
22+
"packages/metrics-simple": "2.0.11",
23+
"packages/multistream-select": "7.0.14",
24+
"packages/peer-collections": "7.0.14",
25+
"packages/peer-discovery-bootstrap": "12.0.15",
26+
"packages/peer-discovery-mdns": "12.0.15",
27+
"packages/peer-id": "6.0.5",
28+
"packages/peer-record": "9.0.6",
29+
"packages/peer-store": "12.0.14",
30+
"packages/pnet": "3.0.15",
31+
"packages/protocol-autonat": "3.0.14",
32+
"packages/protocol-autonat-v2": "2.0.14",
33+
"packages/protocol-dcutr": "3.0.14",
34+
"packages/protocol-echo": "3.0.15",
35+
"packages/protocol-fetch": "4.0.14",
36+
"packages/protocol-identify": "4.0.14",
37+
"packages/protocol-perf": "5.0.15",
38+
"packages/protocol-ping": "3.0.14",
39+
"packages/record": "4.0.10",
40+
"packages/stream-multiplexer-mplex": "12.0.15",
41+
"packages/transport-circuit-relay-v2": "4.1.7",
42+
"packages/transport-memory": "2.0.14",
43+
"packages/transport-tcp": "11.0.14",
44+
"packages/transport-webrtc": "6.0.15",
45+
"packages/transport-websockets": "10.1.7",
46+
"packages/transport-webtransport": "6.0.16",
47+
"packages/upnp-nat": "4.0.14",
48+
"packages/utils": "7.0.14",
49+
"packages/integration-tests": "1.1.7",
50+
"interop": "1.0.16"
5151
}

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ We are in the process of writing better documentation, blog posts, tutorials and
3636
- [docs.libp2p.io](https://docs.libp2p.io)
3737
- [Specification (WIP)](https://github.com/libp2p/specs)
3838
- [Discussion Forums](https://discuss.libp2p.io)
39+
- [ProtoSchool: Introduction to libp2p](https://proto.school/introduction-to-libp2p)
40+
- [libp2p Connectivity Matrix](https://connectivity.libp2p.io/)
41+
- [Universal Connectivity Demo](https://github.com/libp2p/universal-connectivity)
3942
- Talks
4043
- [`libp2p <3 ethereum` at DEVCON2](https://archive.devcon.org/archive/watch/2/libp2p-devp2p-ipfs-and-ethereum-networking/)
4144
- Articles
@@ -184,8 +187,7 @@ List of packages currently in existence for libp2p
184187
<a href="https://hoprnet.org/"><img width="150" src="https://github.com/hoprnet/hopr-assets/blob/master/v1/logo/hopr_logo_padded.png?raw=true" alt="HOPR Logo" /></a>
185188
<a href="https://helia.io/"><img src="https://raw.githubusercontent.com/ipfs/helia/main/assets/helia.png" alt="Helia (IPFS in JavaScript) logo" width="150" /></a>
186189
<a href="https://github.com/orbitdb/orbitdb"><img src="https://avatars.githubusercontent.com/u/25079463?s=200&v=4" alt="OrbitDB logo" width="150" /></a>
187-
<a href="https://peerbit.org/"><img src="https://peerbit.org/peerbit-logo.png" alt="Peerbit logo" width="150" /></a>
188-
<a href="https://blog.topology.gg/"><img src="https://avatars.githubusercontent.com/u/157637200" alt="Topology logo" width="150" /></a>
190+
<a href="https://peerbit.org/"><img src="https://www.peerbit.org/content/docs/peerbit-logo.png" alt="Peerbit logo" width="150" /></a>
189191
</p>
190192
</div>
191193

doc/CONFIGURATION.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ Some available transports are:
7676
- [@libp2p/websockets](https://github.com/libp2p/js-libp2p/tree/main/packages/transport-websockets)
7777
- [@libp2p/webtransport](https://github.com/libp2p/js-libp2p/tree/main/packages/transport-webtransport)
7878

79-
If none of the available transports fulfils 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-libp2p/tree/main/packages/interface/src/transport).
79+
If none of the available transports fulfils 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-libp2p/blob/main/packages/interface/src/transport.ts).
8080

8181
If you want to know more about libp2p transports, you should read the following content:
8282

83-
- https://docs.libp2p.io/concepts/transports/overview
83+
- https://libp2p.io/docs/transports-overview/
8484
- https://github.com/libp2p/specs/tree/master/connections
8585

8686
### Stream Multiplexing
@@ -93,7 +93,7 @@ Some available stream multiplexers are:
9393

9494
Some transports such as WebRTC and WebTransport come with their own built-in stream multiplexing capabilities.
9595

96-
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-libp2p/tree/main/packages/interface/src/stream-muxer).
96+
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-libp2p/blob/main/packages/interface/src/stream-muxer.ts).
9797

9898
If you want to know more about libp2p stream multiplexing, you should read the following content:
9999

@@ -112,13 +112,13 @@ If you configure multiple muxers for use in your application, js-libp2p will cho
112112
Some available connection encryption protocols:
113113

114114
- [@chainsafe/libp2p-noise](https://github.com/chainsafe/js-libp2p-noise)
115-
- [@libp2p/plaintext](https://github.com/libp2p/js-libp2p/blob/main/src/packages/connection-encrypter-plaintext/index.ts) (Not for production use)
115+
- [@libp2p/plaintext](https://github.com/libp2p/js-libp2p/blob/main/packages/connection-encrypter-plaintext/src/index.ts) (Not for production use)
116116

117-
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 [Connection Encrypter Interface](https://github.com/libp2p/js-libp2p/tree/main/packages/interface/src/connection-encrypter).
117+
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 [Connection Encrypter Interface](https://github.com/libp2p/js-libp2p/blob/main/packages/interface/src/connection-encrypter.ts).
118118

119119
If you want to know more about libp2p connection encryption, you should read the following content:
120120

121-
- https://docs.libp2p.io/concepts/secure-comms
121+
- https://libp2p.io/docs/secure-channels-overview/
122122
- https://github.com/libp2p/specs/tree/master/connections
123123

124124
### Peer Discovery
@@ -132,7 +132,7 @@ Some available peer discovery modules are:
132132
- [@libp2p/bootstrap](https://github.com/libp2p/js-libp2p/tree/main/packages/peer-discovery-bootstrap) (typically used together with @libp2p/kad-dht)
133133
- [@chainsafe/discv5](https://github.com/chainsafe/discv5) ([spec](https://github.com/ethereum/devp2p/blob/master/discv5/discv5.md))
134134

135-
If none of the available peer discovery protocols fulfills your needs, you can create a libp2p compatible one. A libp2p peer discovery protocol just needs to be compliant with the [Peer Discovery Interface](https://github.com/libp2p/js-libp2p/tree/main/packages/interface/src/peer-discovery).
135+
If none of the available peer discovery protocols fulfills your needs, you can create a libp2p compatible one. A libp2p peer discovery protocol just needs to be compliant with the [Peer Discovery Interface](https://github.com/libp2p/js-libp2p/blob/main/packages/interface/src/peer-discovery.ts).
136136

137137
### Content Routing
138138

@@ -148,7 +148,7 @@ Some available content routing modules are:
148148
> The `@helia/delegated-routing-v1-http-api-client` module is a client for the [IPFS Delegated Routing V1 HTTP API](https://specs.ipfs.tech/routing/http-routing-v1/). It is not a libp2p module, but it can be used in conjunction with libp2p to provide content and peer routing functionality.
149149
> For most purposes, `@helia/delegated-routing-v1-http-api-client` should be favoured over `@libp2p/delegated-content-routing` for delegated routing, as it is more broadly adopted by the ecosystem and doesn't rely on Kubo specific APIs.
150150
151-
If none of the available content routing protocols fulfil 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-libp2p/blob/main/packages/interface/src/content-routing/index.ts).
151+
If none of the available content routing protocols fulfil 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-libp2p/blob/main/packages/interface/src/content-routing.ts).
152152

153153

154154
### Peer Routing
@@ -160,7 +160,7 @@ Some available peer routing modules are:
160160
- [@libp2p/kad-dht](https://github.com/libp2p/js-libp2p/tree/main/packages/kad-dht)
161161
- [@helia/delegated-routing-v1-http-api-client](https://github.com/ipfs/helia-delegated-routing-v1-http-api)
162162
- [@libp2p/delegated-peer-routing](https://github.com/libp2p/js-libp2p-delegated-peer-routing)
163-
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-libp2p/blob/main/packages/interface/src/peer-routing/index.ts).
163+
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-libp2p/blob/main/packages/interface/src/peer-routing.ts).
164164

165165
> [!NOTE]
166166
> The `@helia/delegated-routing-v1-http-api-client` module is a client for the [IPFS Delegated Routing V1 HTTP API](https://specs.ipfs.tech/routing/http-routing-v1/). It is not a libp2p module, but it can be used in conjunction with libp2p to provide content and peer routing functionality.
@@ -319,7 +319,7 @@ This means that pubsub requires the identify service to be configured in order t
319319
Potential methods for discovering peers include:
320320

321321
- [Distributed hash tables](#dht)
322-
- [Local network broadcasts](https://docs.libp2p.io/concepts/discovery-routing/mdns/)
322+
- [Local network broadcasts](https://libp2p.io/docs/mdns/)
323323
- [Centralized trackers or rendezvous points](https://docs.libp2p.io/concepts/discovery-routing/rendezvous/)
324324
- [Lists of bootstrap peers](https://github.com/ipfs/helia/blob/main/packages/helia/src/utils/bootstrappers.ts)
325325

@@ -579,7 +579,7 @@ const node = await createLibp2p({
579579

580580
The Connection Manager manages connections to peers in libp2p. It controls opening closing connections but also pruning connections when certain limits are exceeded. If Metrics are enabled, you can also configure the Connection Manager to monitor the bandwidth of libp2p and prune connections as needed. You can read more about what Connection Manager does at [./CONNECTION_MANAGER.md](https://libp2p.github.io/js-libp2p-interfaces/modules/_libp2p_interface_connection_manager.html). The configuration values below show the defaults for Connection Manager.
581581

582-
See the [API docs](https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html) for a full run list and discussion of all Connection Manager options.
582+
See the [API docs](https://libp2p.github.io/js-libp2p/modules/_libp2p_interface-internal.html) for a full run list and discussion of all Connection Manager options.
583583

584584

585585
```js

doc/GETTING_STARTED.md

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Welcome to libp2p! This guide will walk you through setting up a fully functiona
1818
- [Browser](#browser)
1919
- [React Native](#react-native)
2020
- [What is next](#what-is-next)
21+
- [Additional Resources](#additional-resources)
2122

2223
## Install
2324

@@ -54,7 +55,7 @@ For more info on enabling ES modules in Node, see [this guide](https://nodejs.or
5455

5556
### Basic setup
5657

57-
Now that we have libp2p installed, let's configure the minimum needed to get your node running. The only modules libp2p requires are a [**Transport**][transport] and [**Crypto**][crypto] module. However, we recommend that a basic setup should also have a [**Stream Multiplexer**](streamMuxer) configured, which we will explain shortly. Let's start by setting up a Transport.
58+
Now that we have libp2p installed, let's configure the minimum needed to get your node running. The only modules libp2p requires are a [**Transport**][transport] and [**Crypto**][crypto] module. However, we recommend that a basic setup should also have a [**Stream Multiplexer**][streamMuxer] configured, which we will explain shortly. Let's start by setting up a Transport.
5859

5960
#### Transports
6061

@@ -114,7 +115,7 @@ const node = await createLibp2p({
114115
<details><summary>Read More</summary>
115116
If you want to know more about libp2p connection encryption, you should read the following content:
116117

117-
- https://docs.libp2p.io/concepts/secure-comms
118+
- https://libp2p.io/docs/secure-channels-overview/
118119
- https://github.com/libp2p/specs/tree/master/connections
119120
</details>
120121

@@ -153,7 +154,7 @@ If you want to know more about libp2p stream multiplexing, you should read the f
153154

154155
#### Running Libp2p
155156

156-
Now that you have configured a [**Transport**][transport], [**Crypto**][crypto] and [**Stream Multiplexer**](streamMuxer) module, you can start your libp2p node. We can start and stop libp2p using the [`libp2p.start()`](https://github.com/libp2p/js-libp2p/blob/main/doc/API.md#start) and [`libp2p.stop()`](https://github.com/libp2p/js-libp2p/blob/main/doc/API.md#stop) methods.
157+
Now that you have configured a [**Transport**][transport], [**Crypto**][crypto] and [**Stream Multiplexer**][streamMuxer] module, you can start your libp2p node. We can start and stop libp2p using the [`libp2p.start()`](https://github.com/libp2p/js-libp2p/blob/main/doc/API.md#start) and [`libp2p.stop()`](https://github.com/libp2p/js-libp2p/blob/main/doc/API.md#stop) methods.
157158

158159
```ts
159160
import { createLibp2p } from 'libp2p'
@@ -329,7 +330,13 @@ Libp2p can be used in React Native applications. However, there are some limitat
329330

330331
There are a lot of other concepts within `libp2p`, that are not covered in this guide. For additional configuration options we recommend checking out the [Configuration Readme](https://github.com/libp2p/js-libp2p/blob/main/doc/CONFIGURATION.md) and the [examples repo](https://github.com/libp2p/js-libp2p-examples). If you have any problems getting started, or if anything isn't clear, please let us know by submitting an issue!
331332

333+
### Additional Resources
332334

333-
[transport]: https://github.com/libp2p/js-libp2p/tree/main/packages/interface/src/transport
334-
[crypto]: https://github.com/libp2p/js-libp2p/tree/main/packages/interface/src/crypto
335-
[streamMuxer]: https://github.com/libp2p/js-libp2p/tree/main/packages/interface/src/stream-muxer
335+
- [ProtoSchool: Introduction to libp2p](https://proto.school/introduction-to-libp2p) — Interactive tutorial covering libp2p fundamentals
336+
- [libp2p Concepts](https://docs.libp2p.io/concepts/introduction/overview/) — Overview of core concepts and architecture
337+
- [libp2p Connectivity](https://connectivity.libp2p.io/) — Interoperability matrix across libp2p implementations
338+
- [Universal Connectivity](https://github.com/libp2p/universal-connectivity) — Demo application showcasing cross-implementation connectivity
339+
340+
[transport]: https://github.com/libp2p/js-libp2p/blob/main/packages/interface/src/transport.ts
341+
[crypto]: https://github.com/libp2p/js-libp2p/blob/main/packages/interface/src/keys.ts
342+
[streamMuxer]: https://github.com/libp2p/js-libp2p/blob/main/packages/interface/src/stream-muxer.ts

doc/METRICS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Although designed to primarily integrate with tools such as [Prometheus](https:/
2626

2727
### Enable metrics
2828

29-
First enable metrics tracking by supplying a [Metrics](https://github.com/libp2p/js-libp2p/blob/main/packages/interface/src/metrics/index.ts#L150) implementation:
29+
First enable metrics tracking by supplying a [Metrics](https://github.com/libp2p/js-libp2p/blob/main/packages/interface/src/metrics.ts) implementation:
3030

3131
```TypeScript
3232
import { createLibp2p } from 'libp2p'
@@ -182,7 +182,7 @@ stopTimer()
182182

183183
## Extracting metrics
184184

185-
Metrics implementations will allow extracting the values for presentation in an external system. For example here is how to use the metrics implementation from `@libp2p/prometheus-metrics` to enable scraping stats to display in [Prometheus](https://prometheus.io/) or a [Graphana](https://grafana.com/) dashboard. For more information, you can view our [Prometheus Metrics Docs](https://libp2p.github.io/js-libp2p/modules/_libp2p_prometheus_metrics.html)
185+
Metrics implementations will allow extracting the values for presentation in an external system. For example here is how to use the metrics implementation from `@libp2p/prometheus-metrics` to enable scraping stats to display in [Prometheus](https://prometheus.io/) or a [Graphana](https://grafana.com/) dashboard. For more information, you can view our [Prometheus Metrics Docs](https://libp2p.github.io/js-libp2p/modules/_libp2p_prometheus-metrics.html)
186186

187187

188188
```TypeScript

0 commit comments

Comments
 (0)