libp2p 0.41.0-1b30f81 → 0.41.0-3e53c19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/dist/index.min.js +58 -0
- package/dist/src/address-manager/index.d.ts +8 -0
- package/dist/src/address-manager/index.d.ts.map +1 -1
- package/dist/src/address-manager/index.js.map +1 -1
- package/dist/src/circuit/index.d.ts +11 -1
- package/dist/src/circuit/index.d.ts.map +1 -1
- package/dist/src/circuit/index.js.map +1 -1
- package/dist/src/circuit/transport.d.ts +1 -1
- package/dist/src/circuit/transport.d.ts.map +1 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +11 -2
- package/dist/src/config.js.map +1 -1
- package/dist/src/connection-manager/index.d.ts +8 -27
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/connection-manager/index.js +0 -4
- package/dist/src/connection-manager/index.js.map +1 -1
- package/dist/src/fetch/index.d.ts +14 -0
- package/dist/src/fetch/index.d.ts.map +1 -1
- package/dist/src/fetch/index.js +14 -0
- package/dist/src/fetch/index.js.map +1 -1
- package/dist/src/index.d.ts +123 -137
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +34 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/insecure/index.d.ts +23 -0
- package/dist/src/insecure/index.d.ts.map +1 -1
- package/dist/src/insecure/index.js +23 -0
- package/dist/src/insecure/index.js.map +1 -1
- package/dist/src/keychain/index.d.ts +2 -2
- package/dist/src/keychain/index.d.ts.map +1 -1
- package/dist/src/nat-manager.d.ts.map +1 -1
- package/dist/src/nat-manager.js +5 -1
- package/dist/src/nat-manager.js.map +1 -1
- package/dist/src/pnet/index.d.ts +23 -0
- package/dist/src/pnet/index.d.ts.map +1 -1
- package/dist/src/pnet/index.js +23 -0
- package/dist/src/pnet/index.js.map +1 -1
- package/package.json +8 -6
- package/src/address-manager/index.ts +8 -0
- package/src/circuit/index.ts +13 -1
- package/src/circuit/transport.ts +1 -1
- package/src/config.ts +11 -2
- package/src/connection-manager/index.ts +20 -47
- package/src/fetch/index.ts +14 -0
- package/src/index.ts +130 -149
- package/src/insecure/index.ts +24 -0
- package/src/keychain/index.ts +2 -2
- package/src/nat-manager.ts +6 -1
- package/src/pnet/index.ts +24 -0
- package/src/version.ts +1 -1
package/src/insecure/index.ts
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* A connection encrypter that does no connection encryption.
|
|
5
|
+
*
|
|
6
|
+
* This should not be used in production should be used for research purposes only.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
*
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createLibp2p } from 'libp2p'
|
|
12
|
+
* import { plaintext } from 'libp2p/insecure'
|
|
13
|
+
*
|
|
14
|
+
* // Create a Uint8Array and write the swarm key to it
|
|
15
|
+
* const swarmKey = new Uint8Array(95)
|
|
16
|
+
* generateKey(swarmKey)
|
|
17
|
+
*
|
|
18
|
+
* const node = await createLibp2p({
|
|
19
|
+
* // ...other options
|
|
20
|
+
* connectionEncryption: [plaintext()]
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
|
|
1
25
|
import { logger } from '@libp2p/logger'
|
|
2
26
|
import { handshake } from 'it-handshake'
|
|
3
27
|
import * as lp from 'it-length-prefixed'
|
package/src/keychain/index.ts
CHANGED
|
@@ -17,7 +17,7 @@ import type { Datastore } from 'interface-datastore'
|
|
|
17
17
|
|
|
18
18
|
const log = logger('libp2p:keychain')
|
|
19
19
|
|
|
20
|
-
export interface
|
|
20
|
+
export interface DEKConfig {
|
|
21
21
|
hash: string
|
|
22
22
|
salt: string
|
|
23
23
|
iterationCount: number
|
|
@@ -26,7 +26,7 @@ export interface DekOptions {
|
|
|
26
26
|
|
|
27
27
|
export interface KeyChainInit {
|
|
28
28
|
pass?: string
|
|
29
|
-
dek?:
|
|
29
|
+
dek?: DEKConfig
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
package/src/nat-manager.ts
CHANGED
|
@@ -149,11 +149,16 @@ export class NatManager implements Startable {
|
|
|
149
149
|
|
|
150
150
|
const client = await this._getClient()
|
|
151
151
|
const publicIp = this.externalAddress ?? await client.externalIp()
|
|
152
|
+
const isPrivate = isPrivateIp(publicIp)
|
|
152
153
|
|
|
153
|
-
if (
|
|
154
|
+
if (isPrivate === true) {
|
|
154
155
|
throw new Error(`${publicIp} is private - please set config.nat.externalIp to an externally routable IP or ensure you are not behind a double NAT`)
|
|
155
156
|
}
|
|
156
157
|
|
|
158
|
+
if (isPrivate == null) {
|
|
159
|
+
throw new Error(`${publicIp} is not an IP address`)
|
|
160
|
+
}
|
|
161
|
+
|
|
157
162
|
const publicPort = highPort()
|
|
158
163
|
|
|
159
164
|
log(`opening uPnP connection from ${publicIp}:${publicPort} to ${host}:${port}`)
|
package/src/pnet/index.ts
CHANGED
|
@@ -1,3 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @packageDocumentation
|
|
3
|
+
*
|
|
4
|
+
* Connection protection management for libp2p leveraging PSK encryption via XSalsa20.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
*
|
|
8
|
+
* ```typescript
|
|
9
|
+
* import { createLibp2p } from 'libp2p'
|
|
10
|
+
* import { preSharedKey, generateKey } from 'libp2p/pnet'
|
|
11
|
+
*
|
|
12
|
+
* // Create a Uint8Array and write the swarm key to it
|
|
13
|
+
* const swarmKey = new Uint8Array(95)
|
|
14
|
+
* generateKey(swarmKey)
|
|
15
|
+
*
|
|
16
|
+
* const node = await createLibp2p({
|
|
17
|
+
* // ...other options
|
|
18
|
+
* connectionProtector: preSharedKey({
|
|
19
|
+
* psk: swarmKey
|
|
20
|
+
* })
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
|
|
1
25
|
import { logger } from '@libp2p/logger'
|
|
2
26
|
import { pipe } from 'it-pipe'
|
|
3
27
|
import errCode from 'err-code'
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '0.41.0-
|
|
1
|
+
export const version = '0.41.0-3e53c19'
|
|
2
2
|
export const name = 'libp2p'
|