Skip to content

Commit

Permalink
fix: restore lost commits (#2268)
Browse files Browse the repository at this point in the history
Restores changes made to the repo after release but before yesterday's
release-please-action chaos.
  • Loading branch information
achingbrain committed Nov 30, 2023
1 parent d539109 commit 5775f1d
Show file tree
Hide file tree
Showing 328 changed files with 775 additions and 1,619 deletions.
70 changes: 35 additions & 35 deletions .github/workflows/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,38 +19,38 @@ jobs:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master

test-examples:
name: Test example ${{ matrix.example.name }}
runs-on: ubuntu-latest
needs: build
continue-on-error: true
strategy:
matrix:
example:
- name: js-libp2p-example-chat
repo: https://github.com/libp2p/js-libp2p-example-chat.git
deps:
- '@libp2p/peer-id-factory@$PWD/packages/peer-id-factory'
- '@libp2p/tcp@$PWD/packages/transport-tcp'
- '@libp2p/websockets@$PWD/packages/transport-websockets'
- 'libp2p@$PWD/packages/libp2p'
# disabled until @libp2p/identify and @libp2p/circuit-relay are published
# - name: js-libp2p-example-circuit-relay
# repo: https://github.com/libp2p/js-libp2p-example-circuit-relay.git
# deps:
# - '@libp2p/circuit-relay@$PWD/packages/transport-circuit-relay'
# - '@libp2p/identify@$PWD/packages/protocol-identify'
# - '@libp2p/websockets@$PWD/packages/transport-websockets'
# - 'libp2p@$PWD/packages/libp2p'
- name: js-libp2p-example-connection-encryption
repo: https://github.com/libp2p/js-libp2p-example-connection-encryption.git
deps:
- '@libp2p/tcp@$PWD/packages/transport-tcp'
- 'libp2p@$PWD/packages/libp2p'
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: lts/*
- uses: ipfs/aegir/actions/cache-node-modules@master
- run: npx xvfb-maybe aegir test-dependant ${{ matrix.example.repo }} --deps ${{ join(matrix.example.deps, ',') }}
# test-examples:
# name: Test example ${{ matrix.example.name }}
# runs-on: ubuntu-latest
# needs: build
# continue-on-error: true
# strategy:
# matrix:
# example:
# - name: js-libp2p-example-chat
# repo: https://github.com/libp2p/js-libp2p-example-chat.git
# deps:
# - '@libp2p/peer-id-factory@$PWD/packages/peer-id-factory'
# - '@libp2p/tcp@$PWD/packages/transport-tcp'
# - '@libp2p/websockets@$PWD/packages/transport-websockets'
# - 'libp2p@$PWD/packages/libp2p'
# # disabled until @libp2p/identify and @libp2p/circuit-relay are published
# # - name: js-libp2p-example-circuit-relay
# # repo: https://github.com/libp2p/js-libp2p-example-circuit-relay.git
# # deps:
# # - '@libp2p/circuit-relay@$PWD/packages/transport-circuit-relay'
# # - '@libp2p/identify@$PWD/packages/protocol-identify'
# # - '@libp2p/websockets@$PWD/packages/transport-websockets'
# # - 'libp2p@$PWD/packages/libp2p'
# - name: js-libp2p-example-connection-encryption
# repo: https://github.com/libp2p/js-libp2p-example-connection-encryption.git
# deps:
# - '@libp2p/tcp@$PWD/packages/transport-tcp'
# - 'libp2p@$PWD/packages/libp2p'
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: lts/*
# - uses: ipfs/aegir/actions/cache-node-modules@master
# - run: npx xvfb-maybe aegir test-dependant ${{ matrix.example.repo }} --deps ${{ join(matrix.example.deps, ',') }}
2 changes: 1 addition & 1 deletion doc/CONFIGURATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ import { mplex } from '@libp2p/mplex'
import { yamux } from '@chainsafe/libp2p-yamux'
import { noise } from '@chainsafe/libp2p-noise'
import { gossipsub } from 'libp2p-gossipsub'
import { SignaturePolicy } from '@libp2p/interface/pubsub'
import { SignaturePolicy } from '@libp2p/interface'
import { identify } from '@libp2p/identify'

const node = await createLibp2p({
Expand Down
8 changes: 4 additions & 4 deletions doc/METRICS.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const node = await createLibp2p({
To define component metrics first get a reference to the metrics object:

```ts
import type { Metrics } from '@libp2p/interface/metrics'
import type { Metrics } from '@libp2p/interface'

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

```ts
import type { Metrics } from '@libp2p/interface/metrics'
import type { Metrics } from '@libp2p/interface'
import { prometheusMetrics } from '@libp2p/prometheus-metrics'

const metrics: Metrics = prometheusMetrics()()
Expand Down Expand Up @@ -117,7 +117,7 @@ stopTimer()
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:

```ts
import type { Metrics } from '@libp2p/interface/metrics'
import type { Metrics } from '@libp2p/interface'
import { prometheusMetrics } from '@libp2p/prometheus-metrics'

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

```ts
import type { Metrics } from '@libp2p/interface/metrics'
import type { Metrics } from '@libp2p/interface'
import { prometheusMetrics } from '@libp2p/prometheus-metrics'

const metrics: Metrics = prometheusMetrics()()
Expand Down
155 changes: 107 additions & 48 deletions doc/migrations/v0.46-v1.0.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,56 @@ A migration guide for refactoring your application code from libp2p `v0.46` to `

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

- [AutoNAT](#autonat)
- [Ping](#ping)
- [Identify](#identify)
- [DCUtR](#dcutr)
- [Fetch](#fetch)
- [KeyChain](#keychain)
- [UPnPNat](#upnpnat)
- [Perf](#perf)
- [Plaintext](#plaintext)
- [Pnet](#pnet)
- [Type imports](#type-imports)
- [Extracted modules](#extracted-modules)
- [Services](#services)
- [AutoNAT](#autonat)
- [Ping](#ping)
- [Identify](#identify)
- [DCUtR](#dcutr)
- [Fetch](#fetch)
- [UPnPNat](#upnpnat)
- [Perf](#perf)
- [Connection encryption](#connection-encryption)
- [Plaintext](#plaintext)
- [Misc](#misc)
- [KeyChain](#keychain)
- [Pnet](#pnet)
- [Metrics](#metrics)
- [Connection Manager](#connection-manager)

## AutoNAT
## Type imports

All exports from `@libp2p/interface` and `@libp2p/interface-internal` are
now exported from the root of the module, no more having to work out which
subpath to import from.

**Before**

```ts
import type { PeerId } from '@libp2p/interface/peer-id'
import type { Connection } from '@libp2p/interface/connection'
import type { Stream } from '@libp2p/interface/stream-muxer'
```

**After**

```ts
import type { Connection, PeerId, Stream } from '@libp2p/interface'
```

## Extracted modules

`js-libp2p` has always had a focus on being a modular, composable ecosystem of
modules. `v1.x.x` takes this further and extracts all of the optional
functionality out of the core and into modules that you can include in your app
if you need them, or omit them if you don't.

### Services

These modules can be configured as services to enable optional functionality.

#### AutoNAT

The AutoNAT service is now published in its own package.

Expand Down Expand Up @@ -48,7 +84,7 @@ const node = await createLibp2p({
})
```

## Ping
#### Ping

The Ping service is now published in its own package.

Expand Down Expand Up @@ -78,7 +114,7 @@ const node = await createLibp2p({
})
```

## Identify
#### Identify

The Identify service is now published in its own package.

Expand Down Expand Up @@ -108,7 +144,7 @@ const node = await createLibp2p({
})
```

## DCUtR
#### DCUtR

The DCUtR service is now published in its own package.

Expand Down Expand Up @@ -138,7 +174,7 @@ const node = await createLibp2p({
})
```

## Fetch
#### Fetch

The Fetch service is now published in its own package.

Expand Down Expand Up @@ -168,36 +204,8 @@ const node = await createLibp2p({
})
```

## KeyChain

The KeyChain object is no longer included on Libp2p and must be instantiated explicitly if desired.

**Before**

```ts
import type { KeyChain } from '@libp2p/interface/keychain'

const libp2p = await createLibp2p(...)

const keychain: KeyChain = libp2p.keychain
```

**After**

```ts
import { keychain, type Keychain } from '@libp2p/keychain'

const libp2p = await createLibp2p({
...
services: {
keychain: keychain()
}
})

const keychain: Keychain = libp2p.services.keychain
```

## UPnPNat
#### UPnPNat

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

Expand Down Expand Up @@ -227,7 +235,7 @@ const node = await createLibp2p({
})
```

## Perf
#### Perf

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

## Plaintext
### Connection encryption

#### Plaintext

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

Expand Down Expand Up @@ -290,20 +300,69 @@ const node = await createLibp2p({
})
```

## Pnet

### Misc

#### KeyChain

The KeyChain object is no longer included on Libp2p and must be instantiated
explicitly if desired.

**Before**

```ts
import type { KeyChain } from '@libp2p/interface/keychain'

const libp2p = await createLibp2p(...)

const keychain: KeyChain = libp2p.keychain
```

**After**

```ts
import { keychain, type Keychain } from '@libp2p/keychain'

const libp2p = await createLibp2p({
...
services: {
keychain: keychain()
}
})

const keychain: Keychain = libp2p.services.keychain
```

### Pnet

The pnet module is now published in its own package.

**Before**

```ts
import { createLibp2p } from 'libp2p'
import { preSharedKey, generateKey } from 'libp2p/pnet'

const node = await createLibp2p({
// ...other options
connectionProtector: preSharedKey({
psk: generateKey(new Uint8Array(95))
})
})
```

**After**

```ts
import { createLibp2p } from 'libp2p'
import { preSharedKey, generateKey } from '@libp2p/pnet'

const node = await createLibp2p({
// ...other options
connectionProtector: preSharedKey({
psk: generateKey(new Uint8Array(95))
})
})
```

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

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.

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.
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.
12 changes: 6 additions & 6 deletions doc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"doc-check": "aegir doc-check"
},
"dependencies": {
"@chainsafe/libp2p-yamux": "^5.0.0",
"@libp2p/interface": "^0.1.0",
"@libp2p/mplex": "^9.0.0",
"@libp2p/prometheus-metrics": "^2.0.0",
"@libp2p/tcp": "^8.0.0",
"@chainsafe/libp2p-yamux": "^6.0.1",
"@libp2p/interface": "^1.0.0",
"@libp2p/mplex": "^10.0.0",
"@libp2p/prometheus-metrics": "^3.0.0",
"@libp2p/tcp": "^9.0.0",
"aegir": "^41.0.2",
"libp2p": "^0.46.0",
"libp2p": "^1.0.0",
"prom-client": "^15.0.0"
},
"private": true
Expand Down
4 changes: 2 additions & 2 deletions interop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
"test:transport:interop": "aegir test"
},
"dependencies": {
"@chainsafe/libp2p-noise": "^13.0.0",
"@chainsafe/libp2p-yamux": "^5.0.0",
"@chainsafe/libp2p-noise": "^14.0.0",
"@chainsafe/libp2p-yamux": "^6.0.1",
"@libp2p/circuit-relay-v2": "^1.0.0",
"@libp2p/identify": "^1.0.0",
"@libp2p/mplex": "^10.0.0",
Expand Down
Loading

0 comments on commit 5775f1d

Please sign in to comment.