Skip to content

Commit 5775f1d

Browse files
authored
fix: restore lost commits (#2268)
Restores changes made to the repo after release but before yesterday's release-please-action chaos.
1 parent d539109 commit 5775f1d

File tree

328 files changed

+775
-1619
lines changed

Some content is hidden

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

328 files changed

+775
-1619
lines changed

.github/workflows/examples.yml

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,38 @@ jobs:
1919
node-version: lts/*
2020
- uses: ipfs/aegir/actions/cache-node-modules@master
2121

22-
test-examples:
23-
name: Test example ${{ matrix.example.name }}
24-
runs-on: ubuntu-latest
25-
needs: build
26-
continue-on-error: true
27-
strategy:
28-
matrix:
29-
example:
30-
- name: js-libp2p-example-chat
31-
repo: https://github.com/libp2p/js-libp2p-example-chat.git
32-
deps:
33-
- '@libp2p/peer-id-factory@$PWD/packages/peer-id-factory'
34-
- '@libp2p/tcp@$PWD/packages/transport-tcp'
35-
- '@libp2p/websockets@$PWD/packages/transport-websockets'
36-
- 'libp2p@$PWD/packages/libp2p'
37-
# disabled until @libp2p/identify and @libp2p/circuit-relay are published
38-
# - name: js-libp2p-example-circuit-relay
39-
# repo: https://github.com/libp2p/js-libp2p-example-circuit-relay.git
40-
# deps:
41-
# - '@libp2p/circuit-relay@$PWD/packages/transport-circuit-relay'
42-
# - '@libp2p/identify@$PWD/packages/protocol-identify'
43-
# - '@libp2p/websockets@$PWD/packages/transport-websockets'
44-
# - 'libp2p@$PWD/packages/libp2p'
45-
- name: js-libp2p-example-connection-encryption
46-
repo: https://github.com/libp2p/js-libp2p-example-connection-encryption.git
47-
deps:
48-
- '@libp2p/tcp@$PWD/packages/transport-tcp'
49-
- 'libp2p@$PWD/packages/libp2p'
50-
steps:
51-
- uses: actions/checkout@v3
52-
- uses: actions/setup-node@v3
53-
with:
54-
node-version: lts/*
55-
- uses: ipfs/aegir/actions/cache-node-modules@master
56-
- run: npx xvfb-maybe aegir test-dependant ${{ matrix.example.repo }} --deps ${{ join(matrix.example.deps, ',') }}
22+
# test-examples:
23+
# name: Test example ${{ matrix.example.name }}
24+
# runs-on: ubuntu-latest
25+
# needs: build
26+
# continue-on-error: true
27+
# strategy:
28+
# matrix:
29+
# example:
30+
# - name: js-libp2p-example-chat
31+
# repo: https://github.com/libp2p/js-libp2p-example-chat.git
32+
# deps:
33+
# - '@libp2p/peer-id-factory@$PWD/packages/peer-id-factory'
34+
# - '@libp2p/tcp@$PWD/packages/transport-tcp'
35+
# - '@libp2p/websockets@$PWD/packages/transport-websockets'
36+
# - 'libp2p@$PWD/packages/libp2p'
37+
# # disabled until @libp2p/identify and @libp2p/circuit-relay are published
38+
# # - name: js-libp2p-example-circuit-relay
39+
# # repo: https://github.com/libp2p/js-libp2p-example-circuit-relay.git
40+
# # deps:
41+
# # - '@libp2p/circuit-relay@$PWD/packages/transport-circuit-relay'
42+
# # - '@libp2p/identify@$PWD/packages/protocol-identify'
43+
# # - '@libp2p/websockets@$PWD/packages/transport-websockets'
44+
# # - 'libp2p@$PWD/packages/libp2p'
45+
# - name: js-libp2p-example-connection-encryption
46+
# repo: https://github.com/libp2p/js-libp2p-example-connection-encryption.git
47+
# deps:
48+
# - '@libp2p/tcp@$PWD/packages/transport-tcp'
49+
# - 'libp2p@$PWD/packages/libp2p'
50+
# steps:
51+
# - uses: actions/checkout@v3
52+
# - uses: actions/setup-node@v3
53+
# with:
54+
# node-version: lts/*
55+
# - uses: ipfs/aegir/actions/cache-node-modules@master
56+
# - run: npx xvfb-maybe aegir test-dependant ${{ matrix.example.repo }} --deps ${{ join(matrix.example.deps, ',') }}

doc/CONFIGURATION.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ import { mplex } from '@libp2p/mplex'
318318
import { yamux } from '@chainsafe/libp2p-yamux'
319319
import { noise } from '@chainsafe/libp2p-noise'
320320
import { gossipsub } from 'libp2p-gossipsub'
321-
import { SignaturePolicy } from '@libp2p/interface/pubsub'
321+
import { SignaturePolicy } from '@libp2p/interface'
322322
import { identify } from '@libp2p/identify'
323323

324324
const node = await createLibp2p({

doc/METRICS.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const node = await createLibp2p({
6262
To define component metrics first get a reference to the metrics object:
6363

6464
```ts
65-
import type { Metrics } from '@libp2p/interface/metrics'
65+
import type { Metrics } from '@libp2p/interface'
6666

6767
interface MyClassComponents {
6868
metrics: Metrics
@@ -84,7 +84,7 @@ class MyClass {
8484
A tracked metric can be created by calling either `registerMetric` on the metrics object:
8585

8686
```ts
87-
import type { Metrics } from '@libp2p/interface/metrics'
87+
import type { Metrics } from '@libp2p/interface'
8888
import { prometheusMetrics } from '@libp2p/prometheus-metrics'
8989

9090
const metrics: Metrics = prometheusMetrics()()
@@ -117,7 +117,7 @@ stopTimer()
117117
A metric that is expensive to calculate can be created by passing a `calculate` function that will only be invoked when metrics are being scraped:
118118

119119
```ts
120-
import type { Metrics } from '@libp2p/interface/metrics'
120+
import type { Metrics } from '@libp2p/interface'
121121
import { prometheusMetrics } from '@libp2p/prometheus-metrics'
122122

123123
const metrics: Metrics = prometheusMetrics()()
@@ -132,7 +132,7 @@ metrics.registerMetric('my_metric', {
132132
If several metrics should be grouped together (e.g. for graphing purposes) `registerMetricGroup` can be used instead:
133133

134134
```ts
135-
import type { Metrics } from '@libp2p/interface/metrics'
135+
import type { Metrics } from '@libp2p/interface'
136136
import { prometheusMetrics } from '@libp2p/prometheus-metrics'
137137

138138
const metrics: Metrics = prometheusMetrics()()

doc/migrations/v0.46-v1.0.0.md

Lines changed: 107 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,56 @@ A migration guide for refactoring your application code from libp2p `v0.46` to `
55

66
## Table of Contents <!-- omit in toc -->
77

8-
- [AutoNAT](#autonat)
9-
- [Ping](#ping)
10-
- [Identify](#identify)
11-
- [DCUtR](#dcutr)
12-
- [Fetch](#fetch)
13-
- [KeyChain](#keychain)
14-
- [UPnPNat](#upnpnat)
15-
- [Perf](#perf)
16-
- [Plaintext](#plaintext)
17-
- [Pnet](#pnet)
8+
- [Type imports](#type-imports)
9+
- [Extracted modules](#extracted-modules)
10+
- [Services](#services)
11+
- [AutoNAT](#autonat)
12+
- [Ping](#ping)
13+
- [Identify](#identify)
14+
- [DCUtR](#dcutr)
15+
- [Fetch](#fetch)
16+
- [UPnPNat](#upnpnat)
17+
- [Perf](#perf)
18+
- [Connection encryption](#connection-encryption)
19+
- [Plaintext](#plaintext)
20+
- [Misc](#misc)
21+
- [KeyChain](#keychain)
22+
- [Pnet](#pnet)
1823
- [Metrics](#metrics)
1924
- [Connection Manager](#connection-manager)
2025

21-
## AutoNAT
26+
## Type imports
27+
28+
All exports from `@libp2p/interface` and `@libp2p/interface-internal` are
29+
now exported from the root of the module, no more having to work out which
30+
subpath to import from.
31+
32+
**Before**
33+
34+
```ts
35+
import type { PeerId } from '@libp2p/interface/peer-id'
36+
import type { Connection } from '@libp2p/interface/connection'
37+
import type { Stream } from '@libp2p/interface/stream-muxer'
38+
```
39+
40+
**After**
41+
42+
```ts
43+
import type { Connection, PeerId, Stream } from '@libp2p/interface'
44+
```
45+
46+
## Extracted modules
47+
48+
`js-libp2p` has always had a focus on being a modular, composable ecosystem of
49+
modules. `v1.x.x` takes this further and extracts all of the optional
50+
functionality out of the core and into modules that you can include in your app
51+
if you need them, or omit them if you don't.
52+
53+
### Services
54+
55+
These modules can be configured as services to enable optional functionality.
56+
57+
#### AutoNAT
2258

2359
The AutoNAT service is now published in its own package.
2460

@@ -48,7 +84,7 @@ const node = await createLibp2p({
4884
})
4985
```
5086

51-
## Ping
87+
#### Ping
5288

5389
The Ping service is now published in its own package.
5490

@@ -78,7 +114,7 @@ const node = await createLibp2p({
78114
})
79115
```
80116

81-
## Identify
117+
#### Identify
82118

83119
The Identify service is now published in its own package.
84120

@@ -108,7 +144,7 @@ const node = await createLibp2p({
108144
})
109145
```
110146

111-
## DCUtR
147+
#### DCUtR
112148

113149
The DCUtR service is now published in its own package.
114150

@@ -138,7 +174,7 @@ const node = await createLibp2p({
138174
})
139175
```
140176

141-
## Fetch
177+
#### Fetch
142178

143179
The Fetch service is now published in its own package.
144180

@@ -168,36 +204,8 @@ const node = await createLibp2p({
168204
})
169205
```
170206

171-
## KeyChain
172-
173-
The KeyChain object is no longer included on Libp2p and must be instantiated explicitly if desired.
174-
175-
**Before**
176-
177-
```ts
178-
import type { KeyChain } from '@libp2p/interface/keychain'
179-
180-
const libp2p = await createLibp2p(...)
181-
182-
const keychain: KeyChain = libp2p.keychain
183-
```
184-
185-
**After**
186-
187-
```ts
188-
import { keychain, type Keychain } from '@libp2p/keychain'
189-
190-
const libp2p = await createLibp2p({
191-
...
192-
services: {
193-
keychain: keychain()
194-
}
195-
})
196-
197-
const keychain: Keychain = libp2p.services.keychain
198-
```
199207

200-
## UPnPNat
208+
#### UPnPNat
201209

202210
The UPnPNat service module is now published in its own package.
203211

@@ -227,7 +235,7 @@ const node = await createLibp2p({
227235
})
228236
```
229237

230-
## Perf
238+
#### Perf
231239

232240
The Perf service module exports have been renamed in line with the other changes
233241
here.
@@ -258,7 +266,9 @@ const node = await createLibp2p({
258266
})
259267
```
260268

261-
## Plaintext
269+
### Connection encryption
270+
271+
#### Plaintext
262272

263273
The Plaintext connection encrypter module is now published in its own package.
264274

@@ -290,20 +300,69 @@ const node = await createLibp2p({
290300
})
291301
```
292302

293-
## Pnet
303+
304+
### Misc
305+
306+
#### KeyChain
307+
308+
The KeyChain object is no longer included on Libp2p and must be instantiated
309+
explicitly if desired.
310+
311+
**Before**
312+
313+
```ts
314+
import type { KeyChain } from '@libp2p/interface/keychain'
315+
316+
const libp2p = await createLibp2p(...)
317+
318+
const keychain: KeyChain = libp2p.keychain
319+
```
320+
321+
**After**
322+
323+
```ts
324+
import { keychain, type Keychain } from '@libp2p/keychain'
325+
326+
const libp2p = await createLibp2p({
327+
...
328+
services: {
329+
keychain: keychain()
330+
}
331+
})
332+
333+
const keychain: Keychain = libp2p.services.keychain
334+
```
335+
336+
### Pnet
294337

295338
The pnet module is now published in its own package.
296339

297340
**Before**
298341

299342
```ts
343+
import { createLibp2p } from 'libp2p'
300344
import { preSharedKey, generateKey } from 'libp2p/pnet'
345+
346+
const node = await createLibp2p({
347+
// ...other options
348+
connectionProtector: preSharedKey({
349+
psk: generateKey(new Uint8Array(95))
350+
})
351+
})
301352
```
302353

303354
**After**
304355

305356
```ts
357+
import { createLibp2p } from 'libp2p'
306358
import { preSharedKey, generateKey } from '@libp2p/pnet'
359+
360+
const node = await createLibp2p({
361+
// ...other options
362+
connectionProtector: preSharedKey({
363+
psk: generateKey(new Uint8Array(95))
364+
})
365+
})
307366
```
308367

309368
## Metrics
@@ -319,4 +378,4 @@ The observed behavior of dialing peers has been that given a list of supported a
319378

320379
Consequently the previous dial behaviour of dialing all available addresses (up to a concurrency limit) and cancelling any in-flight dials when the first succeeds was a very inefficient use of resources.
321380

322-
Since `libp2p@0.46.10` we have only dialed one address at a time for each peer by setting the default value of the `ConnectionManager`'s `maxParallelDialsPerPeer` option to `1`. As of `libp2p@1.0.0` this option has been removed.
381+
Since `libp2p@0.46.10` we have only dialed one address at a time for each peer by setting the default value of the `ConnectionManager`'s `maxParallelDialsPerPeer` option to `1`. As of `libp2p@1.0.0` this option has been removed.

doc/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@
2323
"doc-check": "aegir doc-check"
2424
},
2525
"dependencies": {
26-
"@chainsafe/libp2p-yamux": "^5.0.0",
27-
"@libp2p/interface": "^0.1.0",
28-
"@libp2p/mplex": "^9.0.0",
29-
"@libp2p/prometheus-metrics": "^2.0.0",
30-
"@libp2p/tcp": "^8.0.0",
26+
"@chainsafe/libp2p-yamux": "^6.0.1",
27+
"@libp2p/interface": "^1.0.0",
28+
"@libp2p/mplex": "^10.0.0",
29+
"@libp2p/prometheus-metrics": "^3.0.0",
30+
"@libp2p/tcp": "^9.0.0",
3131
"aegir": "^41.0.2",
32-
"libp2p": "^0.46.0",
32+
"libp2p": "^1.0.0",
3333
"prom-client": "^15.0.0"
3434
},
3535
"private": true

interop/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
"test:transport:interop": "aegir test"
5252
},
5353
"dependencies": {
54-
"@chainsafe/libp2p-noise": "^13.0.0",
55-
"@chainsafe/libp2p-yamux": "^5.0.0",
54+
"@chainsafe/libp2p-noise": "^14.0.0",
55+
"@chainsafe/libp2p-yamux": "^6.0.1",
5656
"@libp2p/circuit-relay-v2": "^1.0.0",
5757
"@libp2p/identify": "^1.0.0",
5858
"@libp2p/mplex": "^10.0.0",

0 commit comments

Comments
 (0)