libp2p 0.35.7 → 0.35.8-9b22c6e
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 +55 -0
- package/dist/src/circuit/auto-relay.d.ts +8 -10
- package/dist/src/circuit/auto-relay.d.ts.map +1 -1
- package/dist/src/connection-manager/auto-dialler.d.ts +1 -1
- package/dist/src/connection-manager/auto-dialler.d.ts.map +1 -1
- package/dist/src/connection-manager/index.d.ts +1 -2
- package/dist/src/connection-manager/index.d.ts.map +1 -1
- package/dist/src/content-routing/utils.d.ts +3 -3
- package/dist/src/content-routing/utils.d.ts.map +1 -1
- package/dist/src/dht/dht-peer-routing.d.ts.map +1 -1
- package/dist/src/dialer/dial-request.d.ts.map +1 -1
- package/dist/src/dialer/index.d.ts +5 -5
- package/dist/src/dialer/index.d.ts.map +1 -1
- package/dist/src/fetch/constants.d.ts +2 -0
- package/dist/src/fetch/constants.d.ts.map +1 -0
- package/dist/src/fetch/index.d.ts +76 -0
- package/dist/src/fetch/index.d.ts.map +1 -0
- package/dist/src/fetch/proto.d.ts +134 -0
- package/dist/src/identify/index.d.ts +4 -4
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +16 -6
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/metrics/index.d.ts +9 -4
- package/dist/src/metrics/index.d.ts.map +1 -1
- package/dist/src/metrics/tracked-map.d.ts +6 -1
- package/dist/src/metrics/tracked-map.d.ts.map +1 -1
- package/dist/src/peer-routing.d.ts +1 -1
- package/dist/src/peer-routing.d.ts.map +1 -1
- package/dist/src/peer-store/address-book.d.ts +28 -84
- package/dist/src/peer-store/address-book.d.ts.map +1 -1
- package/dist/src/peer-store/index.d.ts +25 -94
- package/dist/src/peer-store/index.d.ts.map +1 -1
- package/dist/src/peer-store/key-book.d.ts +31 -15
- package/dist/src/peer-store/key-book.d.ts.map +1 -1
- package/dist/src/peer-store/metadata-book.d.ts +33 -29
- package/dist/src/peer-store/metadata-book.d.ts.map +1 -1
- package/dist/src/peer-store/pb/peer.d.ts +222 -0
- package/dist/src/peer-store/proto-book.d.ts +27 -28
- package/dist/src/peer-store/proto-book.d.ts.map +1 -1
- package/dist/src/peer-store/store.d.ts +73 -0
- package/dist/src/peer-store/store.d.ts.map +1 -0
- package/dist/src/peer-store/types.d.ts +202 -0
- package/dist/src/peer-store/types.d.ts.map +1 -0
- package/dist/src/ping/index.d.ts.map +1 -1
- package/dist/src/record/peer-record/index.d.ts +2 -2
- package/dist/src/record/peer-record/index.d.ts.map +1 -1
- package/dist/src/registrar.d.ts +5 -5
- package/dist/src/registrar.d.ts.map +1 -1
- package/dist/src/upgrader.d.ts.map +1 -1
- package/package.json +24 -28
- package/src/circuit/auto-relay.js +52 -38
- package/src/connection-manager/auto-dialler.js +23 -9
- package/src/connection-manager/index.js +42 -22
- package/src/content-routing/utils.js +4 -4
- package/src/dht/dht-peer-routing.js +2 -6
- package/src/dialer/dial-request.js +4 -1
- package/src/dialer/index.js +22 -10
- package/src/fetch/README.md +36 -0
- package/src/fetch/constants.js +6 -0
- package/src/fetch/index.js +159 -0
- package/src/fetch/proto.d.ts +134 -0
- package/src/fetch/proto.js +333 -0
- package/src/fetch/proto.proto +15 -0
- package/src/identify/index.js +47 -38
- package/src/index.js +53 -27
- package/src/metrics/index.js +15 -8
- package/src/metrics/tracked-map.js +45 -13
- package/src/peer-routing.js +4 -1
- package/src/peer-store/address-book.js +242 -227
- package/src/peer-store/index.js +77 -110
- package/src/peer-store/key-book.js +99 -54
- package/src/peer-store/metadata-book.js +171 -101
- package/src/peer-store/pb/peer.d.ts +222 -0
- package/src/peer-store/pb/peer.js +643 -0
- package/src/peer-store/pb/peer.proto +31 -0
- package/src/peer-store/proto-book.js +171 -105
- package/src/peer-store/store.js +250 -0
- package/src/peer-store/types.ts +245 -0
- package/src/ping/index.js +6 -0
- package/src/record/peer-record/index.js +1 -1
- package/src/record/utils.js +1 -1
- package/src/registrar.js +4 -4
- package/src/upgrader.js +3 -2
- package/dist/src/peer-store/book.d.ts +0 -81
- package/dist/src/peer-store/book.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/consts.d.ts +0 -6
- package/dist/src/peer-store/persistent/consts.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/index.d.ts +0 -129
- package/dist/src/peer-store/persistent/index.d.ts.map +0 -1
- package/dist/src/peer-store/persistent/pb/address-book.d.ts +0 -198
- package/dist/src/peer-store/persistent/pb/proto-book.d.ts +0 -59
- package/src/peer-store/book.js +0 -124
- package/src/peer-store/persistent/consts.js +0 -15
- package/src/peer-store/persistent/index.js +0 -408
- package/src/peer-store/persistent/pb/address-book.d.ts +0 -198
- package/src/peer-store/persistent/pb/address-book.js +0 -522
- package/src/peer-store/persistent/pb/address-book.proto +0 -27
- package/src/peer-store/persistent/pb/proto-book.d.ts +0 -59
- package/src/peer-store/persistent/pb/proto-book.js +0 -157
- package/src/peer-store/persistent/pb/proto-book.proto +0 -5
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export = AutoRelay;
|
|
2
2
|
/**
|
|
3
3
|
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
|
|
4
|
-
* @typedef {import('../peer-store/
|
|
4
|
+
* @typedef {import('../peer-store/types').Address} Address
|
|
5
|
+
* @typedef {import('peer-id')} PeerId
|
|
5
6
|
*/
|
|
6
7
|
/**
|
|
7
8
|
* @typedef {Object} AutoRelayProperties
|
|
@@ -20,11 +21,11 @@ declare class AutoRelay {
|
|
|
20
21
|
*/
|
|
21
22
|
constructor({ libp2p, maxListeners, onError }: AutoRelayProperties & AutoRelayOptions);
|
|
22
23
|
_libp2p: import("../");
|
|
23
|
-
_peerId:
|
|
24
|
-
_peerStore: import("../peer-store");
|
|
24
|
+
_peerId: import("peer-id");
|
|
25
|
+
_peerStore: import("../peer-store/types").PeerStore;
|
|
25
26
|
_connectionManager: import("../connection-manager");
|
|
26
27
|
_transportManager: import("../transport-manager");
|
|
27
|
-
_addressSorter: (addresses: import("../peer-store/
|
|
28
|
+
_addressSorter: (addresses: import("../peer-store/types").Address[]) => import("../peer-store/types").Address[];
|
|
28
29
|
maxListeners: number;
|
|
29
30
|
/**
|
|
30
31
|
* @type {Set<string>}
|
|
@@ -49,7 +50,6 @@ declare class AutoRelay {
|
|
|
49
50
|
* Peer disconnects.
|
|
50
51
|
*
|
|
51
52
|
* @param {Connection} connection - connection to the peer
|
|
52
|
-
* @returns {void}
|
|
53
53
|
*/
|
|
54
54
|
_onPeerDisconnected(connection: Connection): void;
|
|
55
55
|
/**
|
|
@@ -71,7 +71,6 @@ declare class AutoRelay {
|
|
|
71
71
|
*
|
|
72
72
|
* @private
|
|
73
73
|
* @param {string} id - peer identifier string.
|
|
74
|
-
* @returns {void}
|
|
75
74
|
*/
|
|
76
75
|
private _removeListenRelay;
|
|
77
76
|
/**
|
|
@@ -82,7 +81,6 @@ declare class AutoRelay {
|
|
|
82
81
|
* 3. Search the network.
|
|
83
82
|
*
|
|
84
83
|
* @param {string[]} [peersToIgnore]
|
|
85
|
-
* @returns {Promise<void>}
|
|
86
84
|
*/
|
|
87
85
|
_listenOnAvailableHopRelays(peersToIgnore?: string[] | undefined): Promise<void>;
|
|
88
86
|
/**
|
|
@@ -91,9 +89,9 @@ declare class AutoRelay {
|
|
|
91
89
|
_tryToListenOnRelay(peerId: PeerId): Promise<void>;
|
|
92
90
|
}
|
|
93
91
|
declare namespace AutoRelay {
|
|
94
|
-
export { Connection, Address, AutoRelayProperties, AutoRelayOptions };
|
|
92
|
+
export { Connection, Address, PeerId, AutoRelayProperties, AutoRelayOptions };
|
|
95
93
|
}
|
|
96
|
-
|
|
94
|
+
type PeerId = import('peer-id');
|
|
97
95
|
type Connection = import("libp2p-interfaces/src/connection/connection");
|
|
98
96
|
type AutoRelayProperties = {
|
|
99
97
|
libp2p: import('../');
|
|
@@ -105,5 +103,5 @@ type AutoRelayOptions = {
|
|
|
105
103
|
maxListeners?: number | undefined;
|
|
106
104
|
onError?: ((error: Error, msg?: string | undefined) => {}) | undefined;
|
|
107
105
|
};
|
|
108
|
-
type Address = import('../peer-store/
|
|
106
|
+
type Address = import('../peer-store/types').Address;
|
|
109
107
|
//# sourceMappingURL=auto-relay.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-relay.d.ts","sourceRoot":"","sources":["../../../src/circuit/auto-relay.js"],"names":[],"mappings":";AAsBA
|
|
1
|
+
{"version":3,"file":"auto-relay.d.ts","sourceRoot":"","sources":["../../../src/circuit/auto-relay.js"],"names":[],"mappings":";AAsBA;;;;GAIG;AAEH;;;;;;;GAOG;AAEH;IACE;;;;;OAKG;IACH,+CAFW,mBAAmB,GAAG,gBAAgB,EA+BhD;IA5BC,uBAAqB;IACrB,2BAA4B;IAC5B,oDAAkC;IAClC,oDAAkD;IAClD,kDAAgD;IAChD,gHAAiD;IAEjD,qBAAgC;IAEhC;;OAEG;IACH,eAFU,IAAI,MAAM,CAAC,CAES;IAkBhC;;;;;;;;;;OAUG;IACH;QAJyB,MAAM,EAApB,MAAM;QACU,SAAS,EAAzB,MAAM,EAAE;QACN,QAAQ,IAAI,CAAC,CAsCzB;IAED;;;;OAIG;IACH,gCAFW,UAAU,QAcpB;IA5EC;;;OAGG;IACH,kBAHW,KAAK,oCAMf;IAuEH;;;;;;;OAOG;IACH,wBAkCC;IAED;;;;;OAKG;IACH,2BAKC;IAED;;;;;;;;OAQG;IACH,iFA6EC;IAED;;OAEG;IACH,4BAFW,MAAM,iBAShB;CACF;;;;cAlRY,OAAO,SAAS,CAAC;;;YAKhB,OAAO,KAAK,CAAC;;;;;;;uBAIL,KAAK,+BAAmB,EAAE;;eAVnC,OAAO,qBAAqB,EAAE,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-dialler.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/auto-dialler.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"auto-dialler.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/auto-dialler.js"],"names":[],"mappings":";AAqBA;;;GAGG;AAEH;;;;;GAKG;AAEH;IACE;;;;;;;;OAQG;IACH,oBAHW,MAAM,YACN,kBAAkB,EAU5B;IAPC,cAAqF;IACrF,4BAAqB;IACrB,kBAAqB;IACrB,sBAA4B;IAoC9B,2BA6CC;IA3ED;;OAEG;IACH,uBAWC;IAED;;OAEG;IACH,sBASC;CAgDF;;;;cA3GY,OAAO,UAAU,CAAC"}
|
|
@@ -97,9 +97,8 @@ declare class ConnectionManager extends EventEmitter {
|
|
|
97
97
|
* Tracks the incoming connection and check the connection limit
|
|
98
98
|
*
|
|
99
99
|
* @param {Connection} connection
|
|
100
|
-
* @returns {void}
|
|
101
100
|
*/
|
|
102
|
-
onConnect(connection: Connection): void
|
|
101
|
+
onConnect(connection: Connection): Promise<void>;
|
|
103
102
|
/**
|
|
104
103
|
* Removes the connection from tracking
|
|
105
104
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/index.js"],"names":[],"mappings":";AAsCA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,oBAHW,MAAM,YACN,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/connection-manager/index.js"],"names":[],"mappings":";AAsCA;;;GAGG;AAEH;;;;;;;;;;;;;GAaG;AAEH;;;;GAIG;AACH;IACE;;;;;;OAMG;IACH,oBAHW,MAAM,YACN,wBAAwB,EAgDlC;IA3CC,uBAAqB;IACrB,gBAA0C;IAE1C,cAAqF;IAOrF;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,MAAM,CAAC,CAM3B;IAEF;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC,CAMjC;IAEF,kBAAqB;IACrB,YAAkB;IAuFpB;;;;;OAKG;IACH,sBAiBC;IA3GC,gCAGE;IAMJ;;OAEG;IACH,mBAGC;IAED;;;OAGG;IACH,cAYC;IAgKD;;;;;OAKG;IACH,0BAKC;IAzKD;;;;OAIG;IACH,sBASC;IAED;;;;OAIG;IACH,wBAWC;IAED;;;;;;;OAOG;IACH,qBAJW,MAAM,SACN,MAAM,GACJ,IAAI,CAOhB;IA2BD;;;;OAIG;IACH,sBAFW,UAAU,iBAsBpB;IAED;;;;;OAKG;IACH,yBAHW,UAAU,GACR,IAAI,CAgBhB;IAED;;;;;OAKG;IACH,YAHW,MAAM,GACJ,UAAU,GAAC,IAAI,CAQ3B;IAED;;;;;OAKG;IACH,eAHW,MAAM,GACJ,UAAU,EAAE,CAexB;IAeD;;;;;;OAMG;IACH,uBAOC;IAED;;;;;OAKG;IACH,4BAqBC;CACF;;;;;;;;cAjUY,OAAO,KAAK,CAAC"}
|
|
@@ -8,15 +8,15 @@ export type Multiaddr = import('multiaddr').Multiaddr;
|
|
|
8
8
|
* Store the multiaddrs from every peer in the passed peer store
|
|
9
9
|
*
|
|
10
10
|
* @param {AsyncIterable<{ id: PeerId, multiaddrs: Multiaddr[] }>} source
|
|
11
|
-
* @param {import('../peer-store')} peerStore
|
|
11
|
+
* @param {import('../peer-store/types').PeerStore} peerStore
|
|
12
12
|
*/
|
|
13
13
|
export function storeAddresses(source: AsyncIterable<{
|
|
14
14
|
id: PeerId;
|
|
15
15
|
multiaddrs: Multiaddr[];
|
|
16
|
-
}>, peerStore: import('../peer-store')):
|
|
16
|
+
}>, peerStore: import('../peer-store/types').PeerStore): AsyncGenerator<{
|
|
17
17
|
id: PeerId;
|
|
18
18
|
multiaddrs: Multiaddr[];
|
|
19
|
-
}>;
|
|
19
|
+
}, void, undefined>;
|
|
20
20
|
/**
|
|
21
21
|
* Filter peers by unique peer id
|
|
22
22
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/content-routing/utils.js"],"names":[],"mappings":"qBAQa,OAAO,SAAS,CAAC;wBACjB,OAAO,WAAW,EAAE,SAAS;AAF1C;;;GAGG;AAEH;;;;;GAKG;AACH,uCAHW,cAAc;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC,aACtD,OAAO,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/content-routing/utils.js"],"names":[],"mappings":"qBAQa,OAAO,SAAS,CAAC;wBACjB,OAAO,WAAW,EAAE,SAAS;AAF1C;;;GAGG;AAEH;;;;;GAKG;AACH,uCAHW,cAAc;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC,aACtD,OAAO,qBAAqB,EAAE,SAAS;QADnB,MAAM;gBAAc,SAAS,EAAE;oBAU7D;AAED;;;;GAIG;AACH,oCAFW,cAAc;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC;QAAlC,MAAM;gBAAc,SAAS,EAAE;kBAgB7D;AAED;;;;;GAKG;AACH,qCAHW,cAAc;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC,QACtD,MAAM;QADc,MAAM;gBAAc,SAAS,EAAE;kBAe7D;AAED;;;;;;GAMG;AACH,yCAHW,cAAc;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC;QAAlC,MAAM;gBAAc,SAAS,EAAE;GAS7D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dht-peer-routing.d.ts","sourceRoot":"","sources":["../../../src/dht/dht-peer-routing.js"],"names":[],"mappings":"qBAMa,OAAO,SAAS,CAAC;gCACjB,OAAO,0CAA0C,EAAE,WAAW;AAF3E;;;GAGG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,iBAFW,OAAO,gBAAgB,EAAE,GAAG,EAItC;IADC,kDAAe;IAGjB;;;OAGG;IACH,iBAHW,MAAM,YACN,GAAG,
|
|
1
|
+
{"version":3,"file":"dht-peer-routing.d.ts","sourceRoot":"","sources":["../../../src/dht/dht-peer-routing.js"],"names":[],"mappings":"qBAMa,OAAO,SAAS,CAAC;gCACjB,OAAO,0CAA0C,EAAE,WAAW;AAF3E;;;GAGG;AAEH;;;;GAIG;AACH;IACE;;OAEG;IACH,iBAFW,OAAO,gBAAgB,EAAE,GAAG,EAItC;IADC,kDAAe;IAGjB;;;OAGG;IACH,iBAHW,MAAM,YACN,GAAG,6DAUb;IAED;;;OAGG;IACH,qBAHW,UAAU,YACV,GAAG,qFAQb;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dial-request.d.ts","sourceRoot":"","sources":["../../../src/dialer/dial-request.js"],"names":[],"mappings":";AAWA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;IACE;;;;;;;;;OASG;IACH,2CAFW,kBAAkB,EAU5B;IAHC,uCAAkB;IAClB,qBAAoB;IACpB,gBAtBc,SAAS,WAAW,WAAW,KAAK,QAAQ,UAAU,CAAC,CAsBzC;IAG9B;;;;;OAKG;IACH;;oBAFa,QAAQ,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"dial-request.d.ts","sourceRoot":"","sources":["../../../src/dialer/dial-request.js"],"names":[],"mappings":";AAWA;;;;GAIG;AAEH;;;;;;;;GAQG;AAEH;IACE;;;;;;;;;OASG;IACH,2CAFW,kBAAkB,EAU5B;IAHC,uCAAkB;IAClB,qBAAoB;IACpB,gBAtBc,SAAS,WAAW,WAAW,KAAK,QAAQ,UAAU,CAAC,CAsBzC;IAG9B;;;;;OAKG;IACH;;oBAFa,QAAQ,UAAU,CAAC,CA+C/B;CACF;;;;;;WA9Ea,SAAS,EAAE;oBACP,SAAS,WAAW,WAAW,KAAK,QAAQ,UAAU,CAAC;YAC3D,MAAM;;cAXP,OAAO,IAAI,CAAC;iBACZ,OAAO,WAAW,EAAE,SAAS;;YAK5B,WAAW"}
|
|
@@ -2,8 +2,8 @@ export = Dialer;
|
|
|
2
2
|
/**
|
|
3
3
|
* @typedef {import('libp2p-interfaces/src/connection').Connection} Connection
|
|
4
4
|
* @typedef {import('peer-id')} PeerId
|
|
5
|
-
* @typedef {import('../peer-store')} PeerStore
|
|
6
|
-
* @typedef {import('../peer-store/
|
|
5
|
+
* @typedef {import('../peer-store/types').PeerStore} PeerStore
|
|
6
|
+
* @typedef {import('../peer-store/types').Address} Address
|
|
7
7
|
* @typedef {import('../transport-manager')} TransportManager
|
|
8
8
|
*/
|
|
9
9
|
/**
|
|
@@ -39,7 +39,7 @@ declare class Dialer {
|
|
|
39
39
|
*/
|
|
40
40
|
constructor({ transportManager, peerStore, addressSorter, maxParallelDials, maxAddrsToDial, dialTimeout, maxDialsPerPeer, resolvers, metrics }: DialerProperties & DialerOptions);
|
|
41
41
|
transportManager: import("../transport-manager");
|
|
42
|
-
peerStore: import("../peer-store");
|
|
42
|
+
peerStore: import("../peer-store/types").PeerStore;
|
|
43
43
|
addressSorter: (addresses: Address[]) => Address[];
|
|
44
44
|
maxParallelDials: number;
|
|
45
45
|
maxAddrsToDial: number;
|
|
@@ -170,8 +170,8 @@ type DialerOptions = {
|
|
|
170
170
|
resolvers?: Record<string, Resolver> | undefined;
|
|
171
171
|
metrics?: import("../metrics") | undefined;
|
|
172
172
|
};
|
|
173
|
-
type PeerStore = import('../peer-store');
|
|
174
|
-
type Address = import('../peer-store/
|
|
173
|
+
type PeerStore = import('../peer-store/types').PeerStore;
|
|
174
|
+
type Address = import('../peer-store/types').Address;
|
|
175
175
|
type TransportManager = import('../transport-manager');
|
|
176
176
|
type Resolver = (addr: Multiaddr) => Promise<string[]>;
|
|
177
177
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dialer/index.js"],"names":[],"mappings":";AA6BA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;IACE;;;OAGG;IACH,gJAFW,gBAAgB,GAAG,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dialer/index.js"],"names":[],"mappings":";AA6BA;;;;;;GAMG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH;IACE;;;OAGG;IACH,gJAFW,gBAAgB,GAAG,aAAa,EAuC1C;IA1BC,iDAAwC;IACxC,mDAA0B;IAC1B,2BArCsB,OAAO,EAAE,KAAK,OAAO,EAAE,CAqCX;IAClC,yBAAwC;IACxC,uBAAoC;IACpC,gBAA0B;IAC1B,wBAAsC;IACtC,iBAAuE;IAEvE,uCAAuC;IACvC,eADW,IAAI,MAAM,EAAE,WAAW,CAAC,CAKjC;IAEF,0FAA0F;IAC1F;yBAD0C,GAAG,KAAK,IAAI;sBAAgB,KAAK,KAAK,IAAI;OAKlF;IAOJ;;OAEG;IACH,gBAcC;IAED;;;;;;;;;OASG;IACH,oBALW,MAAM,GAAC,SAAS,GAAC,MAAM;;oBAGrB,QAAQ,UAAU,CAAC,CAwB/B;IAED;;;;;;;OAOG;IACH,mCAHW,MAAM,GAAC,SAAS,GAAC,MAAM,GACrB,QAAQ,UAAU,CAAC,CAmB/B;IAED;;;;;;;;;OASG;IACH,0BAmCC;IAED;;;;;;;;OAQG;IACH,2BA0CC;IAED;;OAEG;IACH,eAFW,MAAM,YAOhB;IAED;;OAEG;IACH,oBAFW,MAAM,QAOhB;IAED;;;;;OAKG;IACH,aAHW,SAAS,GACP,QAAQ,SAAS,EAAE,CAAC,CAwBhC;IAED;;;;;OAKG;IACH,mBAHW,SAAS,GACP,QAAQ,SAAS,EAAE,CAAC,CAWhC;CACF;;;;;iBAxSa,OAAO,gBAAgB,CAAC;gBACxB,OAAO,0BAA0B,EAAE,iBAAiB;aACpD,QAAQ,UAAU,CAAC;mBACR,IAAI;;cA9BhB,OAAO,SAAS,CAAC;;;;QAuBhB,MAAM;WACN,SAAS,EAAE;;;eAhBX,SAAS;sBACT,gBAAgB;;;;;;iCAKJ,OAAO,EAAE,KAAK,OAAO,EAAE;;;;;;;;;;;;;;;;;;;;;;;iBAbpC,OAAO,qBAAqB,EAAE,SAAS;eACvC,OAAO,qBAAqB,EAAE,OAAO;wBACrC,OAAO,sBAAsB,CAAC;uBAQxB,SAAS,KAAK,QAAQ,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/fetch/constants.js"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
export = FetchProtocol;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {import('../')} Libp2p
|
|
4
|
+
* @typedef {import('multiaddr').Multiaddr} Multiaddr
|
|
5
|
+
* @typedef {import('peer-id')} PeerId
|
|
6
|
+
* @typedef {import('libp2p-interfaces/src/stream-muxer/types').MuxedStream} MuxedStream
|
|
7
|
+
* @typedef {(key: string) => Promise<Uint8Array | null>} LookupFunction
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A simple libp2p protocol for requesting a value corresponding to a key from a peer.
|
|
11
|
+
* Developers can register one or more lookup function for retrieving the value corresponding to
|
|
12
|
+
* a given key. Each lookup function must act on a distinct part of the overall key space, defined
|
|
13
|
+
* by a fixed prefix that all keys that should be routed to that lookup function will start with.
|
|
14
|
+
*/
|
|
15
|
+
declare class FetchProtocol {
|
|
16
|
+
/**
|
|
17
|
+
* @param {Libp2p} libp2p
|
|
18
|
+
*/
|
|
19
|
+
constructor(libp2p: Libp2p);
|
|
20
|
+
_lookupFunctions: Map<any, any>;
|
|
21
|
+
_libp2p: import("../");
|
|
22
|
+
/**
|
|
23
|
+
* Invoked when a fetch request is received. Reads the request message off the given stream and
|
|
24
|
+
* responds based on looking up the key in the request via the lookup callback that corresponds
|
|
25
|
+
* to the key's prefix.
|
|
26
|
+
*
|
|
27
|
+
* @param {object} options
|
|
28
|
+
* @param {MuxedStream} options.stream
|
|
29
|
+
* @param {string} options.protocol
|
|
30
|
+
*/
|
|
31
|
+
handleMessage(options: {
|
|
32
|
+
stream: MuxedStream;
|
|
33
|
+
protocol: string;
|
|
34
|
+
}): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Sends a request to fetch the value associated with the given key from the given peer.
|
|
37
|
+
*
|
|
38
|
+
* @param {PeerId|Multiaddr} peer
|
|
39
|
+
* @param {string} key
|
|
40
|
+
* @returns {Promise<Uint8Array | null>}
|
|
41
|
+
*/
|
|
42
|
+
fetch(peer: PeerId | Multiaddr, key: string): Promise<Uint8Array | null>;
|
|
43
|
+
/**
|
|
44
|
+
* Given a key, finds the appropriate function for looking up its corresponding value, based on
|
|
45
|
+
* the key's prefix.
|
|
46
|
+
*
|
|
47
|
+
* @param {string} key
|
|
48
|
+
*/
|
|
49
|
+
_getLookupFunction(key: string): any;
|
|
50
|
+
/**
|
|
51
|
+
* Registers a new lookup callback that can map keys to values, for a given set of keys that
|
|
52
|
+
* share the same prefix.
|
|
53
|
+
*
|
|
54
|
+
* @param {string} prefix
|
|
55
|
+
* @param {LookupFunction} lookup
|
|
56
|
+
*/
|
|
57
|
+
registerLookupFunction(prefix: string, lookup: LookupFunction): void;
|
|
58
|
+
/**
|
|
59
|
+
* Registers a new lookup callback that can map keys to values, for a given set of keys that
|
|
60
|
+
* share the same prefix.
|
|
61
|
+
*
|
|
62
|
+
* @param {string} prefix
|
|
63
|
+
* @param {LookupFunction} [lookup]
|
|
64
|
+
*/
|
|
65
|
+
unregisterLookupFunction(prefix: string, lookup?: LookupFunction | undefined): void;
|
|
66
|
+
}
|
|
67
|
+
declare namespace FetchProtocol {
|
|
68
|
+
export { PROTOCOL, Libp2p, Multiaddr, PeerId, MuxedStream, LookupFunction };
|
|
69
|
+
}
|
|
70
|
+
type MuxedStream = import('libp2p-interfaces/src/stream-muxer/types').MuxedStream;
|
|
71
|
+
type PeerId = import('peer-id');
|
|
72
|
+
type Multiaddr = import('multiaddr').Multiaddr;
|
|
73
|
+
type LookupFunction = (key: string) => Promise<Uint8Array | null>;
|
|
74
|
+
type Libp2p = import('../');
|
|
75
|
+
import { PROTOCOL } from "./constants";
|
|
76
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/fetch/index.js"],"names":[],"mappings":";AAcA;;;;;;GAMG;AAEH;;;;;GAKG;AACH;IACE;;OAEG;IACH,oBAFW,MAAM,EAMhB;IAHC,gCAAiC;IACjC,uBAAqB;IA0CvB;;;;;;;;OAQG;IACH;QAHgC,MAAM,EAA3B,WAAW;QACK,QAAQ,EAAxB,MAAM;sBAsBhB;IAnED;;;;;;OAMG;IACH,YAJW,MAAM,GAAC,SAAS,OAChB,MAAM,GACJ,QAAQ,UAAU,GAAG,IAAI,CAAC,CA+BtC;IAiCD;;;;;OAKG;IACH,wBAFW,MAAM,OAShB;IAED;;;;;;OAMG;IACH,+BAHW,MAAM,gCAQhB;IAED;;;;;;OAMG;IACH,iCAHW,MAAM,6CAahB;CACF;;;;mBAxIY,OAAO,0CAA0C,EAAE,WAAW;cAD9D,OAAO,SAAS,CAAC;iBADjB,OAAO,WAAW,EAAE,SAAS;4BAGvB,MAAM,KAAK,QAAQ,UAAU,GAAG,IAAI,CAAC;cAJ3C,OAAO,KAAK,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import * as $protobuf from "protobufjs";
|
|
2
|
+
/** Properties of a FetchRequest. */
|
|
3
|
+
export interface IFetchRequest {
|
|
4
|
+
|
|
5
|
+
/** FetchRequest identifier */
|
|
6
|
+
identifier?: (string|null);
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Represents a FetchRequest. */
|
|
10
|
+
export class FetchRequest implements IFetchRequest {
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Constructs a new FetchRequest.
|
|
14
|
+
* @param [p] Properties to set
|
|
15
|
+
*/
|
|
16
|
+
constructor(p?: IFetchRequest);
|
|
17
|
+
|
|
18
|
+
/** FetchRequest identifier. */
|
|
19
|
+
public identifier: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Encodes the specified FetchRequest message. Does not implicitly {@link FetchRequest.verify|verify} messages.
|
|
23
|
+
* @param m FetchRequest message or plain object to encode
|
|
24
|
+
* @param [w] Writer to encode to
|
|
25
|
+
* @returns Writer
|
|
26
|
+
*/
|
|
27
|
+
public static encode(m: IFetchRequest, w?: $protobuf.Writer): $protobuf.Writer;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Decodes a FetchRequest message from the specified reader or buffer.
|
|
31
|
+
* @param r Reader or buffer to decode from
|
|
32
|
+
* @param [l] Message length if known beforehand
|
|
33
|
+
* @returns FetchRequest
|
|
34
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
35
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
36
|
+
*/
|
|
37
|
+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): FetchRequest;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Creates a FetchRequest message from a plain object. Also converts values to their respective internal types.
|
|
41
|
+
* @param d Plain object
|
|
42
|
+
* @returns FetchRequest
|
|
43
|
+
*/
|
|
44
|
+
public static fromObject(d: { [k: string]: any }): FetchRequest;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Creates a plain object from a FetchRequest message. Also converts values to other types if specified.
|
|
48
|
+
* @param m FetchRequest
|
|
49
|
+
* @param [o] Conversion options
|
|
50
|
+
* @returns Plain object
|
|
51
|
+
*/
|
|
52
|
+
public static toObject(m: FetchRequest, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Converts this FetchRequest to JSON.
|
|
56
|
+
* @returns JSON object
|
|
57
|
+
*/
|
|
58
|
+
public toJSON(): { [k: string]: any };
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/** Properties of a FetchResponse. */
|
|
62
|
+
export interface IFetchResponse {
|
|
63
|
+
|
|
64
|
+
/** FetchResponse status */
|
|
65
|
+
status?: (FetchResponse.StatusCode|null);
|
|
66
|
+
|
|
67
|
+
/** FetchResponse data */
|
|
68
|
+
data?: (Uint8Array|null);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/** Represents a FetchResponse. */
|
|
72
|
+
export class FetchResponse implements IFetchResponse {
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Constructs a new FetchResponse.
|
|
76
|
+
* @param [p] Properties to set
|
|
77
|
+
*/
|
|
78
|
+
constructor(p?: IFetchResponse);
|
|
79
|
+
|
|
80
|
+
/** FetchResponse status. */
|
|
81
|
+
public status: FetchResponse.StatusCode;
|
|
82
|
+
|
|
83
|
+
/** FetchResponse data. */
|
|
84
|
+
public data: Uint8Array;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Encodes the specified FetchResponse message. Does not implicitly {@link FetchResponse.verify|verify} messages.
|
|
88
|
+
* @param m FetchResponse message or plain object to encode
|
|
89
|
+
* @param [w] Writer to encode to
|
|
90
|
+
* @returns Writer
|
|
91
|
+
*/
|
|
92
|
+
public static encode(m: IFetchResponse, w?: $protobuf.Writer): $protobuf.Writer;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Decodes a FetchResponse message from the specified reader or buffer.
|
|
96
|
+
* @param r Reader or buffer to decode from
|
|
97
|
+
* @param [l] Message length if known beforehand
|
|
98
|
+
* @returns FetchResponse
|
|
99
|
+
* @throws {Error} If the payload is not a reader or valid buffer
|
|
100
|
+
* @throws {$protobuf.util.ProtocolError} If required fields are missing
|
|
101
|
+
*/
|
|
102
|
+
public static decode(r: ($protobuf.Reader|Uint8Array), l?: number): FetchResponse;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Creates a FetchResponse message from a plain object. Also converts values to their respective internal types.
|
|
106
|
+
* @param d Plain object
|
|
107
|
+
* @returns FetchResponse
|
|
108
|
+
*/
|
|
109
|
+
public static fromObject(d: { [k: string]: any }): FetchResponse;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Creates a plain object from a FetchResponse message. Also converts values to other types if specified.
|
|
113
|
+
* @param m FetchResponse
|
|
114
|
+
* @param [o] Conversion options
|
|
115
|
+
* @returns Plain object
|
|
116
|
+
*/
|
|
117
|
+
public static toObject(m: FetchResponse, o?: $protobuf.IConversionOptions): { [k: string]: any };
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Converts this FetchResponse to JSON.
|
|
121
|
+
* @returns JSON object
|
|
122
|
+
*/
|
|
123
|
+
public toJSON(): { [k: string]: any };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export namespace FetchResponse {
|
|
127
|
+
|
|
128
|
+
/** StatusCode enum. */
|
|
129
|
+
enum StatusCode {
|
|
130
|
+
OK = 0,
|
|
131
|
+
NOT_FOUND = 1,
|
|
132
|
+
ERROR = 2
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -31,7 +31,7 @@ declare class IdentifyService {
|
|
|
31
31
|
libp2p: import('../');
|
|
32
32
|
});
|
|
33
33
|
_libp2p: import("../");
|
|
34
|
-
peerStore: import("../peer-store");
|
|
34
|
+
peerStore: import("../peer-store/types").PeerStore;
|
|
35
35
|
addressManager: import("../address-manager");
|
|
36
36
|
connectionManager: import("../connection-manager");
|
|
37
37
|
peerId: PeerId;
|
|
@@ -55,6 +55,8 @@ declare class IdentifyService {
|
|
|
55
55
|
agentVersion: string;
|
|
56
56
|
protocolVersion: string;
|
|
57
57
|
};
|
|
58
|
+
start(): Promise<void>;
|
|
59
|
+
stop(): Promise<void>;
|
|
58
60
|
/**
|
|
59
61
|
* Send an Identify Push update to the list of connections
|
|
60
62
|
*
|
|
@@ -64,10 +66,8 @@ declare class IdentifyService {
|
|
|
64
66
|
push(connections: Connection[]): Promise<void[]>;
|
|
65
67
|
/**
|
|
66
68
|
* Calls `push` for all peers in the `peerStore` that are connected
|
|
67
|
-
*
|
|
68
|
-
* @returns {void}
|
|
69
69
|
*/
|
|
70
|
-
pushToPeerStore(): void
|
|
70
|
+
pushToPeerStore(): Promise<void>;
|
|
71
71
|
/**
|
|
72
72
|
* Requests the `Identify` message from peer associated with the given `connection`.
|
|
73
73
|
* If the identified peer does not match the `PeerId` associated with the connection,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identify/index.js"],"names":[],"mappings":";AAkCA;;;GAGG;AAEH;;;GAGG;AAEH;IACE;;OAEG;IACH,8BAFW,OAAO,KAAK,CAAC;;;MAOvB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/identify/index.js"],"names":[],"mappings":";AAkCA;;;GAGG;AAEH;;;GAGG;AAEH;IACE;;OAEG;IACH,8BAFW,OAAO,KAAK,CAAC;;;MAOvB;IA2SD;;;;;OAKG;IACH,+BAHW,UAAU,GAAG,MAAM,GACjB,SAAS,GAAC,IAAI,CAW1B;IAxTD;;;;OAIG;IACH;QAFkC,MAAM,EAA7B,OAAO,KAAK,CAAC;OAuCvB;IApCC,uBAAqB;IACrB,mDAAiC;IACjC,6CAA2C;IAC3C,mDAAiD;IACjD,eAA2B;IA6K7B;;;;;;;;OAQG;IACH;oBALW,UAAU;gBACV,WAAW;kBACX,MAAM;QACJ,QAAQ,IAAI,CAAC,GAAC,SAAS,CAWnC;IA1LC,4BAA0D;IAC1D,gCAAkE;IAGlE;sBAjCU,MAAM;;MAoCf;IAsBH,uBAGC;IAED,sBAEC;IAED;;;;;OAKG;IACH,kBAHW,UAAU,EAAE,GACV,QAAQ,IAAI,EAAE,CAAC,CA4B3B;IAED;;OAEG;IACH,iCAeC;IAED;;;;;;;;OAQG;IACH,qBAHW,UAAU,GACR,QAAQ,IAAI,CAAC,CAmEzB;IAsBD;;;;;;;;;OASG;IACH,wBA6BC;IAED;;;;;;;;OAQG;IACH,oBA0CC;CAkBF;;;;;;;;;;;;mBA5UY,OAAO,0CAA0C,EAAE,WAAW;;kBAK7D,MAAM"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -75,7 +75,7 @@ export = Libp2p;
|
|
|
75
75
|
* @property {KeychainOptions & import('./keychain/index').KeychainOptions} [keychain]
|
|
76
76
|
* @property {MetricsOptions & import('./metrics').MetricsOptions} [metrics]
|
|
77
77
|
* @property {import('./peer-routing').PeerRoutingOptions} [peerRouting]
|
|
78
|
-
* @property {PeerStoreOptions
|
|
78
|
+
* @property {PeerStoreOptions} [peerStore]
|
|
79
79
|
* @property {import('./transport-manager').TransportManagerOptions} [transportManager]
|
|
80
80
|
* @property {Libp2pConfig} [config]
|
|
81
81
|
*
|
|
@@ -189,7 +189,8 @@ declare class Libp2p extends EventEmitter {
|
|
|
189
189
|
peerId: PeerId;
|
|
190
190
|
datastore: import("interface-datastore").Datastore | undefined;
|
|
191
191
|
metrics: Metrics | undefined;
|
|
192
|
-
|
|
192
|
+
/** @type {import('./peer-store/types').PeerStore} */
|
|
193
|
+
peerStore: import('./peer-store/types').PeerStore;
|
|
193
194
|
addresses: {
|
|
194
195
|
listen: never[];
|
|
195
196
|
announce: never[];
|
|
@@ -253,7 +254,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
253
254
|
* @param {string[]|string} protocols
|
|
254
255
|
* @param {(props: HandlerProps) => void} handler
|
|
255
256
|
*/
|
|
256
|
-
handle(protocols: string[] | string, handler: (props: HandlerProps) => void): void
|
|
257
|
+
handle(protocols: string[] | string, handler: (props: HandlerProps) => void): Promise<void>;
|
|
257
258
|
dialer: Dialer;
|
|
258
259
|
relay: Relay | undefined;
|
|
259
260
|
identifyService: IdentifyService | undefined;
|
|
@@ -270,6 +271,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
270
271
|
* @param {{ id: PeerId, multiaddrs: Multiaddr[], protocols: string[] }} peer
|
|
271
272
|
*/
|
|
272
273
|
private _onDiscoveryPeer;
|
|
274
|
+
fetchService: FetchService;
|
|
273
275
|
/**
|
|
274
276
|
* Starts the libp2p node and all its subsystems
|
|
275
277
|
*
|
|
@@ -354,6 +356,14 @@ declare class Libp2p extends EventEmitter {
|
|
|
354
356
|
* @returns {Promise<void>}
|
|
355
357
|
*/
|
|
356
358
|
hangUp(peer: PeerId | Multiaddr | string): Promise<void>;
|
|
359
|
+
/**
|
|
360
|
+
* Sends a request to fetch the value associated with the given key from the given peer.
|
|
361
|
+
*
|
|
362
|
+
* @param {PeerId|Multiaddr} peer
|
|
363
|
+
* @param {string} key
|
|
364
|
+
* @returns {Promise<Uint8Array | null>}
|
|
365
|
+
*/
|
|
366
|
+
fetch(peer: PeerId | Multiaddr, key: string): Promise<Uint8Array | null>;
|
|
357
367
|
/**
|
|
358
368
|
* Pings the given peer in order to obtain the operation latency.
|
|
359
369
|
*
|
|
@@ -367,7 +377,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
367
377
|
*
|
|
368
378
|
* @param {string[]|string} protocols
|
|
369
379
|
*/
|
|
370
|
-
unhandle(protocols: string[] | string): void
|
|
380
|
+
unhandle(protocols: string[] | string): Promise<void>;
|
|
371
381
|
_onStarting(): Promise<void>;
|
|
372
382
|
/**
|
|
373
383
|
* Called when libp2p has started and before it returns
|
|
@@ -412,7 +422,7 @@ type Libp2pOptions = {
|
|
|
412
422
|
keychain?: (KeychainOptions & Keychain.KeychainOptions) | undefined;
|
|
413
423
|
metrics?: (MetricsOptions & Metrics.MetricsOptions) | undefined;
|
|
414
424
|
peerRouting?: PeerRouting.PeerRoutingOptions | undefined;
|
|
415
|
-
peerStore?:
|
|
425
|
+
peerStore?: PeerStoreOptions | undefined;
|
|
416
426
|
transportManager?: TransportManager.TransportManagerOptions | undefined;
|
|
417
427
|
config?: Libp2pConfig | undefined;
|
|
418
428
|
};
|
|
@@ -421,7 +431,6 @@ type constructorOptions = {
|
|
|
421
431
|
};
|
|
422
432
|
import PeerId = require("peer-id");
|
|
423
433
|
import Metrics = require("./metrics");
|
|
424
|
-
import PeerStore = require("./peer-store");
|
|
425
434
|
import AddressManager = require("./address-manager");
|
|
426
435
|
type Libp2pModules = {
|
|
427
436
|
transport: import("libp2p-interfaces/src/transport/types").TransportFactory<any, any>[];
|
|
@@ -468,6 +477,7 @@ import Relay = require("./circuit");
|
|
|
468
477
|
import IdentifyService = require("./identify");
|
|
469
478
|
import PeerRouting = require("./peer-routing");
|
|
470
479
|
import ContentRouting = require("./content-routing");
|
|
480
|
+
import FetchService = require("./fetch");
|
|
471
481
|
import { Multiaddr } from "multiaddr";
|
|
472
482
|
type Connection = import("libp2p-interfaces/src/connection/connection");
|
|
473
483
|
type CreateOptions = {
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";AAqCA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH;IACE;;;;;;OAMG;IACH,uBAHW,aAAa,GAAG,aAAa,GAC3B,QAAQ,MAAM,CAAC,CAa3B;IAED;;;;;OAKG;IACH,sBAFW,aAAa,GAAG,kBAAkB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";AAqCA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyEG;AACH;IACE;;;;;;OAMG;IACH,uBAHW,aAAa,GAAG,aAAa,GAC3B,QAAQ,MAAM,CAAC,CAa3B;IAED;;;;;OAKG;IACH,sBAFW,aAAa,GAAG,kBAAkB,EA+K5C;IAzKC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2CAAwC;IAExC,qBAAqB;IACrB,QADW,MAAM,CACiB;IAClC,+DAAwC;IAQtC,6BAAsB;IAGxB,qDAAqD;IACrD,WADW,OAAO,oBAAoB,EAAE,SAAS,CAI/C;IAGF;;;;;6CAAwC;IACxC,+BAA8E;IAS9E,wBAAqC;IACrC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAAmC;IACnC,kBAAoB;IACpB,0BAA2B;IAG3B,qCAEE;IACF,0BAIE;IAQA,+BAGE;IAMJ,mBAKE;IAGF,mCAIE;IAGF,uBAME;IAGF,qBAGE;IA8VJ;;;;;OAKG;IACH,kBAHW,MAAM,EAAE,GAAC,MAAM,mBACP,YAAY,KAAK,IAAI,iBAUvC;IA9VC,eAKE;IAWA,yBAA4B;IAW5B,6CAA4D;IAc5D,UAGE;IAOF,qBAAqB;IACrB,+CAA8D;IAKhE,yBAAwC;IACxC,+BAA8C;IAoXhD;;;;;;OAMG;IACH,yBAQC;IA5XC,2BAA0C;IAsB5C;;;;OAIG;IACH,SAFa,QAAQ,IAAI,CAAC,CAuBzB;IAED;;;;;OAKG;IACH,QAFa,QAAQ,IAAI,CAAC,CA8CzB;IAxCG,gCAAuB;IA0C3B;;;;;;OAMG;IACH,gBAFa,QAAQ,IAAI,CAAC,CAYzB;IAED,iCAEC;IAED;;;;;OAKG;IACH,wFAEC;IAED;;;;;;;;OAQG;IACH,WALW,MAAM,GAAC,SAAS,GAAC,MAAM;;oBAGrB,QAAQ,UAAU,CAAC,CAI/B;IAED;;;;;;;;;;OAUG;IACH,mBALW,MAAM,GAAC,SAAS,GAAC,MAAM,aACvB,MAAM,EAAE,GAAC,MAAM;;;;;OAWzB;IAED;;;;;OAKG;IACH,YAJW,MAAM,GAAC,SAAS,GAAC,MAAM,iCAErB,QAAQ,UAAU,CAAC,CAkB/B;IAED;;;;;;;;;OASG;IACH,8BAiBC;IAED;;;;;OAKG;IACH,aAHW,MAAM,GAAC,SAAS,GAAC,MAAM,GACrB,QAAQ,IAAI,CAAC,CAgBzB;IAED;;;;;;OAMG;IACH,YAJW,MAAM,GAAC,SAAS,OAChB,MAAM,GACJ,QAAQ,UAAU,GAAG,IAAI,CAAC,CAItC;IAED;;;;;OAKG;IACH,WAHW,MAAM,GAAC,SAAS,GAAC,MAAM,GACrB,QAAQ,MAAM,CAAC,CAW3B;IAkBD;;;;;OAKG;IACH,oBAFW,MAAM,EAAE,GAAC,MAAM,iBAUzB;IAED,6BA2BC;IAED;;;;OAIG;IACH,oBA0BC;IAmBD;;;;;;;OAOG;IACH,sBAaC;IAED;;;;;OAKG;IACH,4BAkDC;CACF;;;;;;;;;aA5qBa,aAAa;;;;;;;;;;;;;;;;;YAcb,MAAM;;;;;;eAzBN,4EAAkB;iBAClB,YAAY,EAAE;oBACd,MAAM,EAAE;;;;;4BAKM,GAAG,EAAE,KAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBA7C5B,UAAU;YACV,WAAW;cACX,MAAM;;;;;;;;;;;;;mBAnBP,OAAO,0CAA0C,EAAE,WAAW;wBAC9D,OAAO,uCAAuC,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,CAAC;oBAC1E,OAAO,0CAA0C,EAAE,YAAY;4BAC/D,OAAO,6CAA6C,EAAE,cAAc;4BACpE,OAAO,4CAA4C,EAAE,oBAAoB;yBACzE,OAAO,0CAA0C,EAAE,WAAW;cAC9D,OAAO,oCAAoC,EAAE,MAAM;cACnD,OAAO,8BAA8B,CAAC;qBACtC,OAAO,8BAA8B,EAAE,aAAa;iBACpD,OAAO,qBAAqB,EAAE,SAAS;iBACvC,OAAO,QAAQ,CAAC;;;;;;;;;;;;;;;iBAsBf,OAAO;;;aAGP,OAAO;;;aAGP,OAAO"}
|
|
@@ -45,7 +45,7 @@ declare class Metrics {
|
|
|
45
45
|
* @returns {void}
|
|
46
46
|
*/
|
|
47
47
|
private _onMessage;
|
|
48
|
-
|
|
48
|
+
_systems: Map<any, any>;
|
|
49
49
|
/**
|
|
50
50
|
* Must be called for stats to saved. Any data pushed for tracking
|
|
51
51
|
* will be ignored.
|
|
@@ -69,10 +69,15 @@ declare class Metrics {
|
|
|
69
69
|
*/
|
|
70
70
|
get peers(): string[];
|
|
71
71
|
/**
|
|
72
|
-
* @returns {Map}
|
|
72
|
+
* @returns {Map<string, Map<string, Map<string, any>>>}
|
|
73
73
|
*/
|
|
74
|
-
getComponentMetrics(): Map<
|
|
75
|
-
updateComponentMetric(
|
|
74
|
+
getComponentMetrics(): Map<string, Map<string, Map<string, any>>>;
|
|
75
|
+
updateComponentMetric({ system, component, metric, value }: {
|
|
76
|
+
system?: string | undefined;
|
|
77
|
+
component: any;
|
|
78
|
+
metric: any;
|
|
79
|
+
value: any;
|
|
80
|
+
}): void;
|
|
76
81
|
/**
|
|
77
82
|
* Returns the `Stats` object for the given `PeerId` whether it
|
|
78
83
|
* is a live peer, or in the disconnected peer LRU cache.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/metrics/index.js"],"names":[],"mappings":";AAoBA;;;GAGG;AAEH;;;;;;GAMG;AAEH;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/metrics/index.js"],"names":[],"mappings":";AAoBA;;;GAGG;AAEH;;;;;;GAMG;AAEH;IA4OE;;;;;;;OAOG;IACH,0BAJW,KAAK,SACL,KAAK,GACH,KAAK,CAWjB;IA5PD;;;OAGG;IACH,qBAFW,cAAc,EAWxB;IARC,cAAqD;IACrD,oBAA6D;IAC7D,0BAA2B;IAC3B,8BAA+B;IAC/B,eAA+D;IAC/D,kBAAqB;IAqHvB;;;;;;;;;;;;OAYG;IACH,mBAwBC;IAxJC,wBAAyB;IAG3B;;;OAGG;IACH,cAEC;IAED;;;OAGG;IACH,aASC;IAED;;;;OAIG;IACH,oBAEC;IAED;;;;OAIG;IACH,sBAEC;IAED;;OAEG;IACH,uBAFa,IAAI,MAAM,EAAE,IAAI,MAAM,EAAE,IAAI,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC,CAItD;IAED;;;;;aAcC;IAED;;;;;;OAMG;IACH,gBAHW,MAAM,GACJ,KAAK,CAKjB;IAED;;;;OAIG;IACH,0BAEC;IAED;;;;;OAKG;IACH,sBAHW,MAAM,GACJ,KAAK,CAIjB;IAED;;;;;;OAMG;IACH,2BAFW,MAAM,QAUhB;IAyCD;;;;;;;;OAQG;IACH,+BAJW,MAAM,UACN,MAAM,GACJ,IAAI,CAoBhB;IAED;;;;;;;;;;;;OAYG;IACH;QALwC,MAAM,EAAnC,mBAAmB;QACF,UAAU;QACV,QAAQ;QACvB,mBAAmB,CA2B/B;CAoBF;;;;;cA1QY,OAAO,SAAS,CAAC;2BACjB,OAAO,uCAAuC,EAAE,mBAAmB"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
declare function _exports<K, V>(
|
|
1
|
+
declare function _exports<K, V>({ system, component, metric, metrics }: {
|
|
2
|
+
system?: string | undefined;
|
|
3
|
+
component: string;
|
|
4
|
+
metric: string;
|
|
5
|
+
metrics?: import(".") | undefined;
|
|
6
|
+
}): Map<K, V>;
|
|
2
7
|
export = _exports;
|
|
3
8
|
//# sourceMappingURL=tracked-map.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tracked-map.d.ts","sourceRoot":"","sources":["../../../src/metrics/tracked-map.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tracked-map.d.ts","sourceRoot":"","sources":["../../../src/metrics/tracked-map.js"],"names":[],"mappings":"AAkFiB;IANW,MAAM;IACP,SAAS,EAAzB,MAAM;IACU,MAAM,EAAtB,MAAM;IACgB,OAAO;cAcvC"}
|
|
@@ -21,7 +21,7 @@ declare class PeerRouting {
|
|
|
21
21
|
*/
|
|
22
22
|
constructor(libp2p: import('./'));
|
|
23
23
|
_peerId: import("peer-id");
|
|
24
|
-
_peerStore: import("./peer-store");
|
|
24
|
+
_peerStore: import("./peer-store/types").PeerStore;
|
|
25
25
|
/** @type {PeerRoutingModule[]} */
|
|
26
26
|
_routers: PeerRoutingModule[];
|
|
27
27
|
_refreshManagerOptions: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"peer-routing.d.ts","sourceRoot":"","sources":["../../src/peer-routing.js"],"names":[],"mappings":";AA6BA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;IACE;;;OAGG;IACH,oBAFW,OAAO,IAAI,CAAC,EAgBtB;IAbC,2BAA4B;IAC5B,
|
|
1
|
+
{"version":3,"file":"peer-routing.d.ts","sourceRoot":"","sources":["../../src/peer-routing.js"],"names":[],"mappings":";AA6BA;;;;GAIG;AAEH;;;;;;;;;GASG;AAEH;IACE;;;OAGG;IACH,oBAFW,OAAO,IAAI,CAAC,EAgBtB;IAbC,2BAA4B;IAC5B,mDAAkC;IAClC,kCAAkC;IAClC,UADW,iBAAiB,EAAE,CACmB;IAOjD;;;;8BAAwE;IAkB1E;;OAEG;IACH,uCAOC;IAvBD;;OAEG;IACH,cAQC;IAHC,gBAEC;IAeH;;OAEG;IACH,aAEC;IAED;;;;;;;OAOG;IACH,aALW,MAAM;;oBAGJ,QAAQ;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CA+B5D;IAED;;;;;;;;OAQG;IACH,qBANW,UAAU;;;oBAIR,cAAc;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC,CA2BlE;CACF;;;;yBA7IY,OAAO,0CAA0C,EAAE,WAAW;;;;;;;;;;;;;;;;;;;cAF9D,OAAO,SAAS,CAAC;iBACjB,OAAO,WAAW,EAAE,SAAS"}
|