libp2p 0.35.5 → 0.35.9-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- 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 +20 -16
- package/dist/src/dialer/index.d.ts.map +1 -1
- 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 +14 -9
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/metrics/stats.d.ts +3 -1
- package/dist/src/metrics/stats.d.ts.map +1 -1
- package/dist/src/metrics/tracked-map.d.ts +3 -0
- package/dist/src/metrics/tracked-map.d.ts.map +1 -0
- 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 +28 -29
- package/dist/src/peer-store/proto-book.d.ts.map +1 -1
- package/dist/src/peer-store/store.d.ts +46 -0
- package/dist/src/peer-store/store.d.ts.map +1 -0
- package/dist/src/peer-store/types.d.ts +199 -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 +21 -23
- package/src/circuit/auto-relay.js +19 -19
- package/src/connection-manager/auto-dialler.js +9 -4
- package/src/connection-manager/index.js +33 -31
- 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 +24 -20
- package/src/identify/index.js +28 -23
- package/src/index.js +43 -35
- package/src/metrics/stats.js +1 -0
- package/src/metrics/tracked-map.js +68 -0
- package/src/peer-routing.js +11 -1
- package/src/peer-store/address-book.js +238 -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 -1
- 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
package/README.md
CHANGED
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
<a href="https://david-dm.org/libp2p/js-libp2p"><img src="https://david-dm.org/libp2p/js-libp2p.svg?style=flat-square" /></a>
|
|
24
24
|
<a href="https://github.com/feross/standard"><img src="https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square"></a>
|
|
25
25
|
<a href="https://github.com/RichardLitt/standard-readme"><img src="https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square" /></a>
|
|
26
|
-
<a href=""><img src="https://img.shields.io/badge/npm-%3E%
|
|
27
|
-
<a href=""><img src="https://img.shields.io/badge/Node.js-%3E%
|
|
26
|
+
<a href=""><img src="https://img.shields.io/badge/npm-%3E%3D7.0.0-orange.svg?style=flat-square" /></a>
|
|
27
|
+
<a href=""><img src="https://img.shields.io/badge/Node.js-%3E%3D15.0.0-orange.svg?style=flat-square" /></a>
|
|
28
28
|
<br>
|
|
29
29
|
</p>
|
|
30
30
|
|
|
@@ -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":";
|
|
1
|
+
{"version":3,"file":"auto-relay.d.ts","sourceRoot":"","sources":["../../../src/circuit/auto-relay.js"],"names":[],"mappings":";AAqBA;;;;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,wBA0BC;IAED;;;;;OAKG;IACH,2BAKC;IAED;;;;;;;;OAQG;IACH,iFAwEC;IAED;;OAEG;IACH,4BAFW,MAAM,iBAShB;CACF;;;;cArQY,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":";AAkBA;;;GAGG;AAEH;;;;;GAKG;AAEH;IACE;;;;;;;;OAQG;IACH,oBAHW,MAAM,YACN,kBAAkB,EAU5B;IAPC,cAAqF;IACrF,4BAAqB;IACrB,kBAAqB;IACrB,sBAA4B;IAoC9B,2BAuCC;IArED;;OAEG;IACH,uBAWC;IAED;;OAEG;IACH,sBASC;CA0CF;;;;cArGY,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,EAqClC;IAhCC,uBAAqB;IACrB,gBAA0C;IAE1C,cAAqF;IAOrF;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,MAAM,CAAC,
|
|
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,EAqClC;IAhCC,uBAAqB;IACrB,gBAA0C;IAE1C,cAAqF;IAOrF;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,MAAM,CAAC,CAE8D;IAE3F;;;;OAIG;IACH,aAFU,IAAI,MAAM,EAAE,UAAU,EAAE,CAAC,CAE6D;IAEhG,kBAAqB;IACrB,YAAkB;IAoFpB;;;;;OAKG;IACH,sBAiBC;IAxGC,gCAGE;IAGJ;;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;;;;;;;;cAtTY,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
|
/**
|
|
@@ -27,8 +27,8 @@ export = Dialer;
|
|
|
27
27
|
* @property {Multiaddr[]} addrs
|
|
28
28
|
*
|
|
29
29
|
* @typedef PendingDial
|
|
30
|
-
* @property {
|
|
31
|
-
* @property {TimeoutController} controller
|
|
30
|
+
* @property {import('./dial-request')} dialRequest
|
|
31
|
+
* @property {import('timeout-abort-controller').TimeoutController} controller
|
|
32
32
|
* @property {Promise<Connection>} promise
|
|
33
33
|
* @property {function():void} destroy
|
|
34
34
|
*/
|
|
@@ -39,16 +39,20 @@ 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;
|
|
46
46
|
timeout: number;
|
|
47
47
|
maxDialsPerPeer: number;
|
|
48
48
|
tokens: number[];
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
/** @type {Map<string, PendingDial>} */
|
|
50
|
+
_pendingDials: Map<string, PendingDial>;
|
|
51
|
+
/** @type {Map<string, { resolve: (value: any) => void, reject: (err: Error) => void}>} */
|
|
52
|
+
_pendingDialTargets: Map<string, {
|
|
53
|
+
resolve: (value: any) => void;
|
|
54
|
+
reject: (err: Error) => void;
|
|
55
|
+
}>;
|
|
52
56
|
/**
|
|
53
57
|
* Clears any pending dials
|
|
54
58
|
*/
|
|
@@ -122,6 +126,12 @@ declare class Dialer {
|
|
|
122
126
|
declare namespace Dialer {
|
|
123
127
|
export { Connection, PeerId, PeerStore, Address, TransportManager, DialerProperties, Resolver, DialerOptions, DialTarget, PendingDial };
|
|
124
128
|
}
|
|
129
|
+
type PendingDial = {
|
|
130
|
+
dialRequest: import('./dial-request');
|
|
131
|
+
controller: import('timeout-abort-controller').TimeoutController;
|
|
132
|
+
promise: Promise<Connection>;
|
|
133
|
+
destroy: () => void;
|
|
134
|
+
};
|
|
125
135
|
type PeerId = import('peer-id');
|
|
126
136
|
import { Multiaddr } from "multiaddr";
|
|
127
137
|
type Connection = import("libp2p-interfaces/src/connection/connection");
|
|
@@ -160,14 +170,8 @@ type DialerOptions = {
|
|
|
160
170
|
resolvers?: Record<string, Resolver> | undefined;
|
|
161
171
|
metrics?: import("../metrics") | undefined;
|
|
162
172
|
};
|
|
163
|
-
type PeerStore = import('../peer-store');
|
|
164
|
-
type Address = import('../peer-store/
|
|
173
|
+
type PeerStore = import('../peer-store/types').PeerStore;
|
|
174
|
+
type Address = import('../peer-store/types').Address;
|
|
165
175
|
type TransportManager = import('../transport-manager');
|
|
166
176
|
type Resolver = (addr: Multiaddr) => Promise<string[]>;
|
|
167
|
-
type PendingDial = {
|
|
168
|
-
dialRequest: DialRequest;
|
|
169
|
-
controller: TimeoutController;
|
|
170
|
-
promise: Promise<Connection>;
|
|
171
|
-
destroy: () => void;
|
|
172
|
-
};
|
|
173
177
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/dialer/index.js"],"names":[],"mappings":";
|
|
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,EA+B1C;IAlBC,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,CAC+C;IAElF,0FAA0F;IAC1F;yBAD0C,GAAG,KAAK,IAAI;sBAAgB,KAAK,KAAK,IAAI;OACW;IAOjG;;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;;;;;iBAhSa,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"}
|
|
@@ -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;IAuSD;;;;;OAKG;IACH,+BAHW,UAAU,GAAG,MAAM,GACjB,SAAS,GAAC,IAAI,CAW1B;IApTD;;;;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,oBAsCC;CAkBF;;;;;;;;;;;;mBAxUY,OAAO,0CAA0C,EAAE,WAAW;;kBAK7D,MAAM"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export = Libp2p;
|
|
|
12
12
|
* @typedef {import('libp2p-interfaces/src/pubsub').PubsubOptions} PubsubOptions
|
|
13
13
|
* @typedef {import('interface-datastore').Datastore} Datastore
|
|
14
14
|
* @typedef {import('./pnet')} Protector
|
|
15
|
+
* @typedef {Object} PersistentPeerStoreOptions
|
|
16
|
+
* @property {number} [threshold]
|
|
15
17
|
*/
|
|
16
18
|
/**
|
|
17
19
|
* @typedef {Object} HandlerProps
|
|
@@ -73,7 +75,7 @@ export = Libp2p;
|
|
|
73
75
|
* @property {KeychainOptions & import('./keychain/index').KeychainOptions} [keychain]
|
|
74
76
|
* @property {MetricsOptions & import('./metrics').MetricsOptions} [metrics]
|
|
75
77
|
* @property {import('./peer-routing').PeerRoutingOptions} [peerRouting]
|
|
76
|
-
* @property {PeerStoreOptions
|
|
78
|
+
* @property {PeerStoreOptions} [peerStore]
|
|
77
79
|
* @property {import('./transport-manager').TransportManagerOptions} [transportManager]
|
|
78
80
|
* @property {Libp2pConfig} [config]
|
|
79
81
|
*
|
|
@@ -186,7 +188,9 @@ declare class Libp2p extends EventEmitter {
|
|
|
186
188
|
/** @type {PeerId} */
|
|
187
189
|
peerId: PeerId;
|
|
188
190
|
datastore: import("interface-datastore").Datastore | undefined;
|
|
189
|
-
|
|
191
|
+
metrics: Metrics | undefined;
|
|
192
|
+
/** @type {import('./peer-store/types').PeerStore} */
|
|
193
|
+
peerStore: import('./peer-store/types').PeerStore;
|
|
190
194
|
addresses: {
|
|
191
195
|
listen: never[];
|
|
192
196
|
announce: never[];
|
|
@@ -239,7 +243,6 @@ declare class Libp2p extends EventEmitter {
|
|
|
239
243
|
_discovery: Map<any, any>;
|
|
240
244
|
connectionManager: ConnectionManager;
|
|
241
245
|
_autodialler: AutoDialler;
|
|
242
|
-
metrics: Metrics | undefined;
|
|
243
246
|
keychain: Keychain | undefined;
|
|
244
247
|
upgrader: Upgrader;
|
|
245
248
|
transportManager: TransportManager;
|
|
@@ -251,7 +254,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
251
254
|
* @param {string[]|string} protocols
|
|
252
255
|
* @param {(props: HandlerProps) => void} handler
|
|
253
256
|
*/
|
|
254
|
-
handle(protocols: string[] | string, handler: (props: HandlerProps) => void): void
|
|
257
|
+
handle(protocols: string[] | string, handler: (props: HandlerProps) => void): Promise<void>;
|
|
255
258
|
dialer: Dialer;
|
|
256
259
|
relay: Relay | undefined;
|
|
257
260
|
identifyService: IdentifyService | undefined;
|
|
@@ -365,7 +368,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
365
368
|
*
|
|
366
369
|
* @param {string[]|string} protocols
|
|
367
370
|
*/
|
|
368
|
-
unhandle(protocols: string[] | string): void
|
|
371
|
+
unhandle(protocols: string[] | string): Promise<void>;
|
|
369
372
|
_onStarting(): Promise<void>;
|
|
370
373
|
/**
|
|
371
374
|
* Called when libp2p has started and before it returns
|
|
@@ -391,7 +394,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
391
394
|
private _setupPeerDiscovery;
|
|
392
395
|
}
|
|
393
396
|
declare namespace Libp2p {
|
|
394
|
-
export { Connection, MuxedStream, TransportFactory, MuxerFactory, ContentRoutingModule, PeerDiscoveryFactory, PeerRoutingModule, Crypto, Pubsub, PubsubOptions, Datastore, Protector, HandlerProps, DhtOptions, KeychainOptions, PeerStoreOptions, PubsubLocalOptions, MetricsOptions, RelayOptions, Libp2pConfig, Libp2pModules, Libp2pOptions, constructorOptions, CreateOptions };
|
|
397
|
+
export { Connection, MuxedStream, TransportFactory, MuxerFactory, ContentRoutingModule, PeerDiscoveryFactory, PeerRoutingModule, Crypto, Pubsub, PubsubOptions, Datastore, Protector, PersistentPeerStoreOptions, HandlerProps, DhtOptions, KeychainOptions, PeerStoreOptions, PubsubLocalOptions, MetricsOptions, RelayOptions, Libp2pConfig, Libp2pModules, Libp2pOptions, constructorOptions, CreateOptions };
|
|
395
398
|
}
|
|
396
399
|
import { EventEmitter } from "events";
|
|
397
400
|
type Libp2pOptions = {
|
|
@@ -410,7 +413,7 @@ type Libp2pOptions = {
|
|
|
410
413
|
keychain?: (KeychainOptions & Keychain.KeychainOptions) | undefined;
|
|
411
414
|
metrics?: (MetricsOptions & Metrics.MetricsOptions) | undefined;
|
|
412
415
|
peerRouting?: PeerRouting.PeerRoutingOptions | undefined;
|
|
413
|
-
peerStore?:
|
|
416
|
+
peerStore?: PeerStoreOptions | undefined;
|
|
414
417
|
transportManager?: TransportManager.TransportManagerOptions | undefined;
|
|
415
418
|
config?: Libp2pConfig | undefined;
|
|
416
419
|
};
|
|
@@ -418,7 +421,7 @@ type constructorOptions = {
|
|
|
418
421
|
peerId: PeerId;
|
|
419
422
|
};
|
|
420
423
|
import PeerId = require("peer-id");
|
|
421
|
-
import
|
|
424
|
+
import Metrics = require("./metrics");
|
|
422
425
|
import AddressManager = require("./address-manager");
|
|
423
426
|
type Libp2pModules = {
|
|
424
427
|
transport: import("libp2p-interfaces/src/transport/types").TransportFactory<any, any>[];
|
|
@@ -450,7 +453,6 @@ type Libp2pConfig = {
|
|
|
450
453
|
};
|
|
451
454
|
import ConnectionManager = require("./connection-manager");
|
|
452
455
|
import AutoDialler = require("./connection-manager/auto-dialler");
|
|
453
|
-
import Metrics = require("./metrics");
|
|
454
456
|
import Keychain = require("./keychain");
|
|
455
457
|
import Upgrader = require("./upgrader");
|
|
456
458
|
import TransportManager = require("./transport-manager");
|
|
@@ -482,6 +484,9 @@ type Pubsub = import('libp2p-interfaces/src/pubsub');
|
|
|
482
484
|
type PubsubOptions = import('libp2p-interfaces/src/pubsub').PubsubOptions;
|
|
483
485
|
type Datastore = import('interface-datastore').Datastore;
|
|
484
486
|
type Protector = import('./pnet');
|
|
487
|
+
type PersistentPeerStoreOptions = {
|
|
488
|
+
threshold?: number | undefined;
|
|
489
|
+
};
|
|
485
490
|
type DhtOptions = {
|
|
486
491
|
enabled?: boolean | undefined;
|
|
487
492
|
kBucketSize?: number | undefined;
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.js"],"names":[],"mappings":"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"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export = Stats;
|
|
2
2
|
/**
|
|
3
3
|
* @typedef {import('@vascosantos/moving-average').IMovingAverage} IMovingAverage
|
|
4
|
+
* @typedef {import('bignumber.js').BigNumber} Big
|
|
4
5
|
*/
|
|
5
6
|
declare class Stats extends EventEmitter {
|
|
6
7
|
/**
|
|
@@ -130,8 +131,9 @@ declare class Stats extends EventEmitter {
|
|
|
130
131
|
private _applyOp;
|
|
131
132
|
}
|
|
132
133
|
declare namespace Stats {
|
|
133
|
-
export { IMovingAverage };
|
|
134
|
+
export { IMovingAverage, Big };
|
|
134
135
|
}
|
|
135
136
|
import { EventEmitter } from "events";
|
|
136
137
|
type IMovingAverage = import('@vascosantos/moving-average').IMovingAverage;
|
|
138
|
+
type Big = import('bignumber.js').BigNumber;
|
|
137
139
|
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/metrics/stats.js"],"names":[],"mappings":";AAQA
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../../src/metrics/stats.js"],"names":[],"mappings":";AAQA;;;GAGG;AAEH;IACE;;;;;;OAMG;IACH,6BAHW,MAAM,EAAE,WACR,GAAG,EAkCb;IA7BC,cAAuB;IACvB,cAAgB;IAEhB,mDAAmD;IACnD;sBAD2B,GAAG;kBAAY,GAAG;MAI5C;IAED,2BAAoC;IACpC,2BAAgC;IAEhC,6EAA6E;IAC7E;sBAD2B,cAAc,EAAE;kBAAY,cAAc,EAAE;MAC9C;IAwH3B;;;;;;;;;;OAUG;IACH,gBAaC;IA9HD;;;;;;OAMG;IACH,SAFa,IAAI,CAMhB;IAED;;;;;OAKG;IACH,QAFa,IAAI,CAOhB;IAFG,cAAoB;IAIxB;;OAEG;IACH;sBAzD6B,GAAG;kBAAY,GAAG;MA2D9C;IAED;;OAEG;IACH;sBAvD6B,cAAc,EAAE;kBAAY,cAAc,EAAE;MAyDxE;IAED;;;;OAIG;IACH,cAkBC;IAED;;;;;;;OAOG;IACH,cAJW,MAAM,OACN,MAAM,GACJ,IAAI,CAKhB;IAED;;;;;OAKG;IACH,6BAEC;IAED;;;;;;OAMG;IACH,qBAKC;IA4BD;;;;;;;;OAQG;IACH,yBAQC;IAED;;;;;;;;;OASG;IACH,4BAsBC;IAED;;;;;;;;OAQG;IACH,iBAqBC;CACF;;;;;sBAlQY,OAAO,6BAA6B,EAAE,cAAc;WACpD,OAAO,cAAc,EAAE,SAAS"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tracked-map.d.ts","sourceRoot":"","sources":["../../../src/metrics/tracked-map.js"],"names":[],"mappings":"AAwDiB,2CALN,MAAM,QACN,MAAM,gDAehB"}
|
|
@@ -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":";
|
|
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"}
|
|
@@ -1,121 +1,65 @@
|
|
|
1
|
-
export =
|
|
1
|
+
export = PeerStoreAddressBook;
|
|
2
2
|
/**
|
|
3
|
-
* @
|
|
3
|
+
* @implements {AddressBook}
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
|
-
* @typedef {Object} Address
|
|
7
|
-
* @property {Multiaddr} multiaddr peer multiaddr.
|
|
8
|
-
* @property {boolean} isCertified obtained from a signed peer record.
|
|
9
|
-
*
|
|
10
|
-
* @typedef {Object} CertifiedRecord
|
|
11
|
-
* @property {Uint8Array} raw raw envelope.
|
|
12
|
-
* @property {number} seqNumber seq counter.
|
|
13
|
-
*
|
|
14
|
-
* @typedef {Object} Entry
|
|
15
|
-
* @property {Address[]} addresses peer Addresses.
|
|
16
|
-
* @property {CertifiedRecord} record certified peer record.
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* @extends {Book}
|
|
20
|
-
*/
|
|
21
|
-
declare class AddressBook extends Book {
|
|
5
|
+
declare class PeerStoreAddressBook implements AddressBook {
|
|
22
6
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
* @class
|
|
26
|
-
* @param {PeerStore} peerStore
|
|
7
|
+
* @param {PeerStore["emit"]} emit
|
|
8
|
+
* @param {import('./types').Store} store
|
|
27
9
|
*/
|
|
28
|
-
constructor(
|
|
10
|
+
constructor(emit: PeerStore["emit"], store: import('./types').Store);
|
|
11
|
+
_emit: <U extends keyof import("./types").PeerStoreEvents>(event: U, ...args: Parameters<import("./types").PeerStoreEvents[U]>) => boolean;
|
|
12
|
+
_store: import("./types").Store;
|
|
29
13
|
/**
|
|
30
14
|
* ConsumePeerRecord adds addresses from a signed peer record contained in a record envelope.
|
|
31
15
|
* This will return a boolean that indicates if the record was successfully processed and added
|
|
32
16
|
* into the AddressBook.
|
|
33
17
|
*
|
|
34
18
|
* @param {Envelope} envelope
|
|
35
|
-
* @returns {boolean}
|
|
36
19
|
*/
|
|
37
|
-
consumePeerRecord(envelope: Envelope): boolean
|
|
20
|
+
consumePeerRecord(envelope: Envelope): Promise<boolean>;
|
|
38
21
|
/**
|
|
39
|
-
* Get the raw Envelope for a peer. Returns
|
|
40
|
-
* undefined if no Envelope is found.
|
|
41
|
-
*
|
|
42
22
|
* @param {PeerId} peerId
|
|
43
|
-
* @returns {Uint8Array|undefined}
|
|
44
23
|
*/
|
|
45
|
-
getRawEnvelope(peerId: PeerId): Uint8Array | undefined
|
|
24
|
+
getRawEnvelope(peerId: PeerId): Promise<Uint8Array | undefined>;
|
|
46
25
|
/**
|
|
47
26
|
* Get an Envelope containing a PeerRecord for the given peer.
|
|
48
27
|
* Returns undefined if no record exists.
|
|
49
28
|
*
|
|
50
29
|
* @param {PeerId} peerId
|
|
51
|
-
* @returns {Promise<Envelope|void>|undefined}
|
|
52
30
|
*/
|
|
53
|
-
getPeerRecord(peerId: PeerId): Promise<Envelope |
|
|
31
|
+
getPeerRecord(peerId: PeerId): Promise<Envelope | undefined>;
|
|
32
|
+
/**
|
|
33
|
+
* @param {PeerId} peerId
|
|
34
|
+
*/
|
|
35
|
+
get(peerId: PeerId): Promise<import("./types").Address[]>;
|
|
54
36
|
/**
|
|
55
|
-
* Add known addresses of a provided peer.
|
|
56
|
-
* If the peer is not known, it is set with the given addresses.
|
|
57
|
-
*
|
|
58
37
|
* @param {PeerId} peerId
|
|
59
38
|
* @param {Multiaddr[]} multiaddrs
|
|
60
|
-
* @returns {AddressBook}
|
|
61
39
|
*/
|
|
62
|
-
|
|
40
|
+
set(peerId: PeerId, multiaddrs: Multiaddr[]): Promise<void>;
|
|
63
41
|
/**
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
* @private
|
|
42
|
+
* @param {PeerId} peerId
|
|
67
43
|
* @param {Multiaddr[]} multiaddrs
|
|
68
|
-
* @param {boolean} [isCertified]
|
|
69
|
-
* @returns {Address[]}
|
|
70
44
|
*/
|
|
71
|
-
|
|
45
|
+
add(peerId: PeerId, multiaddrs: Multiaddr[]): Promise<void>;
|
|
46
|
+
/**
|
|
47
|
+
* @param {PeerId} peerId
|
|
48
|
+
*/
|
|
49
|
+
delete(peerId: PeerId): Promise<void>;
|
|
72
50
|
/**
|
|
73
|
-
* Get the known multiaddrs for a given peer. All returned multiaddrs
|
|
74
|
-
* will include the encapsulated `PeerId` of the peer.
|
|
75
|
-
* Returns `undefined` if there are no known multiaddrs for the given peer.
|
|
76
|
-
*
|
|
77
51
|
* @param {PeerId} peerId
|
|
78
52
|
* @param {(addresses: Address[]) => Address[]} [addressSorter]
|
|
79
|
-
* @returns {Multiaddr[]|undefined}
|
|
80
53
|
*/
|
|
81
|
-
getMultiaddrsForPeer(peerId: PeerId, addressSorter?: ((addresses: Address[]) => Address[]) | undefined): Multiaddr[]
|
|
54
|
+
getMultiaddrsForPeer(peerId: PeerId, addressSorter?: ((addresses: Address[]) => Address[]) | undefined): Promise<Multiaddr[]>;
|
|
82
55
|
}
|
|
83
|
-
declare namespace
|
|
84
|
-
export { PeerStore, Address,
|
|
56
|
+
declare namespace PeerStoreAddressBook {
|
|
57
|
+
export { PeerStore, Address, AddressBook };
|
|
85
58
|
}
|
|
86
|
-
|
|
59
|
+
type AddressBook = import('./types').AddressBook;
|
|
87
60
|
import Envelope = require("../record/envelope");
|
|
88
61
|
import PeerId = require("peer-id");
|
|
89
62
|
import { Multiaddr } from "multiaddr";
|
|
90
|
-
type PeerStore = import('./');
|
|
91
|
-
type Address =
|
|
92
|
-
/**
|
|
93
|
-
* peer multiaddr.
|
|
94
|
-
*/
|
|
95
|
-
multiaddr: Multiaddr;
|
|
96
|
-
/**
|
|
97
|
-
* obtained from a signed peer record.
|
|
98
|
-
*/
|
|
99
|
-
isCertified: boolean;
|
|
100
|
-
};
|
|
101
|
-
type CertifiedRecord = {
|
|
102
|
-
/**
|
|
103
|
-
* raw envelope.
|
|
104
|
-
*/
|
|
105
|
-
raw: Uint8Array;
|
|
106
|
-
/**
|
|
107
|
-
* seq counter.
|
|
108
|
-
*/
|
|
109
|
-
seqNumber: number;
|
|
110
|
-
};
|
|
111
|
-
type Entry = {
|
|
112
|
-
/**
|
|
113
|
-
* peer Addresses.
|
|
114
|
-
*/
|
|
115
|
-
addresses: Address[];
|
|
116
|
-
/**
|
|
117
|
-
* certified peer record.
|
|
118
|
-
*/
|
|
119
|
-
record: CertifiedRecord;
|
|
120
|
-
};
|
|
63
|
+
type PeerStore = import('./types').PeerStore;
|
|
64
|
+
type Address = import('./types').Address;
|
|
121
65
|
//# sourceMappingURL=address-book.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../../src/peer-store/address-book.js"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../../src/peer-store/address-book.js"],"names":[],"mappings":";AAsBA;;GAEG;AACH;IACE;;;OAGG;IACH,kBAHW,SAAS,CAAC,MAAM,CAAC,SACjB,OAAO,SAAS,EAAE,KAAK,EAKjC;IAFC,2IAAiB;IACjB,gCAAmB;IAGrB;;;;;;OAMG;IACH,4BAFW,QAAQ,oBA+DlB;IAED;;OAEG;IACH,uBAFW,MAAM,mCAehB;IAED;;;;;OAKG;IACH,sBAFW,MAAM,iCAUhB;IAED;;OAEG;IACH,YAFW,MAAM,wCAmBhB;IAED;;;OAGG;IACH,YAHW,MAAM,cACN,SAAS,EAAE,iBAkDrB;IAED;;;OAGG;IACH,YAHW,MAAM,cACN,SAAS,EAAE,iBA2DrB;IAED;;OAEG;IACH,eAFW,MAAM,iBAyBhB;IAED;;;OAGG;IACH,6BAHW,MAAM,+BACM,OAAO,EAAE,KAAK,OAAO,EAAE,qCAe7C;CACF;;;;mBAvTY,OAAO,SAAS,EAAE,WAAW;;;;iBAF7B,OAAO,SAAS,EAAE,SAAS;eAC3B,OAAO,SAAS,EAAE,OAAO"}
|