@libp2p/kad-dht 16.3.0 → 16.3.1

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.
Files changed (56) hide show
  1. package/dist/index.min.js +1 -1
  2. package/dist/index.min.js.map +4 -4
  3. package/dist/src/content-fetching/index.d.ts +4 -4
  4. package/dist/src/content-fetching/index.js +7 -7
  5. package/dist/src/content-routing/index.d.ts +6 -6
  6. package/dist/src/content-routing/index.js +4 -4
  7. package/dist/src/peer-routing/index.d.ts +4 -4
  8. package/dist/src/peer-routing/index.js +6 -6
  9. package/dist/src/query/events.d.ts +1 -1
  10. package/dist/src/query/manager.d.ts +2 -2
  11. package/dist/src/query/manager.js +2 -2
  12. package/dist/src/query/query-path.d.ts +2 -2
  13. package/dist/src/query/query-path.js +1 -1
  14. package/dist/src/query/types.d.ts +1 -1
  15. package/dist/src/record/selectors.d.ts +1 -1
  16. package/dist/src/record/selectors.js +1 -1
  17. package/dist/src/record/validators.d.ts +1 -1
  18. package/dist/src/routing-table/closest-peers.js +3 -3
  19. package/dist/src/routing-table/index.d.ts +1 -1
  20. package/dist/src/routing-table/index.js +1 -1
  21. package/dist/src/routing-table/k-bucket.js +2 -2
  22. package/dist/src/routing-table/refresh.d.ts +1 -1
  23. package/dist/src/routing-table/refresh.js +1 -1
  24. package/dist/src/rpc/handlers/add-provider.d.ts +3 -3
  25. package/dist/src/rpc/handlers/find-node.d.ts +4 -4
  26. package/dist/src/rpc/handlers/find-node.js +1 -1
  27. package/dist/src/rpc/handlers/get-providers.d.ts +5 -5
  28. package/dist/src/rpc/handlers/get-providers.js +1 -1
  29. package/dist/src/rpc/handlers/get-value.d.ts +3 -3
  30. package/dist/src/rpc/handlers/get-value.js +3 -3
  31. package/dist/src/rpc/handlers/ping.d.ts +2 -2
  32. package/dist/src/rpc/handlers/put-value.d.ts +3 -3
  33. package/dist/src/rpc/handlers/put-value.js +2 -2
  34. package/dist/src/rpc/index.d.ts +5 -5
  35. package/dist/src/rpc/index.js +1 -1
  36. package/package.json +16 -16
  37. package/src/content-fetching/index.ts +13 -13
  38. package/src/content-routing/index.ts +12 -12
  39. package/src/peer-routing/index.ts +12 -12
  40. package/src/query/events.ts +1 -1
  41. package/src/query/manager.ts +4 -4
  42. package/src/query/query-path.ts +3 -3
  43. package/src/query/types.ts +1 -1
  44. package/src/record/selectors.ts +2 -2
  45. package/src/record/validators.ts +1 -1
  46. package/src/routing-table/closest-peers.ts +3 -3
  47. package/src/routing-table/index.ts +2 -2
  48. package/src/routing-table/k-bucket.ts +2 -2
  49. package/src/routing-table/refresh.ts +2 -2
  50. package/src/rpc/handlers/add-provider.ts +3 -3
  51. package/src/rpc/handlers/find-node.ts +5 -5
  52. package/src/rpc/handlers/get-providers.ts +6 -6
  53. package/src/rpc/handlers/get-value.ts +6 -6
  54. package/src/rpc/handlers/ping.ts +2 -2
  55. package/src/rpc/handlers/put-value.ts +5 -5
  56. package/src/rpc/index.ts +5 -5
@@ -1,8 +1,8 @@
1
1
  import { Libp2pRecord } from '@libp2p/record';
2
- import type { KadDHTComponents, Validators, Selectors, ValueEvent, QueryEvent } from '../index.js';
3
- import type { Network, SendMessageOptions } from '../network.js';
4
- import type { PeerRouting } from '../peer-routing/index.js';
5
- import type { QueryManager } from '../query/manager.js';
2
+ import type { KadDHTComponents, Validators, Selectors, ValueEvent, QueryEvent } from '../index.ts';
3
+ import type { Network, SendMessageOptions } from '../network.ts';
4
+ import type { PeerRouting } from '../peer-routing/index.ts';
5
+ import type { QueryManager } from '../query/manager.ts';
6
6
  import type { AbortOptions, RoutingOptions } from '@libp2p/interface';
