libp2p 0.35.7 → 0.35.9-rc.2
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/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/identify/index.d.ts +4 -4
- package/dist/src/identify/index.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -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 +15 -18
- package/src/circuit/auto-relay.js +19 -19
- package/src/connection-manager/auto-dialler.js +9 -4
- package/src/connection-manager/index.js +39 -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/identify/index.js +28 -23
- package/src/index.js +33 -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 -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
|
@@ -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,
|
|
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,EA6ClC;IAxCC,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;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;;;;;;;;cA9TY,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"}
|
|
@@ -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
|
@@ -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;
|
|
@@ -367,7 +368,7 @@ declare class Libp2p extends EventEmitter {
|
|
|
367
368
|
*
|
|
368
369
|
* @param {string[]|string} protocols
|
|
369
370
|
*/
|
|
370
|
-
unhandle(protocols: string[] | string): void
|
|
371
|
+
unhandle(protocols: string[] | string): Promise<void>;
|
|
371
372
|
_onStarting(): Promise<void>;
|
|
372
373
|
/**
|
|
373
374
|
* Called when libp2p has started and before it returns
|
|
@@ -412,7 +413,7 @@ type Libp2pOptions = {
|
|
|
412
413
|
keychain?: (KeychainOptions & Keychain.KeychainOptions) | undefined;
|
|
413
414
|
metrics?: (MetricsOptions & Metrics.MetricsOptions) | undefined;
|
|
414
415
|
peerRouting?: PeerRouting.PeerRoutingOptions | undefined;
|
|
415
|
-
peerStore?:
|
|
416
|
+
peerStore?: PeerStoreOptions | undefined;
|
|
416
417
|
transportManager?: TransportManager.TransportManagerOptions | undefined;
|
|
417
418
|
config?: Libp2pConfig | undefined;
|
|
418
419
|
};
|
|
@@ -421,7 +422,6 @@ type constructorOptions = {
|
|
|
421
422
|
};
|
|
422
423
|
import PeerId = require("peer-id");
|
|
423
424
|
import Metrics = require("./metrics");
|
|
424
|
-
import PeerStore = require("./peer-store");
|
|
425
425
|
import AddressManager = require("./address-manager");
|
|
426
426
|
type Libp2pModules = {
|
|
427
427
|
transport: import("libp2p-interfaces/src/transport/types").TransportFactory<any, any>[];
|
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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"}
|
|
@@ -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"}
|
|
@@ -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,mCAmBhB;IAED;;;;;OAKG;IACH,sBAFW,MAAM,iCAUhB;IAED;;OAEG;IACH,YAFW,MAAM,wCA0BhB;IAED;;;OAGG;IACH,YAHW,MAAM,cACN,SAAS,EAAE,iBAsDrB;IAED;;;OAGG;IACH,YAHW,MAAM,cACN,SAAS,EAAE,iBAqDrB;IAED;;OAEG;IACH,eAFW,MAAM,iBA4BhB;IAED;;;OAGG;IACH,6BAHW,MAAM,+BACM,OAAO,EAAE,KAAK,OAAO,EAAE,qCAe7C;CACF;;;;mBAnUY,OAAO,SAAS,EAAE,WAAW;;;;iBAF7B,OAAO,SAAS,EAAE,SAAS;eAC3B,OAAO,SAAS,EAAE,OAAO"}
|