libp2p 0.46.9 → 0.46.10
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/dist/index.min.js +22 -22
- package/dist/src/config.js +2 -2
- package/dist/src/config.js.map +1 -1
- package/dist/src/connection-manager/constants.browser.d.ts +6 -6
- package/dist/src/connection-manager/constants.browser.d.ts.map +1 -1
- package/dist/src/connection-manager/constants.browser.js +6 -6
- package/dist/src/connection-manager/constants.browser.js.map +1 -1
- package/dist/src/connection-manager/constants.d.ts +6 -6
- package/dist/src/connection-manager/constants.d.ts.map +1 -1
- package/dist/src/connection-manager/constants.defaults.d.ts +5 -5
- package/dist/src/connection-manager/constants.defaults.d.ts.map +1 -1
- package/dist/src/connection-manager/constants.defaults.js +5 -5
- package/dist/src/connection-manager/constants.defaults.js.map +1 -1
- package/dist/src/connection-manager/constants.js +6 -6
- package/dist/src/connection-manager/constants.js.map +1 -1
- package/dist/src/connection-manager/dial-queue.js +2 -2
- package/dist/src/connection-manager/dial-queue.js.map +1 -1
- package/dist/src/connection-manager/index.d.ts +5 -5
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/connection-manager/index.js +4 -3
- package/dist/src/connection-manager/index.js.map +1 -1
- package/dist/src/identify/consts.d.ts +1 -1
- package/dist/src/identify/consts.d.ts.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.d.ts.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/package.json +8 -8
- package/src/config.ts +2 -2
- package/src/connection-manager/constants.browser.ts +7 -7
- package/src/connection-manager/constants.defaults.ts +6 -6
- package/src/connection-manager/constants.ts +7 -7
- package/src/connection-manager/dial-queue.ts +2 -2
- package/src/connection-manager/index.ts +9 -8
- package/src/version.ts +1 -1
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
export * from './constants.defaults.js'
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxParallelDials
|
|
5
|
-
*/
|
|
6
|
-
export const MAX_PARALLEL_DIALS = 100
|
|
7
|
-
|
|
8
3
|
/**
|
|
9
4
|
* @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#minConnections
|
|
10
5
|
*/
|
|
@@ -16,6 +11,11 @@ export const MIN_CONNECTIONS = 50
|
|
|
16
11
|
export const MAX_CONNECTIONS = 300
|
|
17
12
|
|
|
18
13
|
/**
|
|
19
|
-
* @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#
|
|
14
|
+
* @see https://libp2p.github.io/js-libp2p/interfaces/index._internal_.ConnectionManagerConfig.html#maxParallelDials
|
|
15
|
+
*/
|
|
16
|
+
export const MAX_PARALLEL_DIALS = 100
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @see https://libp2p.github.io/js-libp2p/interfaces/libp2p.index.unknown.ConnectionManagerInit.html#autoDialPeerRetryThreshold
|
|
20
20
|
*/
|
|
21
|
-
export const
|
|
21
|
+
export const AUTO_DIAL_PEER_RETRY_THRESHOLD = 1000 * 60
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { setMaxListeners } from 'events'
|
|
2
2
|
import { AbortError, CodeError } from '@libp2p/interface/errors'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
|
-
import {
|
|
4
|
+
import { defaultAddressSort } from '@libp2p/utils/address-sort'
|
|
5
5
|
import { type Multiaddr, type Resolver, resolvers } from '@multiformats/multiaddr'
|
|
6
6
|
import { dnsaddrResolver } from '@multiformats/multiaddr/resolvers'
|
|
7
7
|
import { type ClearableSignal, anySignal } from 'any-signal'
|
|
@@ -51,7 +51,7 @@ interface DialerInit {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
const defaultOptions = {
|
|
54
|
-
addressSorter:
|
|
54
|
+
addressSorter: defaultAddressSort,
|
|
55
55
|
maxParallelDials: MAX_PARALLEL_DIALS,
|
|
56
56
|
maxPeerAddrsToDial: MAX_PEER_ADDRS_TO_DIAL,
|
|
57
57
|
maxParallelDialsPerPeer: MAX_PARALLEL_DIALS_PER_PEER,
|
|
@@ -2,7 +2,7 @@ import { CodeError } from '@libp2p/interface/errors'
|
|
|
2
2
|
import { KEEP_ALIVE } from '@libp2p/interface/peer-store/tags'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { PeerMap } from '@libp2p/peer-collections'
|
|
5
|
-
import {
|
|
5
|
+
import { defaultAddressSort } from '@libp2p/utils/address-sort'
|
|
6
6
|
import { type Multiaddr, type Resolver, multiaddr } from '@multiformats/multiaddr'
|
|
7
7
|
import { dnsaddrResolver } from '@multiformats/multiaddr/resolvers'
|
|
8
8
|
import { RateLimiterMemory } from 'rate-limiter-flexible'
|
|
@@ -10,7 +10,7 @@ import { codes } from '../errors.js'
|
|
|
10
10
|
import { getPeerAddress } from '../get-peer.js'
|
|
11
11
|
import { AutoDial } from './auto-dial.js'
|
|
12
12
|
import { ConnectionPruner } from './connection-pruner.js'
|
|
13
|
-
import { AUTO_DIAL_CONCURRENCY, AUTO_DIAL_MAX_QUEUE_LENGTH, AUTO_DIAL_PRIORITY, DIAL_TIMEOUT, INBOUND_CONNECTION_THRESHOLD, MAX_CONNECTIONS, MAX_INCOMING_PENDING_CONNECTIONS, MAX_PARALLEL_DIALS, MAX_PEER_ADDRS_TO_DIAL, MIN_CONNECTIONS } from './constants.js'
|
|
13
|
+
import { AUTO_DIAL_CONCURRENCY, AUTO_DIAL_MAX_QUEUE_LENGTH, AUTO_DIAL_PRIORITY, DIAL_TIMEOUT, INBOUND_CONNECTION_THRESHOLD, MAX_CONNECTIONS, MAX_INCOMING_PENDING_CONNECTIONS, MAX_PARALLEL_DIALS, MAX_PARALLEL_DIALS_PER_PEER, MAX_PEER_ADDRS_TO_DIAL, MIN_CONNECTIONS } from './constants.js'
|
|
14
14
|
import { DialQueue } from './dial-queue.js'
|
|
15
15
|
import type { PendingDial, AddressSorter, Libp2pEvents, AbortOptions } from '@libp2p/interface'
|
|
16
16
|
import type { Connection, MultiaddrConnection } from '@libp2p/interface/connection'
|
|
@@ -30,14 +30,14 @@ const DEFAULT_DIAL_PRIORITY = 50
|
|
|
30
30
|
export interface ConnectionManagerInit {
|
|
31
31
|
/**
|
|
32
32
|
* The maximum number of connections libp2p is willing to have before it starts
|
|
33
|
-
* pruning connections to reduce resource usage. (default: 300)
|
|
33
|
+
* pruning connections to reduce resource usage. (default: 300, 100 in browsers)
|
|
34
34
|
*/
|
|
35
35
|
maxConnections?: number
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* The minimum number of connections below which libp2p will start to dial peers
|
|
39
39
|
* from the peer book. Setting this to 0 effectively disables this behaviour.
|
|
40
|
-
* (default: 50)
|
|
40
|
+
* (default: 50, 5 in browsers)
|
|
41
41
|
*/
|
|
42
42
|
minConnections?: number
|
|
43
43
|
|
|
@@ -68,7 +68,7 @@ export interface ConnectionManagerInit {
|
|
|
68
68
|
|
|
69
69
|
/**
|
|
70
70
|
* When we've failed to dial a peer, do not autodial them again within this
|
|
71
|
-
* number of ms. (default: 1 minute)
|
|
71
|
+
* number of ms. (default: 1 minute, 7 minutes in browsers)
|
|
72
72
|
*/
|
|
73
73
|
autoDialPeerRetryThreshold?: number
|
|
74
74
|
|
|
@@ -88,7 +88,7 @@ export interface ConnectionManagerInit {
|
|
|
88
88
|
|
|
89
89
|
/**
|
|
90
90
|
* The maximum number of dials across all peers to execute in parallel.
|
|
91
|
-
* (default: 100)
|
|
91
|
+
* (default: 100, 50 in browsers)
|
|
92
92
|
*/
|
|
93
93
|
maxParallelDials?: number
|
|
94
94
|
|
|
@@ -96,7 +96,7 @@ export interface ConnectionManagerInit {
|
|
|
96
96
|
* To prevent individual peers with large amounts of multiaddrs swamping the
|
|
97
97
|
* dial queue, this value controls how many addresses to dial in parallel per
|
|
98
98
|
* peer. So for example if two peers have 10 addresses and this value is set
|
|
99
|
-
* at 5, we will dial 5 addresses from each at a time. (default:
|
|
99
|
+
* at 5, we will dial 5 addresses from each at a time. (default: 1)
|
|
100
100
|
*/
|
|
101
101
|
maxParallelDialsPerPeer?: number
|
|
102
102
|
|
|
@@ -254,9 +254,10 @@ export class DefaultConnectionManager implements ConnectionManager, Startable {
|
|
|
254
254
|
transportManager: components.transportManager,
|
|
255
255
|
connectionGater: components.connectionGater
|
|
256
256
|
}, {
|
|
257
|
-
addressSorter: init.addressSorter ??
|
|
257
|
+
addressSorter: init.addressSorter ?? defaultAddressSort,
|
|
258
258
|
maxParallelDials: init.maxParallelDials ?? MAX_PARALLEL_DIALS,
|
|
259
259
|
maxPeerAddrsToDial: init.maxPeerAddrsToDial ?? MAX_PEER_ADDRS_TO_DIAL,
|
|
260
|
+
maxParallelDialsPerPeer: init.maxParallelDialsPerPeer ?? MAX_PARALLEL_DIALS_PER_PEER,
|
|
260
261
|
dialTimeout: init.dialTimeout ?? DIAL_TIMEOUT,
|
|
261
262
|
resolvers: init.resolvers ?? {
|
|
262
263
|
dnsaddr: dnsaddrResolver
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '0.46.
|
|
1
|
+
export const version = '0.46.10'
|
|
2
2
|
export const name = 'libp2p'
|