@libp2p/kad-dht 9.3.4 → 9.3.6-05abd49f
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 +3 -3
- package/dist/index.min.js +23 -23
- package/dist/src/content-fetching/index.d.ts +2 -2
- package/dist/src/content-fetching/index.d.ts.map +1 -1
- package/dist/src/content-fetching/index.js +4 -4
- package/dist/src/content-fetching/index.js.map +1 -1
- package/dist/src/dual-kad-dht.d.ts +5 -5
- package/dist/src/dual-kad-dht.d.ts.map +1 -1
- package/dist/src/dual-kad-dht.js +5 -5
- package/dist/src/dual-kad-dht.js.map +1 -1
- package/dist/src/index.d.ts +9 -10
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/kad-dht.d.ts +4 -4
- package/dist/src/kad-dht.d.ts.map +1 -1
- package/dist/src/kad-dht.js +7 -7
- package/dist/src/kad-dht.js.map +1 -1
- package/dist/src/message/index.d.ts +2 -2
- package/dist/src/message/index.d.ts.map +1 -1
- package/dist/src/message/index.js +1 -1
- package/dist/src/message/index.js.map +1 -1
- package/dist/src/network.d.ts +5 -5
- package/dist/src/network.d.ts.map +1 -1
- package/dist/src/network.js +2 -2
- package/dist/src/network.js.map +1 -1
- package/dist/src/peer-list/index.d.ts +1 -1
- package/dist/src/peer-list/peer-distance-list.d.ts +1 -1
- package/dist/src/peer-routing/index.d.ts +3 -3
- package/dist/src/peer-routing/index.d.ts.map +1 -1
- package/dist/src/peer-routing/index.js +3 -3
- package/dist/src/peer-routing/index.js.map +1 -1
- package/dist/src/providers.d.ts +2 -2
- package/dist/src/providers.d.ts.map +1 -1
- package/dist/src/query/events.d.ts +3 -3
- package/dist/src/query/events.d.ts.map +1 -1
- package/dist/src/query/events.js +1 -1
- package/dist/src/query/events.js.map +1 -1
- package/dist/src/query/manager.d.ts +3 -3
- package/dist/src/query/manager.d.ts.map +1 -1
- package/dist/src/query/manager.js +2 -2
- package/dist/src/query/manager.js.map +1 -1
- package/dist/src/query/query-path.d.ts +2 -2
- package/dist/src/query/query-path.d.ts.map +1 -1
- package/dist/src/query/query-path.js +1 -1
- package/dist/src/query/query-path.js.map +1 -1
- package/dist/src/query/types.d.ts +1 -1
- package/dist/src/query-self.d.ts +10 -7
- package/dist/src/query-self.d.ts.map +1 -1
- package/dist/src/query-self.js +31 -47
- package/dist/src/query-self.js.map +1 -1
- package/dist/src/record/index.d.ts +22 -0
- package/dist/src/record/index.d.ts.map +1 -0
- package/dist/src/record/index.js +53 -0
- package/dist/src/record/index.js.map +1 -0
- package/dist/src/record/record.d.ts +13 -0
- package/dist/src/record/record.d.ts.map +1 -0
- package/dist/src/record/record.js +67 -0
- package/dist/src/record/record.js.map +1 -0
- package/dist/src/record/selectors.d.ts +7 -0
- package/dist/src/record/selectors.d.ts.map +1 -0
- package/dist/src/record/selectors.js +38 -0
- package/dist/src/record/selectors.js.map +1 -0
- package/dist/src/record/utils.d.ts +11 -0
- package/dist/src/record/utils.d.ts.map +1 -0
- package/dist/src/record/utils.js +41 -0
- package/dist/src/record/utils.js.map +1 -0
- package/dist/src/record/validators.d.ts +10 -0
- package/dist/src/record/validators.d.ts.map +1 -0
- package/dist/src/record/validators.js +54 -0
- package/dist/src/record/validators.js.map +1 -0
- package/dist/src/routing-table/index.d.ts +11 -6
- package/dist/src/routing-table/index.d.ts.map +1 -1
- package/dist/src/routing-table/index.js +7 -3
- package/dist/src/routing-table/index.js.map +1 -1
- package/dist/src/routing-table/k-bucket.d.ts +2 -2
- package/dist/src/routing-table/k-bucket.d.ts.map +1 -1
- package/dist/src/routing-table/k-bucket.js +1 -1
- package/dist/src/routing-table/k-bucket.js.map +1 -1
- package/dist/src/routing-table/refresh.d.ts +1 -1
- package/dist/src/rpc/handlers/add-provider.d.ts +1 -1
- package/dist/src/rpc/handlers/add-provider.js +1 -1
- package/dist/src/rpc/handlers/add-provider.js.map +1 -1
- package/dist/src/rpc/handlers/find-node.d.ts +2 -2
- package/dist/src/rpc/handlers/find-node.d.ts.map +1 -1
- package/dist/src/rpc/handlers/get-providers.d.ts +3 -3
- package/dist/src/rpc/handlers/get-providers.js +1 -1
- package/dist/src/rpc/handlers/get-providers.js.map +1 -1
- package/dist/src/rpc/handlers/get-value.d.ts +3 -3
- package/dist/src/rpc/handlers/get-value.d.ts.map +1 -1
- package/dist/src/rpc/handlers/get-value.js +2 -2
- package/dist/src/rpc/handlers/get-value.js.map +1 -1
- package/dist/src/rpc/handlers/ping.d.ts +1 -1
- package/dist/src/rpc/handlers/put-value.d.ts +1 -1
- package/dist/src/rpc/handlers/put-value.js +2 -2
- package/dist/src/rpc/handlers/put-value.js.map +1 -1
- package/dist/src/rpc/index.d.ts +2 -2
- package/dist/src/rpc/index.d.ts.map +1 -1
- package/dist/src/topology-listener.d.ts +3 -3
- package/dist/src/topology-listener.d.ts.map +1 -1
- package/dist/src/topology-listener.js +2 -4
- package/dist/src/topology-listener.js.map +1 -1
- package/dist/src/utils.d.ts +2 -2
- package/dist/src/utils.d.ts.map +1 -1
- package/dist/src/utils.js +1 -1
- package/dist/src/utils.js.map +1 -1
- package/package.json +31 -136
- package/src/content-fetching/index.ts +5 -5
- package/src/content-routing/index.ts +1 -1
- package/src/dual-kad-dht.ts +7 -7
- package/src/index.ts +9 -10
- package/src/kad-dht.ts +12 -10
- package/src/message/index.ts +2 -2
- package/src/network.ts +7 -7
- package/src/peer-list/index.ts +1 -1
- package/src/peer-list/peer-distance-list.ts +1 -1
- package/src/peer-routing/index.ts +6 -6
- package/src/providers.ts +2 -2
- package/src/query/events.ts +4 -4
- package/src/query/manager.ts +5 -5
- package/src/query/query-path.ts +3 -3
- package/src/query/types.ts +1 -1
- package/src/query-self.ts +68 -86
- package/src/record/index.ts +70 -0
- package/src/record/record.proto +20 -0
- package/src/record/record.ts +87 -0
- package/src/record/selectors.ts +50 -0
- package/src/record/utils.ts +46 -0
- package/src/record/validators.ts +69 -0
- package/src/routing-table/index.ts +20 -8
- package/src/routing-table/k-bucket.ts +2 -2
- package/src/routing-table/refresh.ts +1 -1
- package/src/rpc/handlers/add-provider.ts +2 -2
- package/src/rpc/handlers/find-node.ts +3 -3
- package/src/rpc/handlers/get-providers.ts +4 -4
- package/src/rpc/handlers/get-value.ts +4 -4
- package/src/rpc/handlers/ping.ts +1 -1
- package/src/rpc/handlers/put-value.ts +3 -3
- package/src/rpc/index.ts +2 -2
- package/src/topology-listener.ts +4 -6
- package/src/utils.ts +3 -3
- package/dist/typedoc-urls.json +0 -29
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { EventEmitter } from '@libp2p/
|
|
1
|
+
import { EventEmitter } from '@libp2p/interface/events';
|
|
2
2
|
import type { KadDHTComponents } from '.';
|
|
3
|
-
import type { PeerId } from '@libp2p/interface
|
|
4
|
-
import type { Startable } from '@libp2p/
|
|
3
|
+
import type { PeerId } from '@libp2p/interface/peer-id';
|
|
4
|
+
import type { Startable } from '@libp2p/interface/startable';
|
|
5
5
|
export interface TopologyListenerInit {
|
|
6
6
|
protocol: string;
|
|
7
7
|
lan: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topology-listener.d.ts","sourceRoot":"","sources":["../../src/topology-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"topology-listener.d.ts","sourceRoot":"","sources":["../../src/topology-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,GAAG,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAA;AAG5D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,OAAO,CAAA;CACb;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;CAC5B;AAED;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,YAAY,CAAC,sBAAsB,CAAE,YAAW,SAAS;IAC7F,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAQ;IAC5B,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAkB;IAC7C,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAQ;IACjC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,WAAW,CAAC,CAAQ;gBAEf,UAAU,EAAE,gBAAgB,EAAE,IAAI,EAAE,oBAAoB;IAWrE,SAAS,IAAK,OAAO;IAIrB;;OAEG;IACG,KAAK,IAAK,OAAO,CAAC,IAAI,CAAC;IAkB7B;;OAEG;IACG,IAAI,IAAK,OAAO,CAAC,IAAI,CAAC;CAS7B"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { CustomEvent, EventEmitter } from '@libp2p/
|
|
1
|
+
import { CustomEvent, EventEmitter } from '@libp2p/interface/events';
|
|
2
2
|
import { logger } from '@libp2p/logger';
|
|
3
|
-
import { createTopology } from '@libp2p/topology';
|
|
4
3
|
/**
|
|
5
4
|
* Receives notifications of new peers joining the network that support the DHT protocol
|
|
6
5
|
*/
|
|
@@ -30,7 +29,7 @@ export class TopologyListener extends EventEmitter {
|
|
|
30
29
|
}
|
|
31
30
|
this.running = true;
|
|
32
31
|
// register protocol with topology
|
|
33
|
-
|
|
32
|
+
this.registrarId = await this.components.registrar.register(this.protocol, {
|
|
34
33
|
onConnect: (peerId) => {
|
|
35
34
|
this.log('observed peer %p with protocol %s', peerId, this.protocol);
|
|
36
35
|
this.dispatchEvent(new CustomEvent('peer', {
|
|
@@ -38,7 +37,6 @@ export class TopologyListener extends EventEmitter {
|
|
|
38
37
|
}));
|
|
39
38
|
}
|
|
40
39
|
});
|
|
41
|
-
this.registrarId = await this.components.registrar.register(this.protocol, topology);
|
|
42
40
|
}
|
|
43
41
|
/**
|
|
44
42
|
* Stop all network activity
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topology-listener.js","sourceRoot":"","sources":["../../src/topology-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"topology-listener.js","sourceRoot":"","sources":["../../src/topology-listener.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAA;AAevC;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,YAAoC;IACvD,GAAG,CAAQ;IACX,UAAU,CAAkB;IAC5B,QAAQ,CAAQ;IACzB,OAAO,CAAS;IAChB,WAAW,CAAS;IAE5B,YAAa,UAA4B,EAAE,IAA0B;QACnE,KAAK,EAAE,CAAA;QAEP,MAAM,EAAE,QAAQ,EAAE,GAAG,EAAE,GAAG,IAAI,CAAA;QAE9B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,oCAAoC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAA;QAC5E,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QACpB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAC1B,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,KAAK;QACT,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,OAAM;SACP;QAED,IAAI,CAAC,OAAO,GAAG,IAAI,CAAA;QAEnB,kCAAkC;QAClC,IAAI,CAAC,WAAW,GAAG,MAAM,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE;YACzE,SAAS,EAAE,CAAC,MAAM,EAAE,EAAE;gBACpB,IAAI,CAAC,GAAG,CAAC,mCAAmC,EAAE,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;gBACpE,IAAI,CAAC,aAAa,CAAC,IAAI,WAAW,CAAC,MAAM,EAAE;oBACzC,MAAM,EAAE,MAAM;iBACf,CAAC,CAAC,CAAA;YACL,CAAC;SACF,CAAC,CAAA;IACJ,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI;QACR,IAAI,CAAC,OAAO,GAAG,KAAK,CAAA;QAEpB,mCAAmC;QACnC,IAAI,IAAI,CAAC,WAAW,IAAI,IAAI,EAAE;YAC5B,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YACtD,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;SAC7B;IACH,CAAC;CACF"}
|
package/dist/src/utils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Key } from 'interface-datastore/key';
|
|
2
|
-
import type { PeerId } from '@libp2p/interface
|
|
3
|
-
import type { PeerInfo } from '@libp2p/interface
|
|
2
|
+
import type { PeerId } from '@libp2p/interface/peer-id';
|
|
3
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info';
|
|
4
4
|
export declare function removePrivateAddresses(peer: PeerInfo): PeerInfo;
|
|
5
5
|
export declare function removePublicAddresses(peer: PeerInfo): PeerInfo;
|
|
6
6
|
/**
|
package/dist/src/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,yBAAyB,CAAA;AAQ7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACvD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAA;AAK3D,wBAAgB,sBAAsB,CAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAkChE;AAED,wBAAgB,qBAAqB,CAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,CA4B/D;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC,CAIzE;AAED;;GAEG;AACH,wBAAsB,aAAa,CAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAExE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAE,GAAG,EAAE,UAAU,GAAG,GAAG,CAEjD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAE,GAAG,EAAE,UAAU,GAAG,GAAG,CAEvD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAE,IAAI,EAAE,MAAM,GAAG,UAAU,CAKzD;AAED,wBAAgB,cAAc,CAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAExD;AAED,wBAAgB,SAAS,CAAE,GAAG,EAAE,UAAU,GAAG,OAAO,CAEnD;AAED,wBAAgB,gBAAgB,CAAE,GAAG,EAAE,UAAU,GAAG,MAAM,CAEzD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,UAAU,CAK/E;AAED,wBAAgB,QAAQ,CAAE,QAAQ,EAAE,MAAM,IAAI,EAAE,IAAI,GAAE,MAAY,GAAG,MAAM,IAAI,CAO9E"}
|
package/dist/src/utils.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { peerIdFromBytes } from '@libp2p/peer-id';
|
|
2
|
-
import { Libp2pRecord } from '@libp2p/record';
|
|
3
2
|
import { Key } from 'interface-datastore/key';
|
|
4
3
|
import { sha256 } from 'multiformats/hashes/sha2';
|
|
5
4
|
import isPrivateIp from 'private-ip';
|
|
@@ -7,6 +6,7 @@ import { concat as uint8ArrayConcat } from 'uint8arrays/concat';
|
|
|
7
6
|
import { fromString as uint8ArrayFromString } from 'uint8arrays/from-string';
|
|
8
7
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
|
|
9
8
|
import { RECORD_KEY_PREFIX } from './constants.js';
|
|
9
|
+
import { Libp2pRecord } from './record/index.js';
|
|
10
10
|
// const IPNS_PREFIX = uint8ArrayFromString('/ipns/')
|
|
11
11
|
const PK_PREFIX = uint8ArrayFromString('/pk/');
|
|
12
12
|
export function removePrivateAddresses(peer) {
|
package/dist/src/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/utils.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@libp2p/kad-dht",
|
|
3
|
-
"version": "9.3.
|
|
3
|
+
"version": "9.3.6-05abd49f",
|
|
4
4
|
"description": "JavaScript implementation of the Kad-DHT for libp2p",
|
|
5
5
|
"license": "Apache-2.0 OR MIT",
|
|
6
|
-
"homepage": "https://github.com/libp2p/js-libp2p
|
|
6
|
+
"homepage": "https://github.com/libp2p/js-libp2p/tree/master/packages/kad-dht#readme",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
|
9
|
-
"url": "git+https://github.com/libp2p/js-libp2p
|
|
9
|
+
"url": "git+https://github.com/libp2p/js-libp2p.git"
|
|
10
10
|
},
|
|
11
11
|
"bugs": {
|
|
12
|
-
"url": "https://github.com/libp2p/js-libp2p
|
|
12
|
+
"url": "https://github.com/libp2p/js-libp2p/issues"
|
|
13
13
|
},
|
|
14
14
|
"keywords": [
|
|
15
15
|
"IPFS"
|
|
16
16
|
],
|
|
17
|
-
"engines": {
|
|
18
|
-
"node": ">=16.0.0",
|
|
19
|
-
"npm": ">=7.0.0"
|
|
20
|
-
},
|
|
21
17
|
"type": "module",
|
|
22
18
|
"types": "./dist/src/index.d.ts",
|
|
23
19
|
"files": [
|
|
@@ -41,91 +37,6 @@
|
|
|
41
37
|
"src/message/dht.d.ts"
|
|
42
38
|
]
|
|
43
39
|
},
|
|
44
|
-
"release": {
|
|
45
|
-
"branches": [
|
|
46
|
-
"master"
|
|
47
|
-
],
|
|
48
|
-
"plugins": [
|
|
49
|
-
[
|
|
50
|
-
"@semantic-release/commit-analyzer",
|
|
51
|
-
{
|
|
52
|
-
"preset": "conventionalcommits",
|
|
53
|
-
"releaseRules": [
|
|
54
|
-
{
|
|
55
|
-
"breaking": true,
|
|
56
|
-
"release": "major"
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
"revert": true,
|
|
60
|
-
"release": "patch"
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
"type": "feat",
|
|
64
|
-
"release": "minor"
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
"type": "fix",
|
|
68
|
-
"release": "patch"
|
|
69
|
-
},
|
|
70
|
-
{
|
|
71
|
-
"type": "docs",
|
|
72
|
-
"release": "patch"
|
|
73
|
-
},
|
|
74
|
-
{
|
|
75
|
-
"type": "test",
|
|
76
|
-
"release": "patch"
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
"type": "deps",
|
|
80
|
-
"release": "patch"
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
"scope": "no-release",
|
|
84
|
-
"release": false
|
|
85
|
-
}
|
|
86
|
-
]
|
|
87
|
-
}
|
|
88
|
-
],
|
|
89
|
-
[
|
|
90
|
-
"@semantic-release/release-notes-generator",
|
|
91
|
-
{
|
|
92
|
-
"preset": "conventionalcommits",
|
|
93
|
-
"presetConfig": {
|
|
94
|
-
"types": [
|
|
95
|
-
{
|
|
96
|
-
"type": "feat",
|
|
97
|
-
"section": "Features"
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
"type": "fix",
|
|
101
|
-
"section": "Bug Fixes"
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"type": "chore",
|
|
105
|
-
"section": "Trivial Changes"
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
"type": "docs",
|
|
109
|
-
"section": "Documentation"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
"type": "deps",
|
|
113
|
-
"section": "Dependencies"
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"type": "test",
|
|
117
|
-
"section": "Tests"
|
|
118
|
-
}
|
|
119
|
-
]
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
],
|
|
123
|
-
"@semantic-release/changelog",
|
|
124
|
-
"@semantic-release/npm",
|
|
125
|
-
"@semantic-release/github",
|
|
126
|
-
"@semantic-release/git"
|
|
127
|
-
]
|
|
128
|
-
},
|
|
129
40
|
"scripts": {
|
|
130
41
|
"clean": "aegir clean",
|
|
131
42
|
"lint": "aegir lint",
|
|
@@ -137,70 +48,56 @@
|
|
|
137
48
|
"test:chrome-webworker": "aegir test -t webworker",
|
|
138
49
|
"test:firefox": "aegir test -t browser -- --browser firefox",
|
|
139
50
|
"test:firefox-webworker": "aegir test -t webworker -- --browser firefox",
|
|
140
|
-
"dep-check": "aegir dep-check -i
|
|
141
|
-
"release": "aegir release",
|
|
142
|
-
"docs": "aegir docs"
|
|
51
|
+
"dep-check": "aegir dep-check -i events"
|
|
143
52
|
},
|
|
144
53
|
"dependencies": {
|
|
145
|
-
"@libp2p/crypto": "
|
|
146
|
-
"@libp2p/interface
|
|
147
|
-
"@libp2p/interface-
|
|
148
|
-
"@libp2p/
|
|
149
|
-
"@libp2p/
|
|
150
|
-
"@libp2p/
|
|
151
|
-
"@
|
|
152
|
-
"@
|
|
153
|
-
"@libp2p/interface-peer-info": "^1.0.3",
|
|
154
|
-
"@libp2p/interface-peer-routing": "^1.1.0",
|
|
155
|
-
"@libp2p/interface-peer-store": "^2.0.0",
|
|
156
|
-
"@libp2p/interface-registrar": "^2.0.11",
|
|
157
|
-
"@libp2p/interfaces": "^3.2.0",
|
|
158
|
-
"@libp2p/logger": "^2.0.1",
|
|
159
|
-
"@libp2p/peer-collections": "^3.0.0",
|
|
160
|
-
"@libp2p/peer-id": "^2.0.0",
|
|
161
|
-
"@libp2p/record": "^3.0.0",
|
|
162
|
-
"@libp2p/topology": "^4.0.0",
|
|
163
|
-
"@multiformats/multiaddr": "^12.0.0",
|
|
164
|
-
"@types/sinon": "^10.0.14",
|
|
54
|
+
"@libp2p/crypto": "1.0.17-05abd49f",
|
|
55
|
+
"@libp2p/interface": "0.0.1-05abd49f",
|
|
56
|
+
"@libp2p/interface-internal": "0.0.1-05abd49f",
|
|
57
|
+
"@libp2p/logger": "2.1.1-05abd49f",
|
|
58
|
+
"@libp2p/peer-collections": "3.0.2-05abd49f",
|
|
59
|
+
"@libp2p/peer-id": "2.0.3-05abd49f",
|
|
60
|
+
"@multiformats/multiaddr": "^12.1.3",
|
|
61
|
+
"@types/sinon": "^10.0.15",
|
|
165
62
|
"abortable-iterator": "^5.0.1",
|
|
166
63
|
"any-signal": "^4.1.1",
|
|
167
64
|
"datastore-core": "^9.0.1",
|
|
168
65
|
"events": "^3.3.0",
|
|
169
66
|
"hashlru": "^2.3.0",
|
|
170
|
-
"interface-datastore": "^8.
|
|
171
|
-
"it-all": "^3.0.
|
|
172
|
-
"it-drain": "^3.0.
|
|
67
|
+
"interface-datastore": "^8.2.0",
|
|
68
|
+
"it-all": "^3.0.2",
|
|
69
|
+
"it-drain": "^3.0.2",
|
|
173
70
|
"it-first": "^3.0.1",
|
|
174
71
|
"it-length": "^3.0.1",
|
|
175
|
-
"it-length-prefixed": "^9.0.
|
|
176
|
-
"it-map": "^3.0.
|
|
72
|
+
"it-length-prefixed": "^9.0.1",
|
|
73
|
+
"it-map": "^3.0.3",
|
|
177
74
|
"it-merge": "^3.0.0",
|
|
178
75
|
"it-parallel": "^3.0.0",
|
|
179
|
-
"it-pipe": "^3.0.
|
|
76
|
+
"it-pipe": "^3.0.1",
|
|
180
77
|
"it-stream-types": "^2.0.1",
|
|
181
78
|
"it-take": "^3.0.1",
|
|
182
|
-
"multiformats": "^
|
|
79
|
+
"multiformats": "^12.0.1",
|
|
183
80
|
"p-defer": "^4.0.0",
|
|
81
|
+
"p-event": "^6.0.0",
|
|
184
82
|
"p-queue": "^7.3.4",
|
|
185
83
|
"private-ip": "^3.0.0",
|
|
186
84
|
"progress-events": "^1.0.0",
|
|
187
85
|
"protons-runtime": "^5.0.0",
|
|
188
|
-
"uint8arraylist": "^2.
|
|
189
|
-
"uint8arrays": "^4.0.
|
|
86
|
+
"uint8arraylist": "^2.4.3",
|
|
87
|
+
"uint8arrays": "^4.0.4",
|
|
190
88
|
"varint": "^6.0.0"
|
|
191
89
|
},
|
|
192
90
|
"devDependencies": {
|
|
193
|
-
"@libp2p/interface-
|
|
194
|
-
"@libp2p/
|
|
195
|
-
"@libp2p/peer-
|
|
196
|
-
"@libp2p/peer-store": "^8.0.0",
|
|
91
|
+
"@libp2p/interface-compliance-tests": "3.0.7-05abd49f",
|
|
92
|
+
"@libp2p/peer-id-factory": "2.0.3-05abd49f",
|
|
93
|
+
"@libp2p/peer-store": "8.2.1-05abd49f",
|
|
197
94
|
"@types/lodash.random": "^3.2.6",
|
|
198
95
|
"@types/lodash.range": "^3.2.6",
|
|
199
96
|
"@types/varint": "^6.0.0",
|
|
200
97
|
"@types/which": "^3.0.0",
|
|
201
|
-
"aegir": "^39.0.
|
|
98
|
+
"aegir": "^39.0.10",
|
|
202
99
|
"datastore-level": "^10.0.0",
|
|
203
|
-
"delay": "^
|
|
100
|
+
"delay": "^6.0.0",
|
|
204
101
|
"execa": "^7.0.0",
|
|
205
102
|
"it-filter": "^3.0.1",
|
|
206
103
|
"it-last": "^3.0.1",
|
|
@@ -209,16 +106,14 @@
|
|
|
209
106
|
"p-retry": "^5.0.0",
|
|
210
107
|
"p-wait-for": "^5.0.0",
|
|
211
108
|
"protons": "^7.0.2",
|
|
212
|
-
"sinon": "^15.
|
|
109
|
+
"sinon": "^15.1.2",
|
|
213
110
|
"ts-sinon": "^2.0.2",
|
|
214
111
|
"which": "^3.0.0"
|
|
215
112
|
},
|
|
216
113
|
"browser": {
|
|
217
114
|
"./dist/src/routing-table/generated-prefix-list.js": "./dist/src/routing-table/generated-prefix-list-browser.js"
|
|
218
115
|
},
|
|
219
|
-
"
|
|
220
|
-
"
|
|
221
|
-
"KadDHTInit": "https://libp2p.github.io/js-libp2p-kad-dht/interfaces/KadDHTInit.html",
|
|
222
|
-
"kadDHT": "https://libp2p.github.io/js-libp2p-kad-dht/functions/kadDHT.html"
|
|
116
|
+
"typedoc": {
|
|
117
|
+
"entryPoint": "./src/index.ts"
|
|
223
118
|
}
|
|
224
119
|
}
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import { CodeError } from '@libp2p/
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
2
2
|
import { logger } from '@libp2p/logger'
|
|
3
|
-
import { Libp2pRecord } from '@libp2p/record'
|
|
4
|
-
import { bestRecord } from '@libp2p/record/selectors'
|
|
5
|
-
import { verifyRecord } from '@libp2p/record/validators'
|
|
6
3
|
import map from 'it-map'
|
|
7
4
|
import parallel from 'it-parallel'
|
|
8
5
|
import { pipe } from 'it-pipe'
|
|
@@ -15,13 +12,16 @@ import {
|
|
|
15
12
|
valueEvent,
|
|
16
13
|
queryErrorEvent
|
|
17
14
|
} from '../query/events.js'
|
|
15
|
+
import { Libp2pRecord } from '../record/index.js'
|
|
16
|
+
import { bestRecord } from '../record/selectors.js'
|
|
17
|
+
import { verifyRecord } from '../record/validators.js'
|
|
18
18
|
import { createPutRecord, bufferToRecordKey } from '../utils.js'
|
|
19
19
|
import type { KadDHTComponents, Validators, Selectors, ValueEvent, QueryOptions, QueryEvent } from '../index.js'
|
|
20
20
|
import type { Network } from '../network.js'
|
|
21
21
|
import type { PeerRouting } from '../peer-routing/index.js'
|
|
22
22
|
import type { QueryManager } from '../query/manager.js'
|
|
23
23
|
import type { QueryFunc } from '../query/types.js'
|
|
24
|
-
import type { AbortOptions } from '@libp2p/
|
|
24
|
+
import type { AbortOptions } from '@libp2p/interface'
|
|
25
25
|
import type { Logger } from '@libp2p/logger'
|
|
26
26
|
|
|
27
27
|
export interface ContentFetchingInit {
|
|
@@ -16,7 +16,7 @@ import type { Providers } from '../providers.js'
|
|
|
16
16
|
import type { QueryManager } from '../query/manager.js'
|
|
17
17
|
import type { QueryFunc } from '../query/types.js'
|
|
18
18
|
import type { RoutingTable } from '../routing-table/index.js'
|
|
19
|
-
import type { PeerInfo } from '@libp2p/interface
|
|
19
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
20
20
|
import type { Logger } from '@libp2p/logger'
|
|
21
21
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
22
22
|
import type { CID } from 'multiformats/cid'
|
package/src/dual-kad-dht.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { type ContentRouting, contentRouting } from '@libp2p/interface
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { type ContentRouting, contentRouting } from '@libp2p/interface/content-routing'
|
|
2
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
3
|
+
import { EventEmitter, CustomEvent } from '@libp2p/interface/events'
|
|
4
|
+
import { type PeerDiscovery, peerDiscovery, type PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery'
|
|
5
|
+
import { type PeerRouting, peerRouting } from '@libp2p/interface/peer-routing'
|
|
6
6
|
import { logger } from '@libp2p/logger'
|
|
7
7
|
import drain from 'it-drain'
|
|
8
8
|
import merge from 'it-merge'
|
|
@@ -10,8 +10,8 @@ import isPrivate from 'private-ip'
|
|
|
10
10
|
import { DefaultKadDHT } from './kad-dht.js'
|
|
11
11
|
import { queryErrorEvent } from './query/events.js'
|
|
12
12
|
import type { DualKadDHT, KadDHT, KadDHTComponents, KadDHTInit, QueryEvent, QueryOptions } from './index.js'
|
|
13
|
-
import type { PeerId } from '@libp2p/interface
|
|
14
|
-
import type { PeerInfo } from '@libp2p/interface
|
|
13
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
14
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
15
15
|
import type { Multiaddr } from '@multiformats/multiaddr'
|
|
16
16
|
import type { CID } from 'multiformats/cid'
|
|
17
17
|
|
package/src/index.ts
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import { DefaultDualKadDHT } from './dual-kad-dht.js'
|
|
2
2
|
import type { ProvidersInit } from './providers.js'
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
8
|
-
import type {
|
|
9
|
-
import type {
|
|
10
|
-
import type {
|
|
11
|
-
import type {
|
|
12
|
-
import type { EventEmitter } from '@libp2p/interfaces/events'
|
|
3
|
+
import type { Libp2pEvents, AbortOptions } from '@libp2p/interface'
|
|
4
|
+
import type { EventEmitter } from '@libp2p/interface/events'
|
|
5
|
+
import type { Metrics } from '@libp2p/interface/metrics'
|
|
6
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
7
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
8
|
+
import type { PeerStore } from '@libp2p/interface/peer-store'
|
|
9
|
+
import type { AddressManager } from '@libp2p/interface-internal/address-manager'
|
|
10
|
+
import type { ConnectionManager } from '@libp2p/interface-internal/connection-manager'
|
|
11
|
+
import type { Registrar } from '@libp2p/interface-internal/registrar'
|
|
13
12
|
import type { Datastore } from 'interface-datastore'
|
|
14
13
|
import type { CID } from 'multiformats/cid'
|
|
15
14
|
import type { ProgressOptions, ProgressEvent } from 'progress-events'
|
package/src/kad-dht.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { CustomEvent, EventEmitter } from '@libp2p/
|
|
1
|
+
import { CustomEvent, EventEmitter } from '@libp2p/interface/events'
|
|
2
2
|
import { type Logger, logger } from '@libp2p/logger'
|
|
3
|
-
import { selectors as recordSelectors } from '@libp2p/record/selectors'
|
|
4
|
-
import { validators as recordValidators } from '@libp2p/record/validators'
|
|
5
3
|
import pDefer from 'p-defer'
|
|
6
4
|
import { PROTOCOL_DHT, PROTOCOL_PREFIX, LAN_PREFIX } from './constants.js'
|
|
7
5
|
import { ContentFetching } from './content-fetching/index.js'
|
|
@@ -11,6 +9,8 @@ import { PeerRouting } from './peer-routing/index.js'
|
|
|
11
9
|
import { Providers } from './providers.js'
|
|
12
10
|
import { QueryManager } from './query/manager.js'
|
|
13
11
|
import { QuerySelf } from './query-self.js'
|
|
12
|
+
import { selectors as recordSelectors } from './record/selectors.js'
|
|
13
|
+
import { validators as recordValidators } from './record/validators.js'
|
|
14
14
|
import { RoutingTable } from './routing-table/index.js'
|
|
15
15
|
import { RoutingTableRefresh } from './routing-table/refresh.js'
|
|
16
16
|
import { RPC } from './rpc/index.js'
|
|
@@ -20,9 +20,9 @@ import {
|
|
|
20
20
|
removePublicAddresses
|
|
21
21
|
} from './utils.js'
|
|
22
22
|
import type { KadDHTComponents, KadDHTInit, QueryOptions, Validators, Selectors, KadDHT, QueryEvent } from './index.js'
|
|
23
|
-
import type { PeerDiscoveryEvents } from '@libp2p/interface
|
|
24
|
-
import type { PeerId } from '@libp2p/interface
|
|
25
|
-
import type { PeerInfo } from '@libp2p/interface
|
|
23
|
+
import type { PeerDiscoveryEvents } from '@libp2p/interface/peer-discovery'
|
|
24
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
25
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
26
26
|
import type { CID } from 'multiformats/cid'
|
|
27
27
|
|
|
28
28
|
export const DEFAULT_MAX_INBOUND_STREAMS = 32
|
|
@@ -285,10 +285,11 @@ export class DefaultKadDHT extends EventEmitter<PeerDiscoveryEvents> implements
|
|
|
285
285
|
this.queryManager.start(),
|
|
286
286
|
this.network.start(),
|
|
287
287
|
this.routingTable.start(),
|
|
288
|
-
this.topologyListener.start()
|
|
289
|
-
this.querySelf.start()
|
|
288
|
+
this.topologyListener.start()
|
|
290
289
|
])
|
|
291
290
|
|
|
291
|
+
this.querySelf.start()
|
|
292
|
+
|
|
292
293
|
await this.routingTableRefresh.start()
|
|
293
294
|
}
|
|
294
295
|
|
|
@@ -299,14 +300,15 @@ export class DefaultKadDHT extends EventEmitter<PeerDiscoveryEvents> implements
|
|
|
299
300
|
async stop (): Promise<void> {
|
|
300
301
|
this.running = false
|
|
301
302
|
|
|
303
|
+
this.querySelf.stop()
|
|
304
|
+
|
|
302
305
|
await Promise.all([
|
|
303
306
|
this.providers.stop(),
|
|
304
307
|
this.queryManager.stop(),
|
|
305
308
|
this.network.stop(),
|
|
306
309
|
this.routingTable.stop(),
|
|
307
310
|
this.routingTableRefresh.stop(),
|
|
308
|
-
this.topologyListener.stop()
|
|
309
|
-
this.querySelf.stop()
|
|
311
|
+
this.topologyListener.stop()
|
|
310
312
|
])
|
|
311
313
|
}
|
|
312
314
|
|
package/src/message/index.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { peerIdFromBytes } from '@libp2p/peer-id'
|
|
2
|
-
import { Libp2pRecord } from '@libp2p/record'
|
|
3
2
|
import { multiaddr } from '@multiformats/multiaddr'
|
|
3
|
+
import { Libp2pRecord } from '../record/index.js'
|
|
4
4
|
import { Message as PBMessage } from './dht.js'
|
|
5
|
-
import type { PeerInfo } from '@libp2p/interface
|
|
5
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
6
6
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
|
7
7
|
|
|
8
8
|
export const MESSAGE_TYPE = PBMessage.MessageType
|
package/src/network.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { CodeError } from '@libp2p/
|
|
2
|
-
import { EventEmitter, CustomEvent } from '@libp2p/
|
|
1
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
2
|
+
import { EventEmitter, CustomEvent } from '@libp2p/interface/events'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { abortableDuplex } from 'abortable-iterator'
|
|
5
5
|
import drain from 'it-drain'
|
|
@@ -14,11 +14,11 @@ import {
|
|
|
14
14
|
queryErrorEvent
|
|
15
15
|
} from './query/events.js'
|
|
16
16
|
import type { KadDHTComponents, QueryEvent, QueryOptions } from './index.js'
|
|
17
|
-
import type {
|
|
18
|
-
import type {
|
|
19
|
-
import type {
|
|
20
|
-
import type {
|
|
21
|
-
import type { Startable } from '@libp2p/
|
|
17
|
+
import type { AbortOptions } from '@libp2p/interface'
|
|
18
|
+
import type { Stream } from '@libp2p/interface/connection'
|
|
19
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
20
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
21
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
22
22
|
import type { Logger } from '@libp2p/logger'
|
|
23
23
|
import type { Duplex, Source } from 'it-stream-types'
|
|
24
24
|
import type { Uint8ArrayList } from 'uint8arraylist'
|
package/src/peer-list/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { compare as uint8ArrayCompare } from 'uint8arrays/compare'
|
|
2
2
|
import { xor as uint8ArrayXor } from 'uint8arrays/xor'
|
|
3
3
|
import * as utils from '../utils.js'
|
|
4
|
-
import type { PeerId } from '@libp2p/interface
|
|
4
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
5
5
|
|
|
6
6
|
interface PeerDistance {
|
|
7
7
|
peerId: PeerId
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { keys } from '@libp2p/crypto'
|
|
2
|
-
import { CodeError } from '@libp2p/
|
|
2
|
+
import { CodeError } from '@libp2p/interface/errors'
|
|
3
3
|
import { logger } from '@libp2p/logger'
|
|
4
4
|
import { peerIdFromKeys } from '@libp2p/peer-id'
|
|
5
|
-
import { Libp2pRecord } from '@libp2p/record'
|
|
6
|
-
import { verifyRecord } from '@libp2p/record/validators'
|
|
7
5
|
import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
|
|
8
6
|
import { Message, MESSAGE_TYPE } from '../message/index.js'
|
|
9
7
|
import { PeerDistanceList } from '../peer-list/peer-distance-list.js'
|
|
@@ -12,15 +10,17 @@ import {
|
|
|
12
10
|
finalPeerEvent,
|
|
13
11
|
valueEvent
|
|
14
12
|
} from '../query/events.js'
|
|
13
|
+
import { Libp2pRecord } from '../record/index.js'
|
|
14
|
+
import { verifyRecord } from '../record/validators.js'
|
|
15
15
|
import * as utils from '../utils.js'
|
|
16
16
|
import type { KadDHTComponents, DHTRecord, DialPeerEvent, FinalPeerEvent, QueryEvent, Validators } from '../index.js'
|
|
17
17
|
import type { Network } from '../network.js'
|
|
18
18
|
import type { QueryManager, QueryOptions } from '../query/manager.js'
|
|
19
19
|
import type { QueryFunc } from '../query/types.js'
|
|
20
20
|
import type { RoutingTable } from '../routing-table/index.js'
|
|
21
|
-
import type {
|
|
22
|
-
import type {
|
|
23
|
-
import type {
|
|
21
|
+
import type { AbortOptions } from '@libp2p/interface'
|
|
22
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
23
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
24
24
|
import type { Logger } from '@libp2p/logger'
|
|
25
25
|
|
|
26
26
|
export interface PeerRoutingInit {
|
package/src/providers.ts
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
PROVIDERS_LRU_CACHE_SIZE,
|
|
12
12
|
PROVIDER_KEY_PREFIX
|
|
13
13
|
} from './constants.js'
|
|
14
|
-
import type { PeerId } from '@libp2p/interface
|
|
15
|
-
import type { Startable } from '@libp2p/
|
|
14
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
15
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
16
16
|
import type { Datastore } from 'interface-datastore'
|
|
17
17
|
import type { CID } from 'multiformats'
|
|
18
18
|
|
package/src/query/events.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { CustomEvent } from '@libp2p/
|
|
1
|
+
import { CustomEvent } from '@libp2p/interface/events'
|
|
2
2
|
import { MESSAGE_TYPE_LOOKUP } from '../message/index.js'
|
|
3
3
|
import type { SendQueryEvent, PeerResponseEvent, DialPeerEvent, AddPeerEvent, ValueEvent, ProviderEvent, QueryErrorEvent, FinalPeerEvent, QueryOptions } from '../index.js'
|
|
4
4
|
import type { Message } from '../message/dht.js'
|
|
5
|
-
import type {
|
|
6
|
-
import type {
|
|
7
|
-
import type {
|
|
5
|
+
import type { Libp2pRecord } from '../record/index.js'
|
|
6
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
7
|
+
import type { PeerInfo } from '@libp2p/interface/peer-info'
|
|
8
8
|
|
|
9
9
|
export interface QueryEventFields {
|
|
10
10
|
to: PeerId
|
package/src/query/manager.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { setMaxListeners } from 'events'
|
|
2
|
-
import { AbortError } from '@libp2p/
|
|
3
|
-
import { EventEmitter, CustomEvent } from '@libp2p/
|
|
2
|
+
import { AbortError } from '@libp2p/interface/errors'
|
|
3
|
+
import { EventEmitter, CustomEvent } from '@libp2p/interface/events'
|
|
4
4
|
import { logger } from '@libp2p/logger'
|
|
5
5
|
import { PeerSet } from '@libp2p/peer-collections'
|
|
6
6
|
import { anySignal } from 'any-signal'
|
|
@@ -14,9 +14,9 @@ import { queryPath } from './query-path.js'
|
|
|
14
14
|
import type { QueryFunc } from './types.js'
|
|
15
15
|
import type { QueryEvent, QueryOptions as RootQueryOptions } from '../index.js'
|
|
16
16
|
import type { RoutingTable } from '../routing-table/index.js'
|
|
17
|
-
import type { Metric, Metrics } from '@libp2p/interface
|
|
18
|
-
import type { PeerId } from '@libp2p/interface
|
|
19
|
-
import type { Startable } from '@libp2p/
|
|
17
|
+
import type { Metric, Metrics } from '@libp2p/interface/metrics'
|
|
18
|
+
import type { PeerId } from '@libp2p/interface/peer-id'
|
|
19
|
+
import type { Startable } from '@libp2p/interface/startable'
|
|
20
20
|
import type { DeferredPromise } from 'p-defer'
|
|
21
21
|
|
|
22
22
|
export interface CleanUpEvents {
|