libp2p 0.45.8-b348fbaa → 0.45.9-05abd49f
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 +1 -1
- package/dist/index.min.js +28 -28
- package/dist/src/address-manager/index.d.ts +5 -5
- package/dist/src/address-manager/index.d.ts.map +1 -1
- package/dist/src/autonat/index.d.ts +6 -6
- package/dist/src/autonat/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/index.d.ts +1 -1
- package/dist/src/circuit-relay/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/advert-service.d.ts +3 -3
- package/dist/src/circuit-relay/server/advert-service.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/advert-service.js +1 -1
- package/dist/src/circuit-relay/server/advert-service.js.map +1 -1
- package/dist/src/circuit-relay/server/index.d.ts +7 -7
- package/dist/src/circuit-relay/server/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/index.js +1 -1
- package/dist/src/circuit-relay/server/index.js.map +1 -1
- package/dist/src/circuit-relay/server/reservation-store.d.ts +3 -3
- package/dist/src/circuit-relay/server/reservation-store.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/reservation-voucher.d.ts +2 -2
- package/dist/src/circuit-relay/transport/discovery.d.ts +8 -8
- package/dist/src/circuit-relay/transport/discovery.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/discovery.js +3 -4
- package/dist/src/circuit-relay/transport/discovery.js.map +1 -1
- package/dist/src/circuit-relay/transport/index.d.ts +10 -10
- package/dist/src/circuit-relay/transport/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/index.js +2 -2
- package/dist/src/circuit-relay/transport/index.js.map +1 -1
- package/dist/src/circuit-relay/transport/listener.d.ts +2 -2
- package/dist/src/circuit-relay/transport/listener.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/listener.js +2 -2
- package/dist/src/circuit-relay/transport/listener.js.map +1 -1
- package/dist/src/circuit-relay/transport/reservation-store.d.ts +7 -7
- package/dist/src/circuit-relay/transport/reservation-store.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/reservation-store.js +1 -1
- package/dist/src/circuit-relay/transport/reservation-store.js.map +1 -1
- package/dist/src/circuit-relay/utils.d.ts +1 -1
- package/dist/src/components.d.ts +15 -14
- package/dist/src/components.d.ts.map +1 -1
- package/dist/src/components.js +2 -2
- package/dist/src/components.js.map +1 -1
- package/dist/src/config/connection-gater.browser.d.ts +1 -1
- package/dist/src/config/connection-gater.d.ts +1 -1
- package/dist/src/config.d.ts +1 -2
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +2 -2
- package/dist/src/config.js.map +1 -1
- package/dist/src/connection/index.d.ts +4 -4
- package/dist/src/connection/index.d.ts.map +1 -1
- package/dist/src/connection/index.js +3 -3
- package/dist/src/connection/index.js.map +1 -1
- package/dist/src/connection-manager/auto-dial.d.ts +5 -5
- package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
- package/dist/src/connection-manager/connection-pruner.d.ts +4 -4
- package/dist/src/connection-manager/connection-pruner.d.ts.map +1 -1
- package/dist/src/connection-manager/dial-queue.d.ts +7 -8
- package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
- package/dist/src/connection-manager/dial-queue.js +1 -1
- package/dist/src/connection-manager/dial-queue.js.map +1 -1
- package/dist/src/connection-manager/index.d.ts +10 -11
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/connection-manager/index.js +2 -2
- package/dist/src/connection-manager/index.js.map +1 -1
- package/dist/src/content-routing/index.d.ts +5 -5
- package/dist/src/content-routing/index.d.ts.map +1 -1
- package/dist/src/content-routing/index.js +1 -1
- package/dist/src/content-routing/index.js.map +1 -1
- package/dist/src/content-routing/utils.d.ts +2 -2
- package/dist/src/content-routing/utils.js +1 -1
- package/dist/src/content-routing/utils.js.map +1 -1
- package/dist/src/fetch/index.d.ts +5 -5
- package/dist/src/fetch/index.d.ts.map +1 -1
- package/dist/src/fetch/index.js +1 -1
- package/dist/src/fetch/index.js.map +1 -1
- package/dist/src/get-peer.d.ts +1 -1
- package/dist/src/get-peer.js +2 -2
- package/dist/src/get-peer.js.map +1 -1
- package/dist/src/identify/identify.d.ts +4 -4
- package/dist/src/identify/identify.d.ts.map +1 -1
- package/dist/src/identify/identify.js +1 -1
- package/dist/src/identify/identify.js.map +1 -1
- package/dist/src/identify/index.d.ts +7 -7
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +11 -12
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/insecure/index.d.ts +1 -1
- package/dist/src/insecure/index.js +1 -1
- package/dist/src/insecure/index.js.map +1 -1
- package/dist/src/libp2p.d.ts +11 -11
- package/dist/src/libp2p.d.ts.map +1 -1
- package/dist/src/libp2p.js +5 -5
- package/dist/src/libp2p.js.map +1 -1
- package/dist/src/peer-routing.d.ts +5 -5
- package/dist/src/peer-routing.d.ts.map +1 -1
- package/dist/src/peer-routing.js +1 -1
- package/dist/src/peer-routing.js.map +1 -1
- package/dist/src/ping/index.d.ts +4 -4
- package/dist/src/ping/index.d.ts.map +1 -1
- package/dist/src/ping/index.js +1 -1
- package/dist/src/ping/index.js.map +1 -1
- package/dist/src/pnet/index.d.ts +1 -1
- package/dist/src/pnet/index.js +1 -1
- package/dist/src/pnet/index.js.map +1 -1
- package/dist/src/registrar.d.ts +7 -6
- package/dist/src/registrar.d.ts.map +1 -1
- package/dist/src/registrar.js +7 -11
- package/dist/src/registrar.js.map +1 -1
- package/dist/src/transport-manager.d.ts +9 -9
- package/dist/src/transport-manager.d.ts.map +1 -1
- package/dist/src/transport-manager.js +3 -3
- package/dist/src/transport-manager.js.map +1 -1
- package/dist/src/upgrader.d.ts +12 -12
- package/dist/src/upgrader.d.ts.map +1 -1
- package/dist/src/upgrader.js +1 -1
- package/dist/src/upgrader.js.map +1 -1
- package/dist/src/upnp-nat/index.d.ts +4 -4
- package/dist/src/upnp-nat/index.d.ts.map +1 -1
- package/dist/src/upnp-nat/index.js +1 -1
- package/dist/src/upnp-nat/index.js.map +1 -1
- package/dist/src/utils/peer-job-queue.d.ts +1 -1
- package/dist/src/utils/peer-job-queue.js +1 -1
- package/dist/src/utils/peer-job-queue.js.map +1 -1
- package/dist/src/version.d.ts +1 -1
- package/dist/src/version.js +1 -1
- package/package.json +42 -71
- package/src/address-manager/index.ts +5 -5
- package/src/autonat/index.ts +9 -9
- package/src/circuit-relay/index.ts +1 -1
- package/src/circuit-relay/server/advert-service.ts +3 -3
- package/src/circuit-relay/server/index.ts +9 -9
- package/src/circuit-relay/server/reservation-store.ts +3 -3
- package/src/circuit-relay/server/reservation-voucher.ts +2 -2
- package/src/circuit-relay/transport/discovery.ts +10 -11
- package/src/circuit-relay/transport/index.ts +12 -13
- package/src/circuit-relay/transport/listener.ts +6 -6
- package/src/circuit-relay/transport/reservation-store.ts +8 -8
- package/src/circuit-relay/utils.ts +1 -1
- package/src/components.ts +16 -15
- package/src/config/connection-gater.browser.ts +1 -1
- package/src/config/connection-gater.ts +1 -1
- package/src/config.ts +3 -4
- package/src/connection/index.ts +6 -6
- package/src/connection-manager/auto-dial.ts +5 -5
- package/src/connection-manager/connection-pruner.ts +4 -4
- package/src/connection-manager/dial-queue.ts +8 -9
- package/src/connection-manager/index.ts +12 -13
- package/src/content-routing/index.ts +6 -6
- package/src/content-routing/utils.ts +3 -3
- package/src/fetch/index.ts +7 -7
- package/src/get-peer.ts +3 -3
- package/src/identify/identify.ts +10 -11
- package/src/identify/index.ts +7 -7
- package/src/index.ts +11 -12
- package/src/insecure/index.ts +3 -3
- package/src/libp2p.ts +14 -14
- package/src/peer-routing.ts +6 -6
- package/src/ping/index.ts +7 -7
- package/src/pnet/index.ts +2 -2
- package/src/registrar.ts +14 -17
- package/src/transport-manager.ts +11 -11
- package/src/upgrader.ts +13 -14
- package/src/upnp-nat/index.ts +5 -5
- package/src/utils/peer-job-queue.ts +2 -2
- package/src/version.ts +1 -1
- package/dist/src/pubsub/dummy-pubsub.d.ts +0 -18
- package/dist/src/pubsub/dummy-pubsub.d.ts.map +0 -1
- package/dist/src/pubsub/dummy-pubsub.js +0 -38
- package/dist/src/pubsub/dummy-pubsub.js.map +0 -1
- package/src/pubsub/dummy-pubsub.ts +0 -53
package/src/libp2p.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { setMaxListeners } from 'events'
|
|
2
2
|
import { unmarshalPublicKey } from '@libp2p/crypto/keys'
|
|
3
|
-
import { type ContentRouting, contentRouting } from '@libp2p/interface
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
3
|
+
import { type ContentRouting, contentRouting } from '@libp2p/interface/content-routing'
|
|
4
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
5
|
+
import { EventEmitter, CustomEvent } from '@libp2p/interface/events'
|
|
6
|
+
import { peerDiscovery } from '@libp2p/interface/peer-discovery'
|
|
7
|
+
import { type PeerRouting, peerRouting } from '@libp2p/interface/peer-routing'
|
|
8
8
|
import { DefaultKeyChain } from '@libp2p/keychain'
|
|
9
9
|
import { logger } from '@libp2p/logger'
|
|
10
10
|
import { PeerSet } from '@libp2p/peer-collections'
|
|
@@ -29,15 +29,15 @@ import { DefaultTransportManager } from './transport-manager.js'
|
|
|
29
29
|
import { DefaultUpgrader } from './upgrader.js'
|
|
30
30
|
import type { Components } from './components.js'
|
|
31
31
|
import type { Libp2p, Libp2pInit, Libp2pOptions } from './index.js'
|
|
32
|
-
import type {
|
|
33
|
-
import type {
|
|
34
|
-
import type {
|
|
35
|
-
import type { Metrics } from '@libp2p/interface
|
|
36
|
-
import type { PeerId } from '@libp2p/interface
|
|
37
|
-
import type { PeerInfo } from '@libp2p/interface
|
|
38
|
-
import type { PeerStore } from '@libp2p/interface
|
|
39
|
-
import type {
|
|
40
|
-
import type {
|
|
32
|
+
import type { Libp2pEvents, PendingDial, ServiceMap, AbortOptions } from '@libp2p/interface'
|
|
33
|
+
import type { Connection, Stream } from '@libp2p/interface/connection'
|
|
34
|
+
import type { KeyChain } from '@libp2p/interface/keychain'
|
|
35
|
+
import type { Metrics } from '@libp2p/interface/metrics'
|
|
36
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
37
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
38
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
39
|
+
import type { Topology } from '@libp2p/interface/topology'
|
|
40
|
+
import type { StreamHandler, StreamHandlerOptions } from '@libp2p/interface-internal/registrar'
|
|
41
41
|
import type { Datastore } from 'interface-datastore'
|
|
42
42
|
|
|
43
43
|
const log = logger('libp2p')
|
package/src/peer-routing.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CodeError } from '@libp2p/
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
2
2
|
import { logger } from '@libp2p/logger'
|
|
3
3
|
import filter from 'it-filter'
|
|
4
4
|
import first from 'it-first'
|
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
requirePeers
|
|
11
11
|
} from './content-routing/utils.js'
|
|
12
12
|
import { codes, messages } from './errors.js'
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
13
|
+
import type { AbortOptions } from '@libp2p/interface'
|
|
14
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
15
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
16
|
+
import type { PeerRouting } from '@libp2p/interface/peer-routing'
|
|
17
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
18
18
|
|
|
19
19
|
const log = logger('libp2p:peer-routing')
|
|
20
20
|
|
package/src/ping/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setMaxListeners } from 'events'
|
|
2
2
|
import { randomBytes } from '@libp2p/crypto'
|
|
3
|
-
import { CodeError } from '@libp2p/
|
|
3
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
4
4
|
import { logger } from '@libp2p/logger'
|
|
5
5
|
import { abortableDuplex } from 'abortable-iterator'
|
|
6
6
|
import { anySignal } from 'any-signal'
|
|
@@ -9,12 +9,12 @@ import { pipe } from 'it-pipe'
|
|
|
9
9
|
import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
|
|
10
10
|
import { codes } from '../errors.js'
|
|
11
11
|
import { PROTOCOL_PREFIX, PROTOCOL_NAME, PING_LENGTH, PROTOCOL_VERSION, TIMEOUT, MAX_INBOUND_STREAMS, MAX_OUTBOUND_STREAMS } from './constants.js'
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type { PeerId } from '@libp2p/interface
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
import type {
|
|
12
|
+
import type { AbortOptions } from '@libp2p/interface'
|
|
13
|
+
import type { Stream } from '@libp2p/interface/connection'
|
|
14
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
15
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
16
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
17
|
+
import type { IncomingStreamData, Registrar } from '@libp2p/interface-internal/registrar'
|
|
18
18
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
19
19
|
|
|
20
20
|
const log = logger('libp2p:ping')
|
package/src/pnet/index.ts
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
*/
|
|
24
24
|
|
|
25
25
|
import { randomBytes } from '@libp2p/crypto'
|
|
26
|
-
import { CodeError } from '@libp2p/
|
|
26
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
27
27
|
import { logger } from '@libp2p/logger'
|
|
28
28
|
import { handshake } from 'it-handshake'
|
|
29
29
|
import map from 'it-map'
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
} from './crypto.js'
|
|
38
38
|
import * as Errors from './errors.js'
|
|
39
39
|
import { NONCE_LENGTH } from './key-generator.js'
|
|
40
|
-
import type { ConnectionProtector, MultiaddrConnection } from '@libp2p/interface
|
|
40
|
+
import type { ConnectionProtector, MultiaddrConnection } from '@libp2p/interface/connection'
|
|
41
41
|
|
|
42
42
|
const log = logger('libp2p:pnet')
|
|
43
43
|
|
package/src/registrar.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { CodeError } from '@libp2p/interfaces/errors'
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
3
2
|
import { logger } from '@libp2p/logger'
|
|
4
3
|
import merge from 'merge-options'
|
|
5
4
|
import { codes } from './errors.js'
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type { PeerId } from '@libp2p/interface
|
|
9
|
-
import type { PeerStore } from '@libp2p/interface
|
|
10
|
-
import type {
|
|
5
|
+
import type { Libp2pEvents, PeerUpdate } from '@libp2p/interface'
|
|
6
|
+
import type { EventEmitter } from '@libp2p/interface/events'
|
|
7
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
8
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
9
|
+
import type { Topology } from '@libp2p/interface/topology'
|
|
10
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
11
|
+
import type { StreamHandlerOptions, StreamHandlerRecord, Registrar, StreamHandler } from '@libp2p/interface-internal/registrar'
|
|
11
12
|
|
|
12
13
|
const log = logger('libp2p:registrar')
|
|
13
14
|
|
|
@@ -116,9 +117,8 @@ export class DefaultRegistrar implements Registrar {
|
|
|
116
117
|
* Register handlers for a set of multicodecs given
|
|
117
118
|
*/
|
|
118
119
|
async register (protocol: string, topology: Topology): Promise<string> {
|
|
119
|
-
if (
|
|
120
|
-
|
|
121
|
-
throw new CodeError('topology must be an instance of interfaces/topology', codes.ERR_INVALID_PARAMETERS)
|
|
120
|
+
if (topology == null) {
|
|
121
|
+
throw new CodeError('invalid topology', codes.ERR_INVALID_PARAMETERS)
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
// Create topology
|
|
@@ -133,9 +133,6 @@ export class DefaultRegistrar implements Registrar {
|
|
|
133
133
|
|
|
134
134
|
topologies.set(id, topology)
|
|
135
135
|
|
|
136
|
-
// Set registrar
|
|
137
|
-
await topology.setRegistrar(this)
|
|
138
|
-
|
|
139
136
|
return id
|
|
140
137
|
}
|
|
141
138
|
|
|
@@ -171,7 +168,7 @@ export class DefaultRegistrar implements Registrar {
|
|
|
171
168
|
}
|
|
172
169
|
|
|
173
170
|
for (const topology of topologies.values()) {
|
|
174
|
-
topology.onDisconnect(remotePeer)
|
|
171
|
+
topology.onDisconnect?.(remotePeer)
|
|
175
172
|
}
|
|
176
173
|
}
|
|
177
174
|
})
|
|
@@ -211,7 +208,7 @@ export class DefaultRegistrar implements Registrar {
|
|
|
211
208
|
}
|
|
212
209
|
|
|
213
210
|
for (const topology of topologies.values()) {
|
|
214
|
-
topology.onConnect(remotePeer, connection)
|
|
211
|
+
topology.onConnect?.(remotePeer, connection)
|
|
215
212
|
}
|
|
216
213
|
}
|
|
217
214
|
})
|
|
@@ -242,7 +239,7 @@ export class DefaultRegistrar implements Registrar {
|
|
|
242
239
|
}
|
|
243
240
|
|
|
244
241
|
for (const topology of topologies.values()) {
|
|
245
|
-
topology.onDisconnect(peer.id)
|
|
242
|
+
topology.onDisconnect?.(peer.id)
|
|
246
243
|
}
|
|
247
244
|
}
|
|
248
245
|
|
|
@@ -260,7 +257,7 @@ export class DefaultRegistrar implements Registrar {
|
|
|
260
257
|
if (connection == null) {
|
|
261
258
|
continue
|
|
262
259
|
}
|
|
263
|
-
topology.onConnect(peer.id, connection)
|
|
260
|
+
topology.onConnect?.(peer.id, connection)
|
|
264
261
|
}
|
|
265
262
|
}
|
|
266
263
|
}
|
package/src/transport-manager.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
2
|
+
import { trackedMap } from '@libp2p/interface/metrics/tracked-map'
|
|
3
|
+
import { FaultTolerance } from '@libp2p/interface/transport'
|
|
3
4
|
import { logger } from '@libp2p/logger'
|
|
4
|
-
import { trackedMap } from '@libp2p/tracked-map'
|
|
5
5
|
import { codes } from './errors.js'
|
|
6
|
-
import type {
|
|
7
|
-
import type { Connection } from '@libp2p/interface
|
|
8
|
-
import type {
|
|
9
|
-
import type { Metrics } from '@libp2p/interface
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
6
|
+
import type { Libp2pEvents, AbortOptions } from '@libp2p/interface'
|
|
7
|
+
import type { Connection } from '@libp2p/interface/connection'
|
|
8
|
+
import type { EventEmitter } from '@libp2p/interface/events'
|
|
9
|
+
import type { Metrics } from '@libp2p/interface/metrics'
|
|
10
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
11
|
+
import type { Listener, Transport, Upgrader } from '@libp2p/interface/transport'
|
|
12
|
+
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
|
13
|
+
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
14
14
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
15
15
|
|
|
16
16
|
const log = logger('libp2p:transports')
|
package/src/upgrader.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { setMaxListeners } from 'events'
|
|
2
|
-
import { CodeError } from '@libp2p/
|
|
2
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import * as mss from '@libp2p/multistream-select'
|
|
5
5
|
import { peerIdFromString } from '@libp2p/peer-id'
|
|
@@ -9,19 +9,18 @@ import { createConnection } from './connection/index.js'
|
|
|
9
9
|
import { INBOUND_UPGRADE_TIMEOUT } from './connection-manager/constants.js'
|
|
10
10
|
import { codes } from './errors.js'
|
|
11
11
|
import { DEFAULT_MAX_INBOUND_STREAMS, DEFAULT_MAX_OUTBOUND_STREAMS } from './registrar.js'
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
14
|
-
import type {
|
|
15
|
-
import type {
|
|
16
|
-
import type {
|
|
17
|
-
import type { Metrics } from '@libp2p/interface
|
|
18
|
-
import type { PeerId } from '@libp2p/interface
|
|
19
|
-
import type { PeerStore } from '@libp2p/interface
|
|
20
|
-
import type {
|
|
21
|
-
import type {
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
24
|
-
import type { EventEmitter } from '@libp2p/interfaces/events'
|
|
12
|
+
import type { Libp2pEvents, AbortOptions } from '@libp2p/interface'
|
|
13
|
+
import type { MultiaddrConnection, Connection, Stream, ConnectionProtector, NewStreamOptions } from '@libp2p/interface/connection'
|
|
14
|
+
import type { ConnectionEncrypter, SecuredConnection } from '@libp2p/interface/connection-encrypter'
|
|
15
|
+
import type { ConnectionGater } from '@libp2p/interface/connection-gater'
|
|
16
|
+
import type { EventEmitter } from '@libp2p/interface/events'
|
|
17
|
+
import type { Metrics } from '@libp2p/interface/metrics'
|
|
18
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
19
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
20
|
+
import type { StreamMuxer, StreamMuxerFactory } from '@libp2p/interface/stream-muxer'
|
|
21
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
22
|
+
import type { Registrar } from '@libp2p/interface-internal/registrar'
|
|
23
|
+
import type { Upgrader, UpgraderOptions } from '@libp2p/interface-internal/upgrader'
|
|
25
24
|
import type { Duplex, Source } from 'it-stream-types'
|
|
26
25
|
|
|
27
26
|
const log = logger('libp2p:upgrader')
|
package/src/upnp-nat/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { upnpNat, type NatAPI } from '@achingbrain/nat-port-mapper'
|
|
2
|
-
import { CodeError } from '@libp2p/
|
|
2
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { isLoopback } from '@libp2p/utils/multiaddr/is-loopback'
|
|
5
5
|
import { fromNodeAddress } from '@multiformats/multiaddr'
|
|
@@ -7,10 +7,10 @@ import isPrivateIp from 'private-ip'
|
|
|
7
7
|
import { isBrowser } from 'wherearewe'
|
|
8
8
|
import { codes } from '../errors.js'
|
|
9
9
|
import * as pkg from '../version.js'
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type {
|
|
13
|
-
import type {
|
|
10
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
11
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
12
|
+
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
|
13
|
+
import type { TransportManager } from '@libp2p/interface-internal/transport-manager'
|
|
14
14
|
|
|
15
15
|
const log = logger('libp2p:upnp-nat')
|
|
16
16
|
const DEFAULT_TTL = 7200
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
2
|
|
|
3
|
-
import { CodeError } from '@libp2p/
|
|
3
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
4
4
|
import PQueue from 'p-queue'
|
|
5
5
|
import { codes } from '../errors.js'
|
|
6
|
-
import type { PeerId } from '@libp2p/interface
|
|
6
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
7
7
|
import type { QueueAddOptions, Options, Queue } from 'p-queue'
|
|
8
8
|
|
|
9
9
|
// Port of lower_bound from https://en.cppreference.com/w/cpp/algorithm/lower_bound
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const version = '0.45.
|
|
1
|
+
export const version = '0.45.9-05abd49f'
|
|
2
2
|
export const name = 'libp2p'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { EventEmitter } from '@libp2p/interfaces/events';
|
|
2
|
-
import type { PeerId } from '@libp2p/interface-peer-id';
|
|
3
|
-
import type { PublishResult, PubSub, PubSubEvents, StrictNoSign, StrictSign, TopicValidatorFn } from '@libp2p/interface-pubsub';
|
|
4
|
-
export declare class DummyPubSub extends EventEmitter<PubSubEvents> implements PubSub {
|
|
5
|
-
topicValidators: Map<string, TopicValidatorFn>;
|
|
6
|
-
isStarted(): boolean;
|
|
7
|
-
start(): void | Promise<void>;
|
|
8
|
-
stop(): void | Promise<void>;
|
|
9
|
-
get globalSignaturePolicy(): typeof StrictSign | typeof StrictNoSign;
|
|
10
|
-
get multicodecs(): string[];
|
|
11
|
-
getPeers(): PeerId[];
|
|
12
|
-
getTopics(): string[];
|
|
13
|
-
subscribe(): void;
|
|
14
|
-
unsubscribe(): void;
|
|
15
|
-
getSubscribers(): PeerId[];
|
|
16
|
-
publish(): Promise<PublishResult>;
|
|
17
|
-
}
|
|
18
|
-
//# sourceMappingURL=dummy-pubsub.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dummy-pubsub.d.ts","sourceRoot":"","sources":["../../../src/pubsub/dummy-pubsub.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAExD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAA;AAE/H,qBAAa,WAAY,SAAQ,YAAY,CAAC,YAAY,CAAE,YAAW,MAAM;IACpE,eAAe,gCAAsC;IAE5D,SAAS,IAAK,OAAO;IAIrB,KAAK,IAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAI9B,IAAI,IAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7B,IAAI,qBAAqB,IAAK,OAAO,UAAU,GAAG,OAAO,YAAY,CAEpE;IAED,IAAI,WAAW,IAAK,MAAM,EAAE,CAE3B;IAED,QAAQ,IAAK,MAAM,EAAE;IAIrB,SAAS,IAAK,MAAM,EAAE;IAItB,SAAS,IAAK,IAAI;IAIlB,WAAW,IAAK,IAAI;IAIpB,cAAc,IAAK,MAAM,EAAE;IAIrB,OAAO,IAAK,OAAO,CAAC,aAAa,CAAC;CAGzC"}
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { CodeError } from '@libp2p/interfaces/errors';
|
|
2
|
-
import { EventEmitter } from '@libp2p/interfaces/events';
|
|
3
|
-
import { messages, codes } from '../errors.js';
|
|
4
|
-
export class DummyPubSub extends EventEmitter {
|
|
5
|
-
topicValidators = new Map();
|
|
6
|
-
isStarted() {
|
|
7
|
-
return false;
|
|
8
|
-
}
|
|
9
|
-
start() {
|
|
10
|
-
}
|
|
11
|
-
stop() {
|
|
12
|
-
}
|
|
13
|
-
get globalSignaturePolicy() {
|
|
14
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
|
|
15
|
-
}
|
|
16
|
-
get multicodecs() {
|
|
17
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
|
|
18
|
-
}
|
|
19
|
-
getPeers() {
|
|
20
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
|
|
21
|
-
}
|
|
22
|
-
getTopics() {
|
|
23
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
|
|
24
|
-
}
|
|
25
|
-
subscribe() {
|
|
26
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
|
|
27
|
-
}
|
|
28
|
-
unsubscribe() {
|
|
29
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
|
|
30
|
-
}
|
|
31
|
-
getSubscribers() {
|
|
32
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
|
|
33
|
-
}
|
|
34
|
-
async publish() {
|
|
35
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED);
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
//# sourceMappingURL=dummy-pubsub.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dummy-pubsub.js","sourceRoot":"","sources":["../../../src/pubsub/dummy-pubsub.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAA;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AACxD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,cAAc,CAAA;AAI9C,MAAM,OAAO,WAAY,SAAQ,YAA0B;IAClD,eAAe,GAAG,IAAI,GAAG,EAA4B,CAAA;IAE5D,SAAS;QACP,OAAO,KAAK,CAAA;IACd,CAAC;IAED,KAAK;IAEL,CAAC;IAED,IAAI;IAEJ,CAAC;IAED,IAAI,qBAAqB;QACvB,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,IAAI,WAAW;QACb,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,QAAQ;QACN,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,SAAS;QACP,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,SAAS;QACP,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,WAAW;QACT,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,cAAc;QACZ,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;IAED,KAAK,CAAC,OAAO;QACX,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,KAAK,CAAC,mBAAmB,CAAC,CAAA;IAC1E,CAAC;CACF"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { CodeError } from '@libp2p/interfaces/errors'
|
|
2
|
-
import { EventEmitter } from '@libp2p/interfaces/events'
|
|
3
|
-
import { messages, codes } from '../errors.js'
|
|
4
|
-
import type { PeerId } from '@libp2p/interface-peer-id'
|
|
5
|
-
import type { PublishResult, PubSub, PubSubEvents, StrictNoSign, StrictSign, TopicValidatorFn } from '@libp2p/interface-pubsub'
|
|
6
|
-
|
|
7
|
-
export class DummyPubSub extends EventEmitter<PubSubEvents> implements PubSub {
|
|
8
|
-
public topicValidators = new Map<string, TopicValidatorFn>()
|
|
9
|
-
|
|
10
|
-
isStarted (): boolean {
|
|
11
|
-
return false
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
start (): void | Promise<void> {
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
stop (): void | Promise<void> {
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
get globalSignaturePolicy (): typeof StrictSign | typeof StrictNoSign {
|
|
23
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
get multicodecs (): string[] {
|
|
27
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
getPeers (): PeerId[] {
|
|
31
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
getTopics (): string[] {
|
|
35
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
subscribe (): void {
|
|
39
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
unsubscribe (): void {
|
|
43
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
getSubscribers (): PeerId[] {
|
|
47
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async publish (): Promise<PublishResult> {
|
|
51
|
-
throw new CodeError(messages.PUBSUB_DISABLED, codes.ERR_PUBSUB_DISABLED)
|
|
52
|
-
}
|
|
53
|
-
}
|