libp2p 0.44.0-ba47c957 → 0.44.0-e3deaa40
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 +23 -23
- package/dist/src/autonat/index.d.ts.map +1 -1
- package/dist/src/autonat/index.js +15 -13
- package/dist/src/autonat/index.js.map +1 -1
- package/dist/src/components.d.ts +2 -66
- package/dist/src/components.d.ts.map +1 -1
- package/dist/src/components.js +60 -174
- package/dist/src/components.js.map +1 -1
- package/dist/src/config/connection-gater.browser.d.ts +8 -0
- package/dist/src/config/connection-gater.browser.d.ts.map +1 -0
- package/dist/src/config/connection-gater.browser.js +27 -0
- package/dist/src/config/connection-gater.browser.js.map +1 -0
- package/dist/src/config/connection-gater.d.ts +6 -0
- package/dist/src/config/connection-gater.d.ts.map +1 -0
- package/dist/src/config/connection-gater.js +18 -0
- package/dist/src/config/connection-gater.js.map +1 -0
- package/dist/src/config.d.ts +2 -1
- package/dist/src/config.d.ts.map +1 -1
- package/dist/src/config.js +16 -23
- package/dist/src/config.js.map +1 -1
- package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
- package/dist/src/connection-manager/auto-dial.js +7 -2
- package/dist/src/connection-manager/auto-dial.js.map +1 -1
- package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
- package/dist/src/connection-manager/dial-queue.js +8 -10
- package/dist/src/connection-manager/dial-queue.js.map +1 -1
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/connection-manager/index.js +3 -0
- package/dist/src/connection-manager/index.js.map +1 -1
- package/dist/src/content-routing/index.d.ts +0 -10
- package/dist/src/content-routing/index.d.ts.map +1 -1
- package/dist/src/content-routing/index.js +6 -41
- package/dist/src/content-routing/index.js.map +1 -1
- package/dist/src/fetch/index.d.ts +13 -35
- package/dist/src/fetch/index.d.ts.map +1 -1
- package/dist/src/fetch/index.js +7 -9
- package/dist/src/fetch/index.js.map +1 -1
- package/dist/src/identify/index.d.ts +13 -49
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/identify/index.js +122 -96
- package/dist/src/identify/index.js.map +1 -1
- package/dist/src/index.d.ts +11 -45
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/libp2p.d.ts +10 -35
- package/dist/src/libp2p.d.ts.map +1 -1
- package/dist/src/libp2p.js +110 -171
- package/dist/src/libp2p.js.map +1 -1
- package/dist/src/peer-routing.d.ts.map +1 -1
- package/dist/src/peer-routing.js +7 -6
- package/dist/src/peer-routing.js.map +1 -1
- package/dist/src/ping/constants.d.ts +4 -0
- package/dist/src/ping/constants.d.ts.map +1 -1
- package/dist/src/ping/constants.js +10 -0
- package/dist/src/ping/constants.js.map +1 -1
- package/dist/src/ping/index.d.ts +10 -27
- package/dist/src/ping/index.d.ts.map +1 -1
- package/dist/src/ping/index.js +18 -21
- package/dist/src/ping/index.js.map +1 -1
- package/dist/src/registrar.js +2 -2
- package/dist/src/registrar.js.map +1 -1
- package/dist/src/transport-manager.d.ts +2 -1
- package/dist/src/transport-manager.d.ts.map +1 -1
- package/dist/src/transport-manager.js +4 -2
- package/dist/src/transport-manager.js.map +1 -1
- package/dist/src/upgrader.d.ts.map +1 -1
- package/dist/src/upgrader.js +7 -14
- package/dist/src/upgrader.js.map +1 -1
- package/dist/src/upnp-nat/index.d.ts +42 -0
- package/dist/src/upnp-nat/index.d.ts.map +1 -0
- package/dist/src/{nat-manager.js → upnp-nat/index.js} +11 -7
- package/dist/src/upnp-nat/index.js.map +1 -0
- package/package.json +32 -17
- package/src/autonat/index.ts +14 -13
- package/src/components.ts +67 -248
- package/src/config/connection-gater.browser.ts +31 -0
- package/src/config/connection-gater.ts +19 -0
- package/src/config.ts +8 -14
- package/src/connection-manager/auto-dial.ts +8 -2
- package/src/connection-manager/dial-queue.ts +10 -16
- package/src/connection-manager/index.ts +4 -0
- package/src/content-routing/index.ts +6 -54
- package/src/fetch/index.ts +51 -14
- package/src/identify/index.ts +154 -104
- package/src/index.ts +12 -52
- package/src/libp2p.ts +102 -214
- package/src/peer-routing.ts +10 -8
- package/src/ping/constants.ts +11 -0
- package/src/ping/index.ts +32 -28
- package/src/registrar.ts +2 -2
- package/src/transport-manager.ts +5 -3
- package/src/upgrader.ts +7 -13
- package/src/{nat-manager.ts → upnp-nat/index.ts} +15 -16
- package/src/version.ts +1 -1
- package/dist/src/dht/dht-content-routing.d.ts +0 -17
- package/dist/src/dht/dht-content-routing.d.ts.map +0 -1
- package/dist/src/dht/dht-content-routing.js +0 -32
- package/dist/src/dht/dht-content-routing.js.map +0 -1
- package/dist/src/dht/dht-peer-routing.d.ts +0 -15
- package/dist/src/dht/dht-peer-routing.d.ts.map +0 -1
- package/dist/src/dht/dht-peer-routing.js +0 -26
- package/dist/src/dht/dht-peer-routing.js.map +0 -1
- package/dist/src/dht/dummy-dht.d.ts +0 -20
- package/dist/src/dht/dummy-dht.d.ts.map +0 -1
- package/dist/src/dht/dummy-dht.js +0 -46
- package/dist/src/dht/dummy-dht.js.map +0 -1
- package/dist/src/nat-manager.d.ts +0 -74
- package/dist/src/nat-manager.d.ts.map +0 -1
- package/dist/src/nat-manager.js.map +0 -1
- package/src/dht/dht-content-routing.ts +0 -44
- package/src/dht/dht-peer-routing.ts +0 -36
- package/src/dht/dummy-dht.ts +0 -60
package/dist/src/libp2p.d.ts
CHANGED
|
@@ -1,46 +1,28 @@
|
|
|
1
1
|
import type { AbortOptions } from '@libp2p/interfaces';
|
|
2
2
|
import { EventEmitter } from '@libp2p/interfaces/events';
|
|
3
3
|
import { Multiaddr } from '@multiformats/multiaddr';
|
|
4
|
-
import { IdentifyService } from './identify/index.js';
|
|
5
|
-
import { FetchService } from './fetch/index.js';
|
|
6
|
-
import { PingService } from './ping/index.js';
|
|
7
|
-
import { AutonatService } from './autonat/index.js';
|
|
8
4
|
import type { Components } from './components.js';
|
|
9
5
|
import type { PeerId } from '@libp2p/interface-peer-id';
|
|
10
6
|
import type { Connection, Stream } from '@libp2p/interface-connection';
|
|
11
|
-
import type {
|
|
12
|
-
import type { ContentRouting } from '@libp2p/interface-content-routing';
|
|
13
|
-
import type { PubSub } from '@libp2p/interface-pubsub';
|
|
14
|
-
import type { Registrar, StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar';
|
|
15
|
-
import type { ConnectionManager } from '@libp2p/interface-connection-manager';
|
|
16
|
-
import type { PeerInfo } from '@libp2p/interface-peer-info';
|
|
7
|
+
import type { StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar';
|
|
17
8
|
import type { Libp2p, Libp2pInit, Libp2pOptions } from './index.js';
|
|
18
9
|
import type { PeerStore } from '@libp2p/interface-peer-store';
|
|
19
|
-
import type { DualDHT } from '@libp2p/interface-dht';
|
|
20
10
|
import type { Metrics } from '@libp2p/interface-metrics';
|
|
21
11
|
import type { KeyChain } from '@libp2p/interface-keychain';
|
|
22
|
-
import type {
|
|
23
|
-
import
|
|
24
|
-
|
|
12
|
+
import type { Libp2pEvents, PendingDial, ServiceMap } from '@libp2p/interface-libp2p';
|
|
13
|
+
import { ContentRouting } from '@libp2p/interface-content-routing';
|
|
14
|
+
import { PeerRouting } from '@libp2p/interface-peer-routing';
|
|
15
|
+
export declare class Libp2pNode<T extends ServiceMap = {}> extends EventEmitter<Libp2pEvents> implements Libp2p<T> {
|
|
16
|
+
#private;
|
|
25
17
|
peerId: PeerId;
|
|
26
|
-
dht: DualDHT;
|
|
27
|
-
pubsub: PubSub;
|
|
28
|
-
identifyService: IdentifyService;
|
|
29
|
-
circuitService?: CircuitRelayService;
|
|
30
|
-
fetchService: FetchService;
|
|
31
|
-
pingService: PingService;
|
|
32
|
-
autonatService: AutonatService;
|
|
33
|
-
components: Components;
|
|
34
18
|
peerStore: PeerStore;
|
|
35
19
|
contentRouting: ContentRouting;
|
|
36
20
|
peerRouting: PeerRouting;
|
|
37
21
|
keychain: KeyChain;
|
|
38
|
-
connectionManager: ConnectionManager;
|
|
39
|
-
registrar: Registrar;
|
|
40
22
|
metrics?: Metrics;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
constructor(init: Libp2pInit);
|
|
23
|
+
services: T;
|
|
24
|
+
components: Components;
|
|
25
|
+
constructor(init: Libp2pInit<T>);
|
|
44
26
|
private configureComponent;
|
|
45
27
|
/**
|
|
46
28
|
* Starts the libp2p node and all its subsystems
|
|
@@ -63,21 +45,14 @@ export declare class Libp2pNode extends EventEmitter<Libp2pEvents> implements Li
|
|
|
63
45
|
* Get the public key for the given peer id
|
|
64
46
|
*/
|
|
65
47
|
getPublicKey(peer: PeerId, options?: AbortOptions): Promise<Uint8Array>;
|
|
66
|
-
fetch(peer: PeerId | Multiaddr, key: string, options?: AbortOptions): Promise<Uint8Array | null>;
|
|
67
|
-
ping(peer: PeerId | Multiaddr, options?: AbortOptions): Promise<number>;
|
|
68
48
|
handle(protocols: string | string[], handler: StreamHandler, options?: StreamHandlerOptions): Promise<void>;
|
|
69
49
|
unhandle(protocols: string[] | string): Promise<void>;
|
|
70
50
|
register(protocol: string, topology: Topology): Promise<string>;
|
|
71
51
|
unregister(id: string): void;
|
|
72
|
-
/**
|
|
73
|
-
* Called whenever peer discovery services emit `peer` events and adds peers
|
|
74
|
-
* to the peer store.
|
|
75
|
-
*/
|
|
76
|
-
onDiscoveryPeer(evt: CustomEvent<PeerInfo>): void;
|
|
77
52
|
}
|
|
78
53
|
/**
|
|
79
54
|
* Returns a new Libp2pNode instance - this exposes more of the internals than the
|
|
80
55
|
* libp2p interface and is useful for testing and debugging.
|
|
81
56
|
*/
|
|
82
|
-
export declare function createLibp2pNode(options: Libp2pOptions): Promise<Libp2pNode
|
|
57
|
+
export declare function createLibp2pNode<T extends ServiceMap = {}>(options: Libp2pOptions<T>): Promise<Libp2pNode<T>>;
|
|
83
58
|
//# sourceMappingURL=libp2p.d.ts.map
|
package/dist/src/libp2p.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libp2p.d.ts","sourceRoot":"","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AAC;IAY5G,QAAQ,CAAE,SAAS,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAYtD,QAAQ,CAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAItE,UAAU,CAAE,EAAE,EAAE,MAAM,GAAG,IAAI;CAsB9B;AAED;;;GAGG;AACH,wBAAsB,gBAAgB,CAAE,CAAC,SAAS,UAAU,GAAG,EAAE,EAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CA0BrH"}
|
package/dist/src/libp2p.js
CHANGED
|
@@ -1,6 +1,17 @@
|
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
6
|
+
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _Libp2pNode_instances, _Libp2pNode_started, _Libp2pNode_onDiscoveryPeer;
|
|
1
13
|
import { logger } from '@libp2p/logger';
|
|
2
14
|
import { EventEmitter, CustomEvent } from '@libp2p/interfaces/events';
|
|
3
|
-
import { isStartable } from '@libp2p/interfaces/startable';
|
|
4
15
|
import { isMultiaddr } from '@multiformats/multiaddr';
|
|
5
16
|
import { MemoryDatastore } from 'datastore-core/memory';
|
|
6
17
|
import { DefaultPeerRouting } from './peer-routing.js';
|
|
@@ -12,30 +23,28 @@ import { DefaultKeyChain } from '@libp2p/keychain';
|
|
|
12
23
|
import { DefaultTransportManager } from './transport-manager.js';
|
|
13
24
|
import { DefaultUpgrader } from './upgrader.js';
|
|
14
25
|
import { DefaultRegistrar } from './registrar.js';
|
|
15
|
-
import { IdentifyService } from './identify/index.js';
|
|
16
|
-
import { FetchService } from './fetch/index.js';
|
|
17
|
-
import { PingService } from './ping/index.js';
|
|
18
|
-
import { NatManager } from './nat-manager.js';
|
|
19
|
-
import { DHTPeerRouting } from './dht/dht-peer-routing.js';
|
|
20
26
|
import { PersistentPeerStore } from '@libp2p/peer-store';
|
|
21
|
-
import {
|
|
22
|
-
import { AutonatService } from './autonat/index.js';
|
|
23
|
-
import { DefaultComponents } from './components.js';
|
|
24
|
-
import { validateConfig } from './config.js';
|
|
25
|
-
import { createEd25519PeerId } from '@libp2p/peer-id-factory';
|
|
27
|
+
import { defaultComponents } from './components.js';
|
|
26
28
|
import { concat as uint8ArrayConcat } from 'uint8arrays/concat';
|
|
27
29
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
28
30
|
import { CodeError } from '@libp2p/interfaces/errors';
|
|
29
|
-
import { DummyDHT } from './dht/dummy-dht.js';
|
|
30
|
-
import { DummyPubSub } from './pubsub/dummy-pubsub.js';
|
|
31
31
|
import { PeerSet } from '@libp2p/peer-collections';
|
|
32
|
+
import { setMaxListeners } from 'events';
|
|
33
|
+
import { unmarshalPublicKey } from '@libp2p/crypto/keys';
|
|
32
34
|
import { peerIdFromString } from '@libp2p/peer-id';
|
|
33
35
|
import mergeOptions from 'merge-options';
|
|
34
|
-
import {
|
|
36
|
+
import { createEd25519PeerId } from '@libp2p/peer-id-factory';
|
|
37
|
+
import { validateConfig } from './config.js';
|
|
38
|
+
import { contentRouting } from '@libp2p/interface-content-routing';
|
|
39
|
+
import { peerRouting } from '@libp2p/interface-peer-routing';
|
|
40
|
+
import { peerDiscovery } from '@libp2p/interface-peer-discovery';
|
|
41
|
+
import { connectionGater } from './config/connection-gater.js';
|
|
35
42
|
const log = logger('libp2p');
|
|
36
43
|
export class Libp2pNode extends EventEmitter {
|
|
37
44
|
constructor(init) {
|
|
38
45
|
super();
|
|
46
|
+
_Libp2pNode_instances.add(this);
|
|
47
|
+
_Libp2pNode_started.set(this, void 0);
|
|
39
48
|
// event bus - components can listen to this emitter to be notified of system events
|
|
40
49
|
// and also cause them to be emitted
|
|
41
50
|
const events = new EventEmitter();
|
|
@@ -50,38 +59,25 @@ export class Libp2pNode extends EventEmitter {
|
|
|
50
59
|
setMaxListeners?.(Infinity, events);
|
|
51
60
|
}
|
|
52
61
|
catch { }
|
|
53
|
-
this
|
|
62
|
+
__classPrivateFieldSet(this, _Libp2pNode_started, false, "f");
|
|
54
63
|
this.peerId = init.peerId;
|
|
55
|
-
|
|
64
|
+
// @ts-expect-error {} may not be of type T
|
|
65
|
+
this.services = {};
|
|
66
|
+
const components = this.components = defaultComponents({
|
|
56
67
|
peerId: init.peerId,
|
|
57
68
|
events,
|
|
58
69
|
datastore: init.datastore ?? new MemoryDatastore(),
|
|
59
|
-
connectionGater:
|
|
60
|
-
denyDialPeer: async () => await Promise.resolve(false),
|
|
61
|
-
denyDialMultiaddr: async () => await Promise.resolve(false),
|
|
62
|
-
denyInboundConnection: async () => await Promise.resolve(false),
|
|
63
|
-
denyOutboundConnection: async () => await Promise.resolve(false),
|
|
64
|
-
denyInboundEncryptedConnection: async () => await Promise.resolve(false),
|
|
65
|
-
denyOutboundEncryptedConnection: async () => await Promise.resolve(false),
|
|
66
|
-
denyInboundUpgradedConnection: async () => await Promise.resolve(false),
|
|
67
|
-
denyOutboundUpgradedConnection: async () => await Promise.resolve(false),
|
|
68
|
-
filterMultiaddrForPeer: async () => await Promise.resolve(true),
|
|
69
|
-
...init.connectionGater
|
|
70
|
-
}
|
|
70
|
+
connectionGater: connectionGater(init.connectionGater)
|
|
71
71
|
});
|
|
72
|
-
|
|
72
|
+
this.peerStore = this.configureComponent('peerStore', new PersistentPeerStore(components, {
|
|
73
73
|
addressFilter: this.components.connectionGater.filterMultiaddrForPeer,
|
|
74
74
|
...init.peerStore
|
|
75
|
-
});
|
|
76
|
-
this.services = [
|
|
77
|
-
components
|
|
78
|
-
];
|
|
75
|
+
}));
|
|
79
76
|
// Create Metrics
|
|
80
77
|
if (init.metrics != null) {
|
|
81
|
-
this.metrics = this.
|
|
78
|
+
this.metrics = this.configureComponent('metrics', init.metrics(this.components));
|
|
82
79
|
}
|
|
83
|
-
|
|
84
|
-
this.components.events.addEventListener('peer:update', evt => {
|
|
80
|
+
components.events.addEventListener('peer:update', evt => {
|
|
85
81
|
// if there was no peer previously in the peer store this is a new peer
|
|
86
82
|
if (evt.detail.previous == null) {
|
|
87
83
|
this.safeDispatchEvent('peer:discovery', { detail: evt.detail.peer });
|
|
@@ -89,110 +85,92 @@ export class Libp2pNode extends EventEmitter {
|
|
|
89
85
|
});
|
|
90
86
|
// Set up connection protector if configured
|
|
91
87
|
if (init.connectionProtector != null) {
|
|
92
|
-
this.
|
|
88
|
+
this.configureComponent('connectionProtector', init.connectionProtector(components));
|
|
93
89
|
}
|
|
94
90
|
// Set up the Upgrader
|
|
95
91
|
this.components.upgrader = new DefaultUpgrader(this.components, {
|
|
96
|
-
connectionEncryption: (init.connectionEncryption ?? []).map(fn => this.configureComponent(fn(this.components))),
|
|
97
|
-
muxers: (init.streamMuxers ?? []).map(fn => this.configureComponent(fn(this.components))),
|
|
92
|
+
connectionEncryption: (init.connectionEncryption ?? []).map((fn, index) => this.configureComponent(`connection-encryption-${index}`, fn(this.components))),
|
|
93
|
+
muxers: (init.streamMuxers ?? []).map((fn, index) => this.configureComponent(`stream-muxers-${index}`, fn(this.components))),
|
|
98
94
|
inboundUpgradeTimeout: init.connectionManager.inboundUpgradeTimeout
|
|
99
95
|
});
|
|
100
96
|
// Setup the transport manager
|
|
101
|
-
this.
|
|
97
|
+
this.configureComponent('transportManager', new DefaultTransportManager(this.components, init.transportManager));
|
|
102
98
|
// Create the Connection Manager
|
|
103
|
-
this.connectionManager
|
|
99
|
+
this.configureComponent('connectionManager', new DefaultConnectionManager(this.components, init.connectionManager));
|
|
104
100
|
// Create the Registrar
|
|
105
|
-
this.registrar
|
|
101
|
+
this.configureComponent('registrar', new DefaultRegistrar(this.components));
|
|
106
102
|
// Addresses {listen, announce, noAnnounce}
|
|
107
|
-
this.
|
|
103
|
+
this.configureComponent('addressManager', new DefaultAddressManager(this.components, init.addresses));
|
|
108
104
|
// Create keychain
|
|
109
105
|
const keychainOpts = DefaultKeyChain.generateOptions();
|
|
110
|
-
this.keychain = this.configureComponent(new DefaultKeyChain(this.components, {
|
|
106
|
+
this.keychain = this.configureComponent('keyChain', new DefaultKeyChain(this.components, {
|
|
111
107
|
...keychainOpts,
|
|
112
108
|
...init.keychain
|
|
113
109
|
}));
|
|
114
|
-
//
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
this.identifyService = new IdentifyService(this.components, {
|
|
118
|
-
...init.identify
|
|
119
|
-
});
|
|
120
|
-
this.configureComponent(this.identifyService);
|
|
121
|
-
// dht provided components (peerRouting, contentRouting, dht)
|
|
122
|
-
if (init.dht != null) {
|
|
123
|
-
this.dht = this.components.dht = init.dht(this.components);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
this.dht = new DummyDHT();
|
|
127
|
-
}
|
|
128
|
-
// Create pubsub if provided
|
|
129
|
-
if (init.pubsub != null) {
|
|
130
|
-
this.pubsub = this.components.pubsub = init.pubsub(this.components);
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
this.pubsub = new DummyPubSub();
|
|
134
|
-
}
|
|
135
|
-
// Attach remaining APIs
|
|
136
|
-
// peer and content routing will automatically get modules from _modules and _dht
|
|
137
|
-
const peerRouters = (init.peerRouters ?? []).map(fn => this.configureComponent(fn(this.components)));
|
|
138
|
-
if (init.dht != null) {
|
|
139
|
-
// add dht to routers
|
|
140
|
-
peerRouters.push(this.configureComponent(new DHTPeerRouting(this.dht)));
|
|
141
|
-
// use dht for peer discovery
|
|
142
|
-
this.dht.addEventListener('peer', (evt) => {
|
|
143
|
-
this.onDiscoveryPeer(evt);
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
this.peerRouting = this.components.peerRouting = this.configureComponent(new DefaultPeerRouting(this.components, {
|
|
110
|
+
// Peer routers
|
|
111
|
+
const peerRouters = (init.peerRouters ?? []).map((fn, index) => this.configureComponent(`peer-router-${index}`, fn(this.components)));
|
|
112
|
+
this.peerRouting = this.components.peerRouting = this.configureComponent('peerRouting', new DefaultPeerRouting(this.components, {
|
|
147
113
|
...init.peerRouting,
|
|
148
114
|
routers: peerRouters
|
|
149
115
|
}));
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
contentRouters.push(this.configureComponent(new DHTContentRouting(this.dht)));
|
|
154
|
-
}
|
|
155
|
-
this.contentRouting = this.components.contentRouting = this.configureComponent(new CompoundContentRouting(this.components, {
|
|
116
|
+
// Content routers
|
|
117
|
+
const contentRouters = (init.contentRouters ?? []).map((fn, index) => this.configureComponent(`content-router-${index}`, fn(this.components)));
|
|
118
|
+
this.contentRouting = this.components.contentRouting = this.configureComponent('contentRouting', new CompoundContentRouting(this.components, {
|
|
156
119
|
routers: contentRouters
|
|
157
120
|
}));
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
}));
|
|
161
|
-
this.pingService = this.configureComponent(new PingService(this.components, {
|
|
162
|
-
...init.ping
|
|
163
|
-
}));
|
|
164
|
-
this.autonatService = this.configureComponent(new AutonatService(this.components, {
|
|
165
|
-
...init.autonat
|
|
166
|
-
}));
|
|
167
|
-
if (init.relay != null) {
|
|
168
|
-
this.circuitService = this.configureComponent(init.relay(this.components));
|
|
169
|
-
}
|
|
170
|
-
// Discovery modules
|
|
171
|
-
for (const fn of init.peerDiscovery ?? []) {
|
|
172
|
-
const service = this.configureComponent(fn(this.components));
|
|
121
|
+
(init.peerDiscovery ?? []).forEach((fn, index) => {
|
|
122
|
+
const service = this.configureComponent(`peer-discovery-${index}`, fn(this.components));
|
|
173
123
|
service.addEventListener('peer', (evt) => {
|
|
174
|
-
this.
|
|
124
|
+
__classPrivateFieldGet(this, _Libp2pNode_instances, "m", _Libp2pNode_onDiscoveryPeer).call(this, evt);
|
|
175
125
|
});
|
|
176
|
-
}
|
|
126
|
+
});
|
|
177
127
|
// Transport modules
|
|
178
|
-
init.transports.forEach((fn) => {
|
|
179
|
-
this.components.transportManager.add(this.configureComponent(fn(this.components)));
|
|
128
|
+
init.transports.forEach((fn, index) => {
|
|
129
|
+
this.components.transportManager.add(this.configureComponent(`transport-${index}`, fn(this.components)));
|
|
180
130
|
});
|
|
131
|
+
// User defined modules
|
|
132
|
+
if (init.services != null) {
|
|
133
|
+
for (const name of Object.keys(init.services)) {
|
|
134
|
+
const createService = init.services[name];
|
|
135
|
+
const service = createService(this.components);
|
|
136
|
+
if (service == null) {
|
|
137
|
+
log.error('service factory %s returned null or undefined instance', name);
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
this.services[name] = service;
|
|
141
|
+
this.configureComponent(name, service);
|
|
142
|
+
if (service[contentRouting] != null) {
|
|
143
|
+
log('registering service %s for content routing', name);
|
|
144
|
+
contentRouters.push(service[contentRouting]);
|
|
145
|
+
}
|
|
146
|
+
if (service[peerRouting] != null) {
|
|
147
|
+
log('registering service %s for peer routing', name);
|
|
148
|
+
peerRouters.push(service[peerRouting]);
|
|
149
|
+
}
|
|
150
|
+
if (service[peerDiscovery] != null) {
|
|
151
|
+
log('registering service %s for peer discovery', name);
|
|
152
|
+
service[peerDiscovery].addEventListener('peer', (evt) => {
|
|
153
|
+
__classPrivateFieldGet(this, _Libp2pNode_instances, "m", _Libp2pNode_onDiscoveryPeer).call(this, evt);
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}
|
|
181
158
|
}
|
|
182
|
-
configureComponent(component) {
|
|
183
|
-
if (
|
|
184
|
-
|
|
159
|
+
configureComponent(name, component) {
|
|
160
|
+
if (component == null) {
|
|
161
|
+
log.error('component %s was null or undefined', name);
|
|
185
162
|
}
|
|
163
|
+
this.components[name] = component;
|
|
186
164
|
return component;
|
|
187
165
|
}
|
|
188
166
|
/**
|
|
189
167
|
* Starts the libp2p node and all its subsystems
|
|
190
168
|
*/
|
|
191
169
|
async start() {
|
|
192
|
-
if (this
|
|
170
|
+
if (__classPrivateFieldGet(this, _Libp2pNode_started, "f")) {
|
|
193
171
|
return;
|
|
194
172
|
}
|
|
195
|
-
this
|
|
173
|
+
__classPrivateFieldSet(this, _Libp2pNode_started, true, "f");
|
|
196
174
|
log('libp2p is starting');
|
|
197
175
|
const keys = await this.keychain.listKeys();
|
|
198
176
|
if (keys.find(key => key.name === 'self') == null) {
|
|
@@ -200,18 +178,9 @@ export class Libp2pNode extends EventEmitter {
|
|
|
200
178
|
await this.keychain.importPeer('self', this.components.peerId);
|
|
201
179
|
}
|
|
202
180
|
try {
|
|
203
|
-
await
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
}
|
|
207
|
-
}));
|
|
208
|
-
// start any startables
|
|
209
|
-
await Promise.all(this.services.map(async (service) => { await service.start(); }));
|
|
210
|
-
await Promise.all(this.services.map(async (service) => {
|
|
211
|
-
if (service.afterStart != null) {
|
|
212
|
-
await service.afterStart();
|
|
213
|
-
}
|
|
214
|
-
}));
|
|
181
|
+
await this.components.beforeStart?.();
|
|
182
|
+
await this.components.start();
|
|
183
|
+
await this.components.afterStart?.();
|
|
215
184
|
log('libp2p has started');
|
|
216
185
|
}
|
|
217
186
|
catch (err) {
|
|
@@ -224,26 +193,18 @@ export class Libp2pNode extends EventEmitter {
|
|
|
224
193
|
* Stop the libp2p node by closing its listeners and open connections
|
|
225
194
|
*/
|
|
226
195
|
async stop() {
|
|
227
|
-
if (!this
|
|
196
|
+
if (!__classPrivateFieldGet(this, _Libp2pNode_started, "f")) {
|
|
228
197
|
return;
|
|
229
198
|
}
|
|
230
199
|
log('libp2p is stopping');
|
|
231
|
-
this
|
|
232
|
-
await
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
}));
|
|
237
|
-
await Promise.all(this.services.map(async (service) => { await service.stop(); }));
|
|
238
|
-
await Promise.all(this.services.map(async (service) => {
|
|
239
|
-
if (service.afterStop != null) {
|
|
240
|
-
await service.afterStop();
|
|
241
|
-
}
|
|
242
|
-
}));
|
|
200
|
+
__classPrivateFieldSet(this, _Libp2pNode_started, false, "f");
|
|
201
|
+
await this.components.beforeStop?.();
|
|
202
|
+
await this.components.stop();
|
|
203
|
+
await this.components.afterStop?.();
|
|
243
204
|
log('libp2p has stopped');
|
|
244
205
|
}
|
|
245
206
|
isStarted() {
|
|
246
|
-
return this
|
|
207
|
+
return __classPrivateFieldGet(this, _Libp2pNode_started, "f");
|
|
247
208
|
}
|
|
248
209
|
getConnections(peerId) {
|
|
249
210
|
return this.components.connectionManager.getConnections(peerId);
|
|
@@ -302,31 +263,13 @@ export class Libp2pNode extends EventEmitter {
|
|
|
302
263
|
]);
|
|
303
264
|
// search any available content routing methods
|
|
304
265
|
const bytes = await this.contentRouting.get(peerKey, options);
|
|
266
|
+
// ensure the returned key is valid
|
|
267
|
+
unmarshalPublicKey(bytes);
|
|
305
268
|
await this.peerStore.patch(peer, {
|
|
306
269
|
publicKey: bytes
|
|
307
270
|
});
|
|
308
271
|
return bytes;
|
|
309
272
|
}
|
|
310
|
-
async fetch(peer, key, options = {}) {
|
|
311
|
-
if (isMultiaddr(peer)) {
|
|
312
|
-
const peerId = peerIdFromString(peer.getPeerId() ?? '');
|
|
313
|
-
await this.components.peerStore.merge(peerId, {
|
|
314
|
-
multiaddrs: [peer]
|
|
315
|
-
});
|
|
316
|
-
peer = peerId;
|
|
317
|
-
}
|
|
318
|
-
return await this.fetchService.fetch(peer, key, options);
|
|
319
|
-
}
|
|
320
|
-
async ping(peer, options = {}) {
|
|
321
|
-
if (isMultiaddr(peer)) {
|
|
322
|
-
const peerId = peerIdFromString(peer.getPeerId() ?? '');
|
|
323
|
-
await this.components.peerStore.merge(peerId, {
|
|
324
|
-
multiaddrs: [peer]
|
|
325
|
-
});
|
|
326
|
-
peer = peerId;
|
|
327
|
-
}
|
|
328
|
-
return await this.pingService.ping(peer, options);
|
|
329
|
-
}
|
|
330
273
|
async handle(protocols, handler, options) {
|
|
331
274
|
if (!Array.isArray(protocols)) {
|
|
332
275
|
protocols = [protocols];
|
|
@@ -344,28 +287,24 @@ export class Libp2pNode extends EventEmitter {
|
|
|
344
287
|
}));
|
|
345
288
|
}
|
|
346
289
|
async register(protocol, topology) {
|
|
347
|
-
return await this.registrar.register(protocol, topology);
|
|
290
|
+
return await this.components.registrar.register(protocol, topology);
|
|
348
291
|
}
|
|
349
292
|
unregister(id) {
|
|
350
|
-
this.registrar.unregister(id);
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Called whenever peer discovery services emit `peer` events and adds peers
|
|
354
|
-
* to the peer store.
|
|
355
|
-
*/
|
|
356
|
-
onDiscoveryPeer(evt) {
|
|
357
|
-
const { detail: peer } = evt;
|
|
358
|
-
if (peer.id.toString() === this.peerId.toString()) {
|
|
359
|
-
log.error(new Error(codes.ERR_DISCOVERED_SELF));
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
void this.components.peerStore.merge(peer.id, {
|
|
363
|
-
multiaddrs: peer.multiaddrs,
|
|
364
|
-
protocols: peer.protocols
|
|
365
|
-
})
|
|
366
|
-
.catch(err => { log.error(err); });
|
|
293
|
+
this.components.registrar.unregister(id);
|
|
367
294
|
}
|
|
368
295
|
}
|
|
296
|
+
_Libp2pNode_started = new WeakMap(), _Libp2pNode_instances = new WeakSet(), _Libp2pNode_onDiscoveryPeer = function _Libp2pNode_onDiscoveryPeer(evt) {
|
|
297
|
+
const { detail: peer } = evt;
|
|
298
|
+
if (peer.id.toString() === this.peerId.toString()) {
|
|
299
|
+
log.error(new Error(codes.ERR_DISCOVERED_SELF));
|
|
300
|
+
return;
|
|
301
|
+
}
|
|
302
|
+
void this.components.peerStore.merge(peer.id, {
|
|
303
|
+
multiaddrs: peer.multiaddrs,
|
|
304
|
+
protocols: peer.protocols
|
|
305
|
+
})
|
|
306
|
+
.catch(err => { log.error(err); });
|
|
307
|
+
};
|
|
369
308
|
/**
|
|
370
309
|
* Returns a new Libp2pNode instance - this exposes more of the internals than the
|
|
371
310
|
* libp2p interface and is useful for testing and debugging.
|
package/dist/src/libp2p.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libp2p.js","sourceRoot":"","sources":["../../src/libp2p.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAEvC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAa,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACrE,OAAO,EAAE,WAAW,EAAa,MAAM,yBAAyB,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,4BAA4B,CAAA;AACnE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAA;AACnC,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAA;AAClE,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAA;AACxE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAA;AAClD,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAA;AAChE,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAC/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AA;QAE5D,IAAI,SAAS,IAAI,IAAI,EAAE;YACrB,IAAI;gBACF,yCAAyC;gBACzC,MAAM,QAAQ,GAAG,IAAI,eAAe,CAAC;oBACnC,SAAS;iBACV,EAAE,YAAY,CAAC,eAAe,CAAC,eAAe,EAAE,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAA;gBAErE,OAAO,CAAC,MAAM,GAAG,MAAM,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC,CAAA;aACrD;YAAC,OAAO,GAAQ,EAAE;gBACjB,IAAI,GAAG,CAAC,IAAI,KAAK,eAAe,EAAE;oBAChC,MAAM,GAAG,CAAA;iBACV;aACF;SACF;KACF;IAED,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI,EAAE;QAC1B,mDAAmD;QACnD,OAAO,CAAC,MAAM,GAAG,MAAM,mBAAmB,EAAE,CAAA;KAC7C;IAED,OAAO,IAAI,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAA;AAChD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-routing.d.ts","sourceRoot":"","sources":["../../src/peer-routing.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"peer-routing.d.ts","sourceRoot":"","sources":["../../src/peer-routing.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAA;AACjE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAK7D,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,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faces/errors';
|
|
3
3
|
import { codes, messages } from './errors.js';
|
|
4
4
|
import { storeAddresses, uniquePeers, requirePeers } from './content-routing/utils.js';
|
|
5
|
-
import { TimeoutController } from 'timeout-abort-controller';
|
|
6
5
|
import merge from 'it-merge';
|
|
7
6
|
import { pipe } from 'it-pipe';
|
|
8
7
|
import first from 'it-first';
|
|
@@ -12,6 +11,7 @@ import { setDelayedInterval, clearDelayedInterval
|
|
|
12
11
|
// @ts-expect-error module with no types
|
|
13
12
|
} from 'set-delayed-interval';
|
|
14
13
|
import { setMaxListeners } from 'events';
|
|
14
|
+
import { anySignal } from 'any-signal';
|
|
15
15
|
const log = logger('libp2p:peer-routing');
|
|
16
16
|
export class DefaultPeerRouting {
|
|
17
17
|
constructor(components, init) {
|
|
@@ -42,24 +42,25 @@ export class DefaultPeerRouting {
|
|
|
42
42
|
// we are already running the query
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
|
+
this.abortController = new AbortController();
|
|
46
|
+
const signal = anySignal([this.abortController.signal, AbortSignal.timeout(this.refreshManagerInit.timeout ?? 10e3)]);
|
|
45
47
|
try {
|
|
46
|
-
this.abortController = new TimeoutController(this.refreshManagerInit.timeout ?? 10e3);
|
|
47
48
|
// this controller may be used while dialing lots of peers so prevent MaxListenersExceededWarning
|
|
48
49
|
// appearing in the console
|
|
49
50
|
try {
|
|
50
|
-
|
|
51
|
-
setMaxListeners?.(Infinity, this.abortController.signal);
|
|
51
|
+
setMaxListeners?.(Infinity, signal);
|
|
52
52
|
}
|
|
53
53
|
catch { }
|
|
54
54
|
// nb getClosestPeers adds the addresses to the address book
|
|
55
|
-
await drain(this.getClosestPeers(this.components.peerId.toBytes(), { signal
|
|
55
|
+
await drain(this.getClosestPeers(this.components.peerId.toBytes(), { signal }));
|
|
56
56
|
}
|
|
57
57
|
catch (err) {
|
|
58
58
|
log.error(err);
|
|
59
59
|
}
|
|
60
60
|
finally {
|
|
61
|
-
this.abortController?.
|
|
61
|
+
this.abortController?.abort();
|
|
62
62
|
this.abortController = undefined;
|
|
63
|
+
signal.clear();
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
/**
|