7
7
  export interface ContentFetchingInit {
8
8
  validators: Validators;
@@ -4,13 +4,13 @@ import map from 'it-map';
4
4
  import parallel from 'it-parallel';
5
5
  import { pipe } from 'it-pipe';
6
6
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals';
7
- import { ALPHA } from '../constants.js';
8
- import { QueryError } from '../errors.js';
9
- import { MessageType } from '../message/dht.js';
10
- import { valueEvent, queryErrorEvent } from '../query/events.js';
11
- import { bestRecord } from '../record/selectors.js';
12
- import { verifyRecord } from '../record/validators.js';
13
- import { createPutRecord, bufferToRecordKey } from '../utils.js';
7
+ import { ALPHA } from "../constants.js";
8
+ import { QueryError } from "../errors.js";
9
+ import { MessageType } from "../message/dht.js";
10
+ import { valueEvent, queryErrorEvent } from "../query/events.js";
11
+ import { bestRecord } from "../record/selectors.js";
12
+ import { verifyRecord } from "../record/validators.js";
13
+ import { createPutRecord, bufferToRecordKey } from "../utils.js";
14
14
  export class ContentFetching {
15
15
  log;
16
16
  components;
@@ -1,9 +1,9 @@
1
- import type { KadDHTComponents, PeerResponseEvent, ProviderEvent, QueryEvent } from '../index.js';
2
- import type { Network } from '../network.js';
3
- import type { PeerRouting } from '../peer-routing/index.js';
4
- import type { Providers } from '../providers.js';
5
- import type { QueryManager } from '../query/manager.js';
6
- import type { RoutingTable } from '../routing-table/index.js';
1
+ import type { KadDHTComponents, PeerResponseEvent, ProviderEvent, QueryEvent } from '../index.ts';
2
+ import type { Network } from '../network.ts';
3
+ import type { PeerRouting } from '../peer-routing/index.ts';
4
+ import type { Providers } from '../providers.ts';
5
+ import type { QueryManager } from '../query/manager.ts';
6
+ import type { RoutingTable } from '../routing-table/index.ts';
7
7
  import type { RoutingOptions } from '@libp2p/interface';
8
8
  import type { Multiaddr } from '@multiformats/multiaddr';
9
9
  import type { CID } from 'multiformats/cid';
@@ -1,10 +1,10 @@
1
1
  import { PeerSet } from '@libp2p/peer-collections';
2
2
  import { Queue } from '@libp2p/utils';
3
3
  import { pushable } from 'it-pushable';
4
- import { ALPHA } from '../constants.js';
5
- import { MessageType } from '../message/dht.js';
6
- import { toPbPeerInfo } from '../message/utils.js';
7
- import { queryErrorEvent, peerResponseEvent, providerEvent } from '../query/events.js';
4
+ import { ALPHA } from "../constants.js";
5
+ import { MessageType } from "../message/dht.js";
6
+ import { toPbPeerInfo } from "../message/utils.js";
7
+ import { queryErrorEvent, peerResponseEvent, providerEvent } from "../query/events.js";
8
8
  export class ContentRouting {
9
9
  log;
10
10
  components;
@@ -1,7 +1,7 @@
1
- import type { DHTRecord, FinalPeerEvent, QueryEvent, Validators } from '../index.js';
2
- import type { Network, SendMessageOptions } from '../network.js';
3
- import type { QueryManager, QueryOptions } from '../query/manager.js';
4
- import type { RoutingTable } from '../routing-table/index.js';
1
+ import type { DHTRecord, FinalPeerEvent, QueryEvent, Validators } from '../index.ts';
2
+ import type { Network, SendMessageOptions } from '../network.ts';
3
+ import type { QueryManager, QueryOptions } from '../query/manager.ts';
4
+ import type { RoutingTable } from '../routing-table/index.ts';
5
5
  import type { GetClosestPeersOptions } from '../routing-table/k-bucket.ts';
6
6
  import type { ComponentLogger, Metrics, PeerId, PeerInfo, PeerStore, RoutingOptions } from '@libp2p/interface';
7
7
  import type { AbortOptions } from 'it-pushable';
@@ -3,12 +3,12 @@ import { InvalidPublicKeyError, NotFoundError } from '@libp2p/interface';
3
3
  import { peerIdFromPublicKey, peerIdFromMultihash } from '@libp2p/peer-id';
4
4
  import { Libp2pRecord } from '@libp2p/record';
5
5
  import * as Digest from 'multiformats/hashes/digest';
6
- import { QueryError, InvalidRecordError } from '../errors.js';
7
- import { MessageType } from '../message/dht.js';
8
- import { PeerDistanceList } from '../peer-distance-list.js';
9
- import { queryErrorEvent, finalPeerEvent, valueEvent } from '../query/events.js';
10
- import { verifyRecord } from '../record/validators.js';
11
- import { convertBuffer, keyForPublicKey } from '../utils.js';
6
+ import { QueryError, InvalidRecordError } from "../errors.js";
7
+ import { MessageType } from "../message/dht.js";
8
+ import { PeerDistanceList } from "../peer-distance-list.js";
9
+ import { queryErrorEvent, finalPeerEvent, valueEvent } from "../query/events.js";
10
+ import { verifyRecord } from "../record/validators.js";
11
+ import { convertBuffer, keyForPublicKey } from "../utils.js";
12
12
  export class PeerRouting {
13
13
  log;
14
14
  routingTable;
@@ -1,4 +1,4 @@
1
- import type { MessageType, SendQueryEvent, PeerResponseEvent, AddPeerEvent, ValueEvent, ProviderEvent, QueryErrorEvent, FinalPeerEvent, DisjointPath, PathEndedEvent, DialPeerEvent } from '../index.js';
1
+ import type { MessageType, SendQueryEvent, PeerResponseEvent, AddPeerEvent, ValueEvent, ProviderEvent, QueryErrorEvent, FinalPeerEvent, DisjointPath, PathEndedEvent, DialPeerEvent } from '../index.ts';
2
2
  import type { PeerId, PeerInfo } from '@libp2p/interface';
3
3
  import type { Libp2pRecord } from '@libp2p/record';
4
4
  import type { ProgressOptions } from 'progress-events';
@@ -1,6 +1,6 @@
1
1
  import type { QueryFunc } from './types.ts';
2
- import type { QueryEvent } from '../index.js';
3
- import type { RoutingTable } from '../routing-table/index.js';
2
+ import type { QueryEvent } from '../index.ts';
3
+ import type { RoutingTable } from '../routing-table/index.ts';
4
4
  import type { ComponentLogger, Metrics, PeerId, RoutingOptions, Startable } from '@libp2p/interface';
5
5
  import type { ConnectionManager } from '@libp2p/interface-internal';
6
6
  import type { DeferredPromise } from 'p-defer';
@@ -5,8 +5,8 @@ import { setMaxListeners } from 'main-event';
5
5
  import { pEvent } from 'p-event';
6
6
  import { raceSignal } from 'race-signal';
7
7
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
8
- import { ALPHA, K, DEFAULT_QUERY_TIMEOUT } from '../constants.js';
9
- import { convertBuffer } from '../utils.js';
8
+ import { ALPHA, K, DEFAULT_QUERY_TIMEOUT } from "../constants.js";
9
+ import { convertBuffer } from "../utils.js";
10
10
  import { queryPath } from "./query-path.js";
11
11
  /**
12
12
  * Keeps track of all running queries
@@ -1,5 +1,5 @@
1
- import type { QueryEvent } from '../index.js';
2
- import type { QueryFunc } from '../query/types.js';
1
+ import type { QueryEvent } from '../index.ts';
2
+ import type { QueryFunc } from '../query/types.ts';
3
3
  import type { Logger, PeerId, RoutingOptions } from '@libp2p/interface';
4
4
  import type { ConnectionManager } from '@libp2p/interface-internal';
5
5
  import type { Filter } from '@libp2p/utils';
@@ -3,7 +3,7 @@ import { Queue } from '@libp2p/utils';
3
3
  import { pushable } from 'it-pushable';
4
4
  import { xor as uint8ArrayXor } from 'uint8arrays/xor';
5
5
  import { xorCompare as uint8ArrayXorCompare } from 'uint8arrays/xor-compare';
6
- import { convertPeerId, convertBuffer } from '../utils.js';
6
+ import { convertPeerId, convertBuffer } from "../utils.js";
7
7
  import { pathEndedEvent, queryErrorEvent } from "./events.js";
8
8
  /**
9
9
  * Walks a path through the DHT, calling the passed query function for
@@ -1,4 +1,4 @@
1
- import type { DisjointPath, QueryEvent } from '../index.js';
1
+ import type { DisjointPath, QueryEvent } from '../index.ts';
2
2
  import type { PeerInfo } from '@libp2p/interface';
3
3
  export interface QueryContext {
4
4
  key: Uint8Array;
@@ -1,4 +1,4 @@
1
- import type { Selectors } from '../index.js';
1
+ import type { Selectors } from '../index.ts';
2
2
  /**
3
3
  * Select the best record out of the given records
4
4
  */
@@ -1,6 +1,6 @@
1
1
  import { InvalidParametersError } from '@libp2p/interface';
2
2
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
3
- import { MissingSelectorError } from '../errors.js';
3
+ import { MissingSelectorError } from "../errors.js";
4
4
  /**
5
5
  * Select the best record out of the given records
6
6
  */
@@ -1,4 +1,4 @@
1
- import type { Validators } from '../index.js';
1
+ import type { Validators } from '../index.ts';
2
2
  import type { Libp2pRecord } from '@libp2p/record';
3
3
  import type { AbortOptions } from 'it-pushable';
4
4
  /**
@@ -1,7 +1,7 @@
1
1
  import { PeerSet } from '@libp2p/peer-collections';
2
- import { KEEP_ALIVE_TAG } from '../constants.js';
3
- import { PeerDistanceList } from '../peer-distance-list.js';
4
- import { convertPeerId } from '../utils.js';
2
+ import { KEEP_ALIVE_TAG } from "../constants.js";
3
+ import { PeerDistanceList } from "../peer-distance-list.js";
4
+ import { convertPeerId } from "../utils.js";
5
5
  export const PEER_SET_SIZE = 20;
6
6
  export const REFRESH_INTERVAL = 5000;
7
7
  export const KAD_CLOSE_TAG_NAME = 'kad-close';
@@ -1,7 +1,7 @@
1
1
  import { TypedEventEmitter } from 'main-event';
2
2
  import { KBucket } from './k-bucket.ts';
3
3
  import type { GetClosestPeersOptions, Peer } from './k-bucket.ts';
4
- import type { Network } from '../network.js';
4
+ import type { Network } from '../network.ts';
5
5
  import type { AbortOptions, ComponentLogger, Metrics, PeerId, PeerStore, Startable } from '@libp2p/interface';
6
6
  import type { Ping } from '@libp2p/ping';
7
7
  import type { AdaptiveTimeoutInit } from '@libp2p/utils';
@@ -3,7 +3,7 @@ import { AdaptiveTimeout, PeerQueue } from '@libp2p/utils';
3
3
  import { anySignal } from 'any-signal';
4
4
  import parallel from 'it-parallel';
5
5
  import { TypedEventEmitter, setMaxListeners } from 'main-event';
6
- import * as utils from '../utils.js';
6
+ import * as utils from "../utils.js";
7
7
  import { ClosestPeers } from "./closest-peers.js";
8
8
  import { KBucket, isLeafBucket } from "./k-bucket.js";
9
9
  export const KBUCKET_SIZE = 20;
@@ -3,8 +3,8 @@ import map from 'it-map';
3
3
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals';
4
4
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string';
5
5
  import { xor as uint8ArrayXor } from 'uint8arrays/xor';
6
- import { PeerDistanceList } from '../peer-distance-list.js';
7
- import { convertPeerId } from '../utils.js';
6
+ import { PeerDistanceList } from "../peer-distance-list.js";
7
+ import { convertPeerId } from "../utils.js";
8
8
  import { KBUCKET_SIZE, LAST_PING_THRESHOLD, PING_OLD_CONTACT_COUNT, PREFIX_LENGTH } from "./index.js";
9
9
  export function isLeafBucket(obj) {
10
10
  return Array.isArray(obj?.peers);
@@ -1,5 +1,5 @@
1
1
  import type { RoutingTable } from './index.ts';
2
- import type { PeerRouting } from '../peer-routing/index.js';
2
+ import type { PeerRouting } from '../peer-routing/index.ts';
3
3
  import type { AbortOptions, ComponentLogger, PeerId } from '@libp2p/interface';
4
4
  export interface RoutingTableRefreshComponents {
5
5
  logger: ComponentLogger;
@@ -6,7 +6,7 @@ import { setMaxListeners } from 'main-event';
6
6
  import * as Digest from 'multiformats/hashes/digest';
7
7
  import { sha256 } from 'multiformats/hashes/sha2';
8
8
  import { xor as uint8ArrayXor } from 'uint8arrays/xor';
9
- import { TABLE_REFRESH_INTERVAL, TABLE_REFRESH_QUERY_TIMEOUT } from '../constants.js';
9
+ import { TABLE_REFRESH_INTERVAL, TABLE_REFRESH_QUERY_TIMEOUT } from "../constants.js";
10
10
  import GENERATED_PREFIXES from "./generated-prefix-list.js";
11
11
  /**
12
12
  * Cannot generate random KadIds longer than this + 1
@@ -1,6 +1,6 @@
1
- import type { Message } from '../../message/dht.js';
2
- import type { Providers } from '../../providers.js';
3
- import type { DHTMessageHandler } from '../index.js';
1
+ import type { Message } from '../../message/dht.ts';
2
+ import type { Providers } from '../../providers.ts';
3
+ import type { DHTMessageHandler } from '../index.ts';
4
4
  import type { ComponentLogger, PeerId, PeerStore } from '@libp2p/interface';
5
5
  export interface AddProviderComponents {
6
6
  peerId: PeerId;
@@ -1,7 +1,7 @@
1
- import type { PeerInfoMapper } from '../../index.js';
2
- import type { Message } from '../../message/dht.js';
3
- import type { PeerRouting } from '../../peer-routing/index.js';
4
- import type { DHTMessageHandler } from '../index.js';
1
+ import type { PeerInfoMapper } from '../../index.ts';
2
+ import type { Message } from '../../message/dht.ts';
3
+ import type { PeerRouting } from '../../peer-routing/index.ts';
4
+ import type { DHTMessageHandler } from '../index.ts';
5
5
  import type { ComponentLogger, PeerId } from '@libp2p/interface';
6
6
  import type { AddressManager } from '@libp2p/interface-internal';
7
7
  export interface FindNodeHandlerInit {
@@ -1,7 +1,7 @@
1
1
  import { InvalidMessageError } from '@libp2p/interface';
2
2
  import { CODE_P2P } from '@multiformats/multiaddr';
3
3
  import { equals as uint8ArrayEquals } from 'uint8arrays';
4
- import { MessageType } from '../../message/dht.js';
4
+ import { MessageType } from "../../message/dht.js";
5
5
  export class FindNodeHandler {
6
6
  peerRouting;
7
7
  peerInfoMapper;
@@ -1,8 +1,8 @@
1
- import type { PeerInfoMapper } from '../../index.js';
2
- import type { Message } from '../../message/dht.js';
3
- import type { PeerRouting } from '../../peer-routing/index.js';
4
- import type { Providers } from '../../providers.js';
5
- import type { DHTMessageHandler } from '../index.js';
1
+ import type { PeerInfoMapper } from '../../index.ts';
2
+ import type { Message } from '../../message/dht.ts';
3
+ import type { PeerRouting } from '../../peer-routing/index.ts';
4
+ import type { Providers } from '../../providers.ts';
5
+ import type { DHTMessageHandler } from '../index.ts';
6
6
  import type { ComponentLogger, PeerId, PeerStore } from '@libp2p/interface';
7
7
  import type { Multiaddr } from '@multiformats/multiaddr';
8
8
  export interface GetProvidersHandlerInit {
@@ -2,7 +2,7 @@ import { InvalidMessageError } from '@libp2p/interface';
2
2
  import all from 'it-all';
3
3
  import map from 'it-map';
4
4
  import { CID } from 'multiformats/cid';
5
- import { MessageType } from '../../message/dht.js';
5
+ import { MessageType } from "../../message/dht.js";
6
6
  export class GetProvidersHandler {
7
7
  peerId;
8
8
  peerRouting;
@@ -1,7 +1,7 @@
1
1
  import { Libp2pRecord } from '@libp2p/record';
2
- import type { Message } from '../../message/dht.js';
3
- import type { PeerRouting } from '../../peer-routing/index.js';
4
- import type { DHTMessageHandler } from '../index.js';
2
+ import type { Message } from '../../message/dht.ts';
3
+ import type { PeerRouting } from '../../peer-routing/index.ts';
4
+ import type { DHTMessageHandler } from '../index.ts';
5
5
  import type { ComponentLogger, PeerId, PeerStore } from '@libp2p/interface';
6
6
  import type { Datastore } from 'interface-datastore';
7
7
  export interface GetValueHandlerInit {
@@ -1,9 +1,9 @@
1
1
  import { publicKeyToProtobuf } from '@libp2p/crypto/keys';
2
2
  import { InvalidMessageError, NotFoundError } from '@libp2p/interface';
3
3
  import { Libp2pRecord } from '@libp2p/record';
4
- import { PROVIDERS_VALIDITY } from '../../constants.js';
5
- import { MessageType } from '../../message/dht.js';
6
- import { bufferToRecordKey, isPublicKeyKey, fromPublicKeyKey } from '../../utils.js';
4
+ import { PROVIDERS_VALIDITY } from "../../constants.js";
5
+ import { MessageType } from "../../message/dht.js";
6
+ import { bufferToRecordKey, isPublicKeyKey, fromPublicKeyKey } from "../../utils.js";
7
7
  export class GetValueHandler {
8
8
  peerStore;
9
9
  datastore;
@@ -1,5 +1,5 @@
1
- import type { Message } from '../../message/dht.js';
2
- import type { DHTMessageHandler } from '../index.js';
1
+ import type { Message } from '../../message/dht.ts';
2
+ import type { DHTMessageHandler } from '../index.ts';
3
3
  import type { ComponentLogger, PeerId } from '@libp2p/interface';
4
4
  export interface PingComponents {
5
5
  logger: ComponentLogger;
@@ -1,6 +1,6 @@
1
- import type { Validators } from '../../index.js';
2
- import type { Message } from '../../message/dht.js';
3
- import type { DHTMessageHandler } from '../index.js';
1
+ import type { Validators } from '../../index.ts';
2
+ import type { Message } from '../../message/dht.ts';
3
+ import type { DHTMessageHandler } from '../index.ts';
4
4
  import type { ComponentLogger, PeerId } from '@libp2p/interface';
5
5
  import type { Datastore } from 'interface-datastore';
6
6
  export interface PutValueHandlerInit {
@@ -1,7 +1,7 @@
1
1
  import { InvalidMessageError } from '@libp2p/interface';
2
2
  import { Libp2pRecord } from '@libp2p/record';
3
- import { verifyRecord } from '../../record/validators.js';
4
- import { bufferToRecordKey } from '../../utils.js';
3
+ import { verifyRecord } from "../../record/validators.js";
4
+ import { bufferToRecordKey } from "../../utils.js";
5
5
  export class PutValueHandler {
6
6
  components;
7
7
  validators;
@@ -1,12 +1,12 @@
1
- import { Message } from '../message/dht.js';
2
- import type { PeerInfoMapper, Validators } from '../index.js';
3
- import type { PeerRouting } from '../peer-routing/index.js';
4
- import type { Providers } from '../providers.js';
1
+ import { Message } from '../message/dht.ts';
2
+ import type { PeerInfoMapper, Validators } from '../index.ts';
3
+ import type { PeerRouting } from '../peer-routing/index.ts';
4
+ import type { Providers } from '../providers.ts';
5
5
  import type { FindNodeHandlerComponents } from './handlers/find-node.ts';
6
6
  import type { GetProvidersHandlerComponents } from './handlers/get-providers.ts';
7
7
  import type { GetValueHandlerComponents } from './handlers/get-value.ts';
8
8
  import type { PutValueHandlerComponents } from './handlers/put-value.ts';
9
- import type { RoutingTable } from '../routing-table/index.js';
9
+ import type { RoutingTable } from '../routing-table/index.ts';
10
10
  import type { Metrics, PeerId, Connection, Stream } from '@libp2p/interface';
11
11
  export interface DHTMessageHandler {
12
12
  handle(peerId: PeerId, msg: Message): Promise<Message | undefined>;
@@ -1,6 +1,6 @@
1
1
  import { InvalidMessageError, TimeoutError } from '@libp2p/interface';
2
2
  import { pbStream } from '@libp2p/utils';
3
- import { Message, MessageType } from '../message/dht.js';
3
+ import { Message, MessageType } from "../message/dht.js";
4
4
  import { AddProviderHandler } from "./handlers/add-provider.js";
5
5
  import { FindNodeHandler } from "./handlers/find-node.js";
6
6
  import { GetProvidersHandler } from "./handlers/get-providers.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@libp2p/kad-dht",
3
- "version": "16.3.0",
3
+ "version": "16.3.1",
4
4
  "description": "JavaScript implementation of the Kad-DHT for libp2p",
5
5
  "license": "Apache-2.0 OR MIT",
6
6
  "homepage": "https://github.com/libp2p/js-libp2p/tree/main/packages/kad-dht#readme",
@@ -48,16 +48,16 @@
48
48
  "doc-check": "aegir doc-check"
49
49
  },
50
50
  "dependencies": {
51
- "@libp2p/crypto": "^5.1.18",
52
- "@libp2p/interface": "^3.2.2",
53
- "@libp2p/interface-internal": "^3.1.5",
54
- "@libp2p/peer-collections": "^7.0.20",
55
- "@libp2p/peer-id": "^6.0.9",
56
- "@libp2p/ping": "^3.1.5",
57
- "@libp2p/record": "^4.0.12",
58
- "@libp2p/utils": "^7.2.1",
59
- "@multiformats/multiaddr": "^13.0.1",
60
- "@multiformats/multiaddr-matcher": "^3.0.1",
51
+ "@libp2p/crypto": "^5.1.19",
52
+ "@libp2p/interface": "^3.2.3",
53
+ "@libp2p/interface-internal": "^3.1.6",
54
+ "@libp2p/peer-collections": "^7.0.21",
55
+ "@libp2p/peer-id": "^6.0.10",
56
+ "@libp2p/ping": "^3.1.6",
57
+ "@libp2p/record": "^4.0.13",
58
+ "@libp2p/utils": "^7.2.2",
59
+ "@multiformats/multiaddr": "^13.0.3",
60
+ "@multiformats/multiaddr-matcher": "^3.0.2",
61
61
  "any-signal": "^4.1.1",
62
62
  "interface-datastore": "^9.0.1",
63
63
  "it-all": "^3.0.9",
@@ -70,7 +70,7 @@
70
70
  "it-pushable": "^3.2.3",
71
71
  "it-take": "^3.0.9",
72
72
  "main-event": "^1.0.1",
73
- "multiformats": "^13.4.0",
73
+ "multiformats": "^14.0.0",
74
74
  "p-defer": "^4.0.1",
75
75
  "p-event": "^7.0.0",
76
76
  "progress-events": "^1.0.1",
@@ -78,16 +78,16 @@
78
78
  "race-signal": "^2.0.0",
79
79
  "uint8-varint": "^2.0.4",
80
80
  "uint8arraylist": "^2.4.8",
81
- "uint8arrays": "^5.1.0"
81
+ "uint8arrays": "^6.1.1"
82
82
  },
83
83
  "devDependencies": {
84
- "@libp2p/logger": "^6.2.7",
85
- "@libp2p/peer-store": "^12.0.20",
84
+ "@libp2p/logger": "^6.2.8",
85
+ "@libp2p/peer-store": "^12.0.21",
86
86
  "@types/lodash.random": "^3.2.9",
87
87
  "@types/lodash.range": "^3.2.9",
88
88
  "@types/sinon": "^21.0.1",
89
89
  "@types/which": "^3.0.4",
90
- "aegir": "^47.0.22",
90
+ "aegir": "^48.0.11",
91
91
  "benchmark": "^2.1.4",
92
92
  "datastore-core": "^11.0.1",
93
93
  "delay": "^7.0.0",
@@ -6,22 +6,22 @@ import { pipe } from 'it-pipe'
6
6
  import { equals as uint8ArrayEquals } from 'uint8arrays/equals'
7
7
  import {
8
8
  ALPHA
9
- } from '../constants.js'
10
- import { QueryError } from '../errors.js'
11
- import { MessageType } from '../message/dht.js'
9
+ } from '../constants.ts'
10
+ import { QueryError } from '../errors.ts'
11
+ import { MessageType } from '../message/dht.ts'
12
12
  import {
13
13
  valueEvent,
14
14
  queryErrorEvent
15
- } from '../query/events.js'
16
- import { bestRecord } from '../record/selectors.js'
17
- import { verifyRecord } from '../record/validators.js'
18
- import { createPutRecord, bufferToRecordKey } from '../utils.js'
19
- import type { KadDHTComponents, Validators, Selectors, ValueEvent, QueryEvent } from '../index.js'
20
- import type { Message } from '../message/dht.js'
21
- import type { Network, SendMessageOptions } from '../network.js'
22
- import type { PeerRouting } from '../peer-routing/index.js'
23
- import type { QueryManager } from '../query/manager.js'
24
- import type { QueryFunc } from '../query/types.js'
15
+ } from '../query/events.ts'
16
+ import { bestRecord } from '../record/selectors.ts'
17
+ import { verifyRecord } from '../record/validators.ts'
18
+ import { createPutRecord, bufferToRecordKey } from '../utils.ts'
19
+ import type { KadDHTComponents, Validators, Selectors, ValueEvent, QueryEvent } from '../index.ts'
20
+ import type { Message } from '../message/dht.ts'
21
+ import type { Network, SendMessageOptions } from '../network.ts'
22
+ import type { PeerRouting } from '../peer-routing/index.ts'
23
+ import type { QueryManager } from '../query/manager.ts'
24
+ import type { QueryFunc } from '../query/types.ts'
25
25
  import type { AbortOptions, Logger, RoutingOptions } from '@libp2p/interface'
26
26
 
27
27
  export interface ContentFetchingInit {
@@ -1,22 +1,22 @@
1
1
  import { PeerSet } from '@libp2p/peer-collections'
2
2
  import { Queue } from '@libp2p/utils'
3
3
  import { pushable } from 'it-pushable'
4
- import { ALPHA } from '../constants.js'
5
- import { MessageType } from '../message/dht.js'
6
- import { toPbPeerInfo } from '../message/utils.js'
4
+ import { ALPHA } from '../constants.ts'
5
+ import { MessageType } from '../message/dht.ts'
6
+ import { toPbPeerInfo } from '../message/utils.ts'
7
7
  import {
8
8
  queryErrorEvent,
9
9
  peerResponseEvent,
10
10
  providerEvent
11
- } from '../query/events.js'
12
- import type { FinalPeerEvent, KadDHTComponents, PeerResponseEvent, ProviderEvent, QueryEvent } from '../index.js'
13
- import type { Message } from '../message/dht.js'
14
- import type { Network } from '../network.js'
15
- import type { PeerRouting } from '../peer-routing/index.js'
16
- import type { Providers } from '../providers.js'
17
- import type { QueryManager } from '../query/manager.js'
18
- import type { QueryFunc } from '../query/types.js'
19
- import type { RoutingTable } from '../routing-table/index.js'
11
+ } from '../query/events.ts'
12
+ import type { FinalPeerEvent, KadDHTComponents, PeerResponseEvent, ProviderEvent, QueryEvent } from '../index.ts'
13
+ import type { Message } from '../message/dht.ts'
14
+ import type { Network } from '../network.ts'
15
+ import type { PeerRouting } from '../peer-routing/index.ts'
16
+ import type { Providers } from '../providers.ts'
17
+ import type { QueryManager } from '../query/manager.ts'
18
+ import type { QueryFunc } from '../query/types.ts'
19
+ import type { RoutingTable } from '../routing-table/index.ts'
20
20
  import type { Logger, PeerInfo, RoutingOptions } from '@libp2p/interface'
21
21
  import type { Multiaddr } from '@multiformats/multiaddr'
22
22
  import type { CID } from 'multiformats/cid'
@@ -3,22 +3,22 @@ import { InvalidPublicKeyError, NotFoundError } from '@libp2p/interface'
3
3
  import { peerIdFromPublicKey, peerIdFromMultihash } from '@libp2p/peer-id'
4
4
  import { Libp2pRecord } from '@libp2p/record'
5
5
  import * as Digest from 'multiformats/hashes/digest'
6
- import { QueryError, InvalidRecordError } from '../errors.js'
7
- import { MessageType } from '../message/dht.js'
8
- import { PeerDistanceList } from '../peer-distance-list.js'
6
+ import { QueryError, InvalidRecordError } from '../errors.ts'
7
+ import { MessageType } from '../message/dht.ts'
8
+ import { PeerDistanceList } from '../peer-distance-list.ts'
9
9
  import {
10
10
  queryErrorEvent,
11
11
  finalPeerEvent,
12
12
  valueEvent
13
- } from '../query/events.js'
14
- import { verifyRecord } from '../record/validators.js'
15
- import { convertBuffer, keyForPublicKey } from '../utils.js'
16
- import type { DHTRecord, FinalPeerEvent, QueryEvent, Validators } from '../index.js'
17
- import type { Message } from '../message/dht.js'
18
- import type { Network, SendMessageOptions } from '../network.js'
19
- import type { QueryManager, QueryOptions } from '../query/manager.js'
20
- import type { QueryFunc } from '../query/types.js'
21
- import type { RoutingTable } from '../routing-table/index.js'
13
+ } from '../query/events.ts'
14
+ import { verifyRecord } from '../record/validators.ts'
15
+ import { convertBuffer, keyForPublicKey } from '../utils.ts'
16
+ import type { DHTRecord, FinalPeerEvent, QueryEvent, Validators } from '../index.ts'
17
+ import type { Message } from '../message/dht.ts'
18
+ import type { Network, SendMessageOptions } from '../network.ts'
19
+ import type { QueryManager, QueryOptions } from '../query/manager.ts'
20
+ import type { QueryFunc } from '../query/types.ts'
21
+ import type { RoutingTable } from '../routing-table/index.ts'
22
22
  import type { GetClosestPeersOptions } from '../routing-table/k-bucket.ts'
23
23
  import type { ComponentLogger, Logger, Metrics, PeerId, PeerInfo, PeerStore, RoutingOptions } from '@libp2p/interface'
24
24
  import type { AbortOptions } from 'it-pushable'
@@ -1,4 +1,4 @@
1
- import type { MessageType, SendQueryEvent, PeerResponseEvent, AddPeerEvent, ValueEvent, ProviderEvent, QueryErrorEvent, FinalPeerEvent, DisjointPath, PathEndedEvent, DialPeerEvent } from '../index.js'
1
+ import type { MessageType, SendQueryEvent, PeerResponseEvent, AddPeerEvent, ValueEvent, ProviderEvent, QueryErrorEvent, FinalPeerEvent, DisjointPath, PathEndedEvent, DialPeerEvent } from '../index.ts'
2
2
  import type { PeerId, PeerInfo } from '@libp2p/interface'
3
3
  import type { Libp2pRecord } from '@libp2p/record'
4
4
  import type { ProgressOptions } from 'progress-events'
@@ -7,12 +7,12 @@ import { raceSignal } from 'race-signal'
7
7
  import { toString as uint8ArrayToString } from 'uint8arrays/to-string'
8
8
  import {
9
9
  ALPHA, K, DEFAULT_QUERY_TIMEOUT
10
- } from '../constants.js'
11
- import { convertBuffer } from '../utils.js'
10
+ } from '../constants.ts'
11
+ import { convertBuffer } from '../utils.ts'
12
12
  import { queryPath } from './query-path.ts'
13
13
  import type { QueryFunc } from './types.ts'
14
- import type { QueryEvent } from '../index.js'
15
- import type { RoutingTable } from '../routing-table/index.js'
14
+ import type { QueryEvent } from '../index.ts'
15
+ import type { RoutingTable } from '../routing-table/index.ts'
16
16
  import type { ComponentLogger, Metrics, PeerId, RoutingOptions, Startable } from '@libp2p/interface'
17
17
  import type { ConnectionManager } from '@libp2p/interface-internal'
18
18
  import type { DeferredPromise } from 'p-defer'