|
1 | | -import { RoutingTable } from './routing-table/index.js' |
2 | | -import { RoutingTableRefresh } from './routing-table/refresh.js' |
3 | | -import { Network } from './network.js' |
| 1 | +import { symbol } from '@libp2p/interface-peer-discovery' |
| 2 | +import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events' |
| 3 | +import { type Logger, logger } from '@libp2p/logger' |
| 4 | +import { selectors as recordSelectors } from '@libp2p/record/selectors' |
| 5 | +import { validators as recordValidators } from '@libp2p/record/validators' |
| 6 | +import pDefer from 'p-defer' |
| 7 | +import { PROTOCOL_DHT, PROTOCOL_PREFIX, LAN_PREFIX } from './constants.js' |
4 | 8 | import { ContentFetching } from './content-fetching/index.js' |
5 | 9 | import { ContentRouting } from './content-routing/index.js' |
| 10 | +import { Network } from './network.js' |
6 | 11 | import { PeerRouting } from './peer-routing/index.js' |
7 | 12 | import { Providers } from './providers.js' |
8 | 13 | import { QueryManager } from './query/manager.js' |
| 14 | +import { QuerySelf } from './query-self.js' |
| 15 | +import { RoutingTable } from './routing-table/index.js' |
| 16 | +import { RoutingTableRefresh } from './routing-table/refresh.js' |
9 | 17 | import { RPC } from './rpc/index.js' |
10 | 18 | import { TopologyListener } from './topology-listener.js' |
11 | | -import { QuerySelf } from './query-self.js' |
12 | 19 | import { |
13 | 20 | removePrivateAddresses, |
14 | 21 | removePublicAddresses |
15 | 22 | } from './utils.js' |
16 | | -import { Logger, logger } from '@libp2p/logger' |
| 23 | +import type { KadDHTComponents, KadDHTInit } from './index.js' |
17 | 24 | import type { QueryOptions, Validators, Selectors, DHT, QueryEvent } from '@libp2p/interface-dht' |
18 | | -import type { PeerInfo } from '@libp2p/interface-peer-info' |
19 | | -import { CustomEvent, EventEmitter } from '@libp2p/interfaces/events' |
| 25 | +import type { PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' |
20 | 26 | import type { PeerId } from '@libp2p/interface-peer-id' |
| 27 | +import type { PeerInfo } from '@libp2p/interface-peer-info' |
21 | 28 | import type { CID } from 'multiformats/cid' |
22 | | -import type { PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery' |
23 | | -import type { KadDHTComponents, KadDHTInit } from './index.js' |
24 | | -import { validators as recordValidators } from '@libp2p/record/validators' |
25 | | -import { selectors as recordSelectors } from '@libp2p/record/selectors' |
26 | | -import { symbol } from '@libp2p/interface-peer-discovery' |
27 | | -import { PROTOCOL_DHT, PROTOCOL_PREFIX, LAN_PREFIX } from './constants.js' |
28 | | -import pDefer from 'p-defer' |
29 | 29 |
|
30 | 30 | export const DEFAULT_MAX_INBOUND_STREAMS = 32 |
31 | 31 | export const DEFAULT_MAX_OUTBOUND_STREAMS = 64 |
@@ -219,13 +219,9 @@ export class KadDHT extends EventEmitter<PeerDiscoveryEvents> implements DHT { |
219 | 219 | }) |
220 | 220 | } |
221 | 221 |
|
222 | | - get [symbol] (): true { |
223 | | - return true |
224 | | - } |
| 222 | + readonly [symbol] = true |
225 | 223 |
|
226 | | - get [Symbol.toStringTag] (): '@libp2p/kad-dht' { |
227 | | - return '@libp2p/kad-dht' |
228 | | - } |
| 224 | + readonly [Symbol.toStringTag] = '@libp2p/kad-dht' |
229 | 225 |
|
230 | 226 | async onPeerConnect (peerData: PeerInfo): Promise<void> { |
231 | 227 | this.log('peer %p connected with protocols', peerData.id, peerData.protocols) |
|
0 commit comments