libp2p 0.44.0-97b473ad → 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 +27 -27
- package/dist/src/address-manager/index.d.ts +4 -4
- package/dist/src/address-manager/index.d.ts.map +1 -1
- package/dist/src/address-manager/index.js +9 -6
- package/dist/src/address-manager/index.js.map +1 -1
- 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/circuit-relay/server/advert-service.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/advert-service.js +2 -2
- package/dist/src/circuit-relay/server/advert-service.js.map +1 -1
- package/dist/src/circuit-relay/server/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/server/index.js +7 -3
- package/dist/src/circuit-relay/server/index.js.map +1 -1
- package/dist/src/circuit-relay/transport/discovery.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/discovery.js +3 -1
- package/dist/src/circuit-relay/transport/discovery.js.map +1 -1
- package/dist/src/circuit-relay/transport/index.d.ts +3 -0
- package/dist/src/circuit-relay/transport/index.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/index.js +6 -2
- package/dist/src/circuit-relay/transport/index.js.map +1 -1
- package/dist/src/circuit-relay/transport/listener.d.ts +3 -0
- package/dist/src/circuit-relay/transport/listener.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/listener.js +5 -4
- package/dist/src/circuit-relay/transport/listener.js.map +1 -1
- package/dist/src/circuit-relay/transport/reservation-store.d.ts +3 -0
- package/dist/src/circuit-relay/transport/reservation-store.d.ts.map +1 -1
- package/dist/src/circuit-relay/transport/reservation-store.js +11 -6
- package/dist/src/circuit-relay/transport/reservation-store.js.map +1 -1
- package/dist/src/components.d.ts +6 -63
- package/dist/src/components.d.ts.map +1 -1
- package/dist/src/components.js +60 -164
- 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 +3 -0
- package/dist/src/connection-manager/auto-dial.d.ts.map +1 -1
- package/dist/src/connection-manager/auto-dial.js +18 -4
- package/dist/src/connection-manager/auto-dial.js.map +1 -1
- package/dist/src/connection-manager/connection-pruner.d.ts +4 -0
- package/dist/src/connection-manager/connection-pruner.d.ts.map +1 -1
- package/dist/src/connection-manager/connection-pruner.js +23 -8
- package/dist/src/connection-manager/connection-pruner.js.map +1 -1
- package/dist/src/connection-manager/dial-queue.d.ts +2 -1
- package/dist/src/connection-manager/dial-queue.d.ts.map +1 -1
- package/dist/src/connection-manager/dial-queue.js +18 -12
- package/dist/src/connection-manager/dial-queue.js.map +1 -1
- package/dist/src/connection-manager/index.d.ts +8 -7
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/connection-manager/index.js +23 -34
- 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 +7 -42
- package/dist/src/content-routing/index.js.map +1 -1
- package/dist/src/content-routing/utils.d.ts.map +1 -1
- package/dist/src/content-routing/utils.js +3 -1
- package/dist/src/content-routing/utils.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 +16 -48
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/identify/index.js +200 -198
- package/dist/src/identify/index.js.map +1 -1
- package/dist/src/index.d.ts +11 -62
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/insecure/index.d.ts.map +1 -1
- package/dist/src/insecure/index.js +0 -1
- package/dist/src/insecure/index.js.map +1 -1
- package/dist/src/libp2p.d.ts +11 -42
- package/dist/src/libp2p.d.ts.map +1 -1
- package/dist/src/libp2p.js +137 -195
- 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/pnet/index.d.ts.map +1 -1
- package/dist/src/pnet/index.js +0 -1
- package/dist/src/pnet/index.js.map +1 -1
- package/dist/src/registrar.d.ts +5 -2
- package/dist/src/registrar.d.ts.map +1 -1
- package/dist/src/registrar.js +27 -25
- package/dist/src/registrar.js.map +1 -1
- package/dist/src/transport-manager.d.ts +11 -4
- package/dist/src/transport-manager.d.ts.map +1 -1
- package/dist/src/transport-manager.js +27 -11
- package/dist/src/transport-manager.js.map +1 -1
- package/dist/src/upgrader.d.ts +15 -10
- package/dist/src/upgrader.d.ts.map +1 -1
- package/dist/src/upgrader.js +36 -55
- 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 +59 -43
- package/src/address-manager/index.ts +12 -8
- package/src/autonat/index.ts +14 -13
- package/src/circuit-relay/server/advert-service.ts +2 -2
- package/src/circuit-relay/server/index.ts +7 -3
- package/src/circuit-relay/transport/discovery.ts +3 -1
- package/src/circuit-relay/transport/index.ts +10 -2
- package/src/circuit-relay/transport/listener.ts +8 -4
- package/src/circuit-relay/transport/reservation-store.ts +14 -6
- package/src/components.ts +71 -234
- 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 +24 -5
- package/src/connection-manager/connection-pruner.ts +28 -8
- package/src/connection-manager/dial-queue.ts +21 -19
- package/src/connection-manager/index.ts +31 -43
- package/src/content-routing/index.ts +7 -55
- package/src/content-routing/utils.ts +3 -1
- package/src/fetch/index.ts +51 -14
- package/src/identify/index.ts +235 -225
- package/src/index.ts +12 -70
- package/src/insecure/index.ts +4 -5
- package/src/libp2p.ts +139 -259
- package/src/peer-routing.ts +10 -8
- package/src/ping/constants.ts +11 -0
- package/src/ping/index.ts +32 -28
- package/src/pnet/index.ts +0 -1
- package/src/registrar.ts +31 -27
- package/src/transport-manager.ts +36 -14
- package/src/upgrader.ts +59 -64
- 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/dist/src/peer-record-updater.d.ts +0 -24
- package/dist/src/peer-record-updater.d.ts.map +0 -1
- package/dist/src/peer-record-updater.js +0 -44
- package/dist/src/peer-record-updater.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/src/peer-record-updater.ts +0 -65
package/dist/src/index.d.ts
CHANGED
|
@@ -15,10 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import type { RecursivePartial } from '@libp2p/interfaces';
|
|
17
17
|
import type { TransportManagerInit } from './transport-manager.js';
|
|
18
|
-
import type { IdentifyServiceInit } from './identify/index.js';
|
|
19
|
-
import type { DualDHT } from '@libp2p/interface-dht';
|
|
20
18
|
import type { Datastore } from 'interface-datastore';
|
|
21
|
-
import type { PeerStoreInit } from '@libp2p/interface-peer-store';
|
|
22
19
|
import type { PeerId } from '@libp2p/interface-peer-id';
|
|
23
20
|
import type { PeerDiscovery } from '@libp2p/interface-peer-discovery';
|
|
24
21
|
import type { ConnectionProtector } from '@libp2p/interface-connection';
|
|
@@ -28,24 +25,21 @@ import type { StreamMuxerFactory } from '@libp2p/interface-stream-muxer';
|
|
|
28
25
|
import type { ConnectionEncrypter } from '@libp2p/interface-connection-encrypter';
|
|
29
26
|
import type { PeerRouting } from '@libp2p/interface-peer-routing';
|
|
30
27
|
import type { ContentRouting } from '@libp2p/interface-content-routing';
|
|
31
|
-
import type { PubSub } from '@libp2p/interface-pubsub';
|
|
32
28
|
import type { Metrics } from '@libp2p/interface-metrics';
|
|
33
|
-
import type { PeerInfo } from '@libp2p/interface-peer-info';
|
|
34
|
-
import type { PingServiceInit } from './ping/index.js';
|
|
35
|
-
import type { FetchServiceInit } from './fetch/index.js';
|
|
36
|
-
import type { AutonatServiceInit } from './autonat/index.js';
|
|
37
29
|
import type { Components } from './components.js';
|
|
38
|
-
import type { Libp2p } from '@libp2p/interface-libp2p';
|
|
30
|
+
import type { Libp2p, ServiceMap } from '@libp2p/interface-libp2p';
|
|
39
31
|
import type { KeyChainInit } from '@libp2p/keychain';
|
|
40
|
-
import type { NatManagerInit } from './nat-manager.js';
|
|
41
32
|
import type { AddressManagerInit } from './address-manager/index.js';
|
|
42
33
|
import type { PeerRoutingInit } from './peer-routing.js';
|
|
43
34
|
import type { ConnectionManagerInit } from './connection-manager/index.js';
|
|
44
|
-
import type {
|
|
35
|
+
import type { PersistentPeerStoreInit } from '@libp2p/peer-store';
|
|
36
|
+
export type ServiceFactoryMap<T extends Record<string, unknown> = Record<string, unknown>> = {
|
|
37
|
+
[Property in keyof T]: (components: Components) => T[Property];
|
|
38
|
+
};
|
|
45
39
|
/**
|
|
46
40
|
* For Libp2p configurations and modules details read the [Configuration Document](./CONFIGURATION.md).
|
|
47
41
|
*/
|
|
48
|
-
export interface Libp2pInit {
|
|
42
|
+
export interface Libp2pInit<T extends ServiceMap = {}> {
|
|
49
43
|
/**
|
|
50
44
|
* peerId instance (it will be created if not provided)
|
|
51
45
|
*/
|
|
@@ -75,7 +69,7 @@ export interface Libp2pInit {
|
|
|
75
69
|
/**
|
|
76
70
|
* libp2p PeerStore configuration
|
|
77
71
|
*/
|
|
78
|
-
peerStore:
|
|
72
|
+
peerStore: PersistentPeerStoreInit;
|
|
79
73
|
/**
|
|
80
74
|
* libp2p Peer routing service configuration
|
|
81
75
|
*/
|
|
@@ -84,31 +78,6 @@ export interface Libp2pInit {
|
|
|
84
78
|
* keychain configuration
|
|
85
79
|
*/
|
|
86
80
|
keychain: KeyChainInit;
|
|
87
|
-
/**
|
|
88
|
-
* The NAT manager controls uPNP hole punching
|
|
89
|
-
*/
|
|
90
|
-
nat: NatManagerInit;
|
|
91
|
-
/**
|
|
92
|
-
* If configured as a relay this node will relay certain
|
|
93
|
-
* types of traffic for other peers
|
|
94
|
-
*/
|
|
95
|
-
relay: (components: Components) => CircuitRelayService;
|
|
96
|
-
/**
|
|
97
|
-
* identify protocol options
|
|
98
|
-
*/
|
|
99
|
-
identify: IdentifyServiceInit;
|
|
100
|
-
/**
|
|
101
|
-
* ping protocol options
|
|
102
|
-
*/
|
|
103
|
-
ping: PingServiceInit;
|
|
104
|
-
/**
|
|
105
|
-
* fetch protocol options
|
|
106
|
-
*/
|
|
107
|
-
fetch: FetchServiceInit;
|
|
108
|
-
/**
|
|
109
|
-
* autonat protocol options
|
|
110
|
-
*/
|
|
111
|
-
autonat: AutonatServiceInit;
|
|
112
81
|
/**
|
|
113
82
|
* An array that must include at least 1 compliant transport
|
|
114
83
|
*/
|
|
@@ -118,41 +87,21 @@ export interface Libp2pInit {
|
|
|
118
87
|
peerDiscovery?: Array<(components: Components) => PeerDiscovery>;
|
|
119
88
|
peerRouters?: Array<(components: Components) => PeerRouting>;
|
|
120
89
|
contentRouters?: Array<(components: Components) => ContentRouting>;
|
|
121
|
-
/**
|
|
122
|
-
* Pass a DHT implementation to enable DHT operations
|
|
123
|
-
*/
|
|
124
|
-
dht?: (components: Components) => DualDHT;
|
|
125
90
|
/**
|
|
126
91
|
* A Metrics implementation can be supplied to collect metrics on this node
|
|
127
92
|
*/
|
|
128
93
|
metrics?: (components: Components) => Metrics;
|
|
129
|
-
/**
|
|
130
|
-
* If a PubSub implmentation is supplied, PubSub operations will become available
|
|
131
|
-
*/
|
|
132
|
-
pubsub?: (components: Components) => PubSub;
|
|
133
94
|
/**
|
|
134
95
|
* A ConnectionProtector can be used to create a secure overlay on top of the network using pre-shared keys
|
|
135
96
|
*/
|
|
136
97
|
connectionProtector?: (components: Components) => ConnectionProtector;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Once you have a libp2p instance, you can listen to several events it emits, so that you can be notified of relevant network events.
|
|
140
|
-
*/
|
|
141
|
-
export interface Libp2pEvents {
|
|
142
98
|
/**
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
* ```js
|
|
146
|
-
* libp2p.addEventListener('peer:discovery', (event) => {
|
|
147
|
-
* const peerInfo = event.detail
|
|
148
|
-
* // ...
|
|
149
|
-
* })
|
|
150
|
-
* ```
|
|
99
|
+
* Arbitrary libp2p modules
|
|
151
100
|
*/
|
|
152
|
-
|
|
101
|
+
services: ServiceFactoryMap<T>;
|
|
153
102
|
}
|
|
154
103
|
export type { Libp2p };
|
|
155
|
-
export type Libp2pOptions = RecursivePartial<Libp2pInit
|
|
104
|
+
export type Libp2pOptions<T extends ServiceMap = {}> = RecursivePartial<Libp2pInit<T>> & {
|
|
156
105
|
start?: boolean;
|
|
157
106
|
};
|
|
158
107
|
/**
|
|
@@ -180,5 +129,5 @@ export type Libp2pOptions = RecursivePartial<Libp2pInit> & {
|
|
|
180
129
|
* const libp2p = await createLibp2p(options)
|
|
181
130
|
* ```
|
|
182
131
|
*/
|
|
183
|
-
export declare function createLibp2p(options: Libp2pOptions): Promise<Libp2p
|
|
132
|
+
export declare function createLibp2p<T extends ServiceMap = {}>(options: Libp2pOptions<T>): Promise<Libp2p<T>>;
|
|
184
133
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAA;AAClE,OAAO,KAAK,EAAE,SAAS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,CAAC,CAAA;CAC/B;AAED,YAAY,EAAE,MAAM,EAAE,CAAA;AAEtB,MAAM,MAAM,aAAa,CAAC,CAAC,SAAS,UAAU,GAAG,EAAE,IAAI,gBAAgB,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,CAAA;AAE5G;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAsB,YAAY,CAAE,CAAC,SAAS,UAAU,GAAG,EAAE,EAAG,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAQ7G"}
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAA;AA2G9C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAA8B,OAAyB;IACvF,MAAM,IAAI,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,CAAA;IAE5C,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,EAAE;QAC3B,MAAM,IAAI,CAAC,KAAK,EAAE,CAAA;KACnB;IAED,OAAO,IAAI,CAAA;AACb,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/insecure/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AASH,OAAO,KAAK,EAAE,mBAAmB,EAAqB,MAAM,wCAAwC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/insecure/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AASH,OAAO,KAAK,EAAE,mBAAmB,EAAqB,MAAM,wCAAwC,CAAA;AAwGpG,wBAAgB,SAAS,IAAK,MAAM,mBAAmB,CAEtD"}
|
|
@@ -38,7 +38,6 @@ function lpEncodeExchange(exchange) {
|
|
|
38
38
|
* Encrypt connection
|
|
39
39
|
*/
|
|
40
40
|
async function encrypt(localId, conn, remoteId) {
|
|
41
|
-
// @ts-expect-error - remove after https://github.com/libp2p/js-libp2p/pull/1674
|
|
42
41
|
const shake = handshake(conn);
|
|
43
42
|
let type = KeyType.RSA;
|
|
44
43
|
if (localId.type === 'Ed25519') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/insecure/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,KAAK,EAAE,MAAM,oBAAoB,CAAA;AACxC,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,MAAM,+CAA+C,CAAA;AAC/G,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEjD,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAA;AAGjE,OAAO,GAAG,MAAM,QAAQ,CAAA;AAGxB,MAAM,GAAG,GAAG,MAAM,CAAC,kBAAkB,CAAC,CAAA;AACtC,MAAM,QAAQ,GAAG,kBAAkB,CAAA;AAEnC,SAAS,gBAAgB,CAAE,QAAkB;IAC3C,MAAM,EAAE,GAAG,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAA;IAEp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ortOptions } 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 {
|
|
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';
|
|
17
|
-
import type { Libp2p, Libp2pEvents, Libp2pInit, Libp2pOptions } from './index.js';
|
|
7
|
+
import type { StreamHandler, StreamHandlerOptions, Topology } from '@libp2p/interface-registrar';
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
peerId?: PeerId;
|
|
28
|
-
multiaddrs: Multiaddr[];
|
|
29
|
-
}
|
|
30
|
-
export declare class Libp2pNode extends EventEmitter<Libp2pEvents> implements Libp2p {
|
|
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;
|
|
31
17
|
peerId: PeerId;
|
|
32
|
-
dht: DualDHT;
|
|
33
|
-
pubsub: PubSub;
|
|
34
|
-
identifyService: IdentifyService;
|
|
35
|
-
circuitService?: CircuitRelayService;
|
|
36
|
-
fetchService: FetchService;
|
|
37
|
-
pingService: PingService;
|
|
38
|
-
autonatService: AutonatService;
|
|
39
|
-
components: Components;
|
|
40
18
|
peerStore: PeerStore;
|
|
41
19
|
contentRouting: ContentRouting;
|
|
42
20
|
peerRouting: PeerRouting;
|
|
43
21
|
keychain: KeyChain;
|
|
44
|
-
connectionManager: ConnectionManager;
|
|
45
|
-
registrar: Registrar;
|
|
46
22
|
metrics?: Metrics;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
constructor(init: Libp2pInit);
|
|
23
|
+
services: T;
|
|
24
|
+
components: Components;
|
|
25
|
+
constructor(init: Libp2pInit<T>);
|
|
50
26
|
private configureComponent;
|
|
51
27
|
/**
|
|
52
28
|
* Starts the libp2p node and all its subsystems
|
|
@@ -69,21 +45,14 @@ export declare class Libp2pNode extends EventEmitter<Libp2pEvents> implements Li
|
|
|
69
45
|
* Get the public key for the given peer id
|
|
70
46
|
*/
|
|
71
47
|
getPublicKey(peer: PeerId, options?: AbortOptions): Promise<Uint8Array>;
|
|
72
|
-
fetch(peer: PeerId | Multiaddr, key: string, options?: AbortOptions): Promise<Uint8Array | null>;
|
|
73
|
-
ping(peer: PeerId | Multiaddr, options?: AbortOptions): Promise<number>;
|
|
74
48
|
handle(protocols: string | string[], handler: StreamHandler, options?: StreamHandlerOptions): Promise<void>;
|
|
75
49
|
unhandle(protocols: string[] | string): Promise<void>;
|
|
76
50
|
register(protocol: string, topology: Topology): Promise<string>;
|
|
77
51
|
unregister(id: string): void;
|
|
78
|
-
/**
|
|
79
|
-
* Called whenever peer discovery services emit `peer` events and adds peers
|
|
80
|
-
* to the peer store.
|
|
81
|
-
*/
|
|
82
|
-
onDiscoveryPeer(evt: CustomEvent<PeerInfo>): void;
|
|
83
52
|
}
|
|
84
53
|
/**
|
|
85
54
|
* Returns a new Libp2pNode instance - this exposes more of the internals than the
|
|
86
55
|
* libp2p interface and is useful for testing and debugging.
|
|
87
56
|
*/
|
|
88
|
-
export declare function createLibp2pNode(options: Libp2pOptions): Promise<Libp2pNode
|
|
57
|
+
export declare function createLibp2pNode<T extends ServiceMap = {}>(options: Libp2pOptions<T>): Promise<Libp2pNode<T>>;
|
|
89
58
|
//# sourceMappingURL=libp2p.d.ts.map
|
package/dist/src/libp2p.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"libp2p.d.ts","sourceRoot":"","sources":["../../src/libp2p.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAe,MAAM,2BAA2B,CAAA;
|
|
1
|
+
{"version":3,"file":"libp2p.d.ts","sourceRoot":"","sources":["../../src/libp2p.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AACtD,OAAO,EAAE,YAAY,EAAe,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAe,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAahE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAA;AACtE,OAAO,KAAK,EAAE,aAAa,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAEhG,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,aAAa,EAA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