-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restores changes made to the repo after release but before yesterday's release-please-action chaos.
- Loading branch information
1 parent
d539109
commit 5775f1d
Showing
328 changed files
with
775 additions
and
1,619 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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. | ||
|
||
|
@@ -48,7 +84,7 @@ const node = await createLibp2p({ | |
}) | ||
``` | ||
|
||
## Ping | ||
#### Ping | ||
|
||
The Ping service is now published in its own package. | ||
|
||
|
@@ -78,7 +114,7 @@ const node = await createLibp2p({ | |
}) | ||
``` | ||
|
||
## Identify | ||
#### Identify | ||
|
||
The Identify service is now published in its own package. | ||
|
||
|
@@ -108,7 +144,7 @@ const node = await createLibp2p({ | |
}) | ||
``` | ||
|
||
## DCUtR | ||
#### DCUtR | ||
|
||
The DCUtR service is now published in its own package. | ||
|
||
|
@@ -138,7 +174,7 @@ const node = await createLibp2p({ | |
}) | ||
``` | ||
|
||
## Fetch | ||
#### Fetch | ||
|
||
The Fetch service is now published in its own package. | ||
|
||
|
@@ -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. | ||
|
||
|
@@ -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. | ||
|
@@ -258,7 +266,9 @@ const node = await createLibp2p({ | |
}) | ||
``` | ||
|
||
## Plaintext | ||
### Connection encryption | ||
|
||
#### Plaintext | ||
|
||
The Plaintext connection encrypter module is now published in its own package. | ||
|
||
|
@@ -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 | ||
|
@@ -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 `[email protected]` 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 `[email protected]` this option has been removed. | ||
Since `[email protected]` 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 `[email protected]` this option has been removed. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.