import type { KadDHT } from './kad-dht.js'; import type { DualDHT, QueryOptions } from '@libp2p/interface-dht'; import type { AbortOptions } from '@libp2p/interfaces'; import { EventEmitter } from '@libp2p/interfaces/events'; import type { CID } from 'multiformats'; import type { PeerId } from '@libp2p/interface-peer-id'; import type { PeerDiscoveryEvents } from '@libp2p/interface-peer-discovery'; import { Components, Initializable } from '@libp2p/components'; import { symbol } from '@libp2p/interface-peer-discovery'; /** * A DHT implementation modelled after Kademlia with S/Kademlia modifications. * Original implementation in go: https://github.com/libp2p/go-libp2p-kad-dht. */ export declare class DualKadDHT extends EventEmitter implements DualDHT, Initializable { wan: KadDHT; lan: KadDHT; components: Components; constructor(wan: KadDHT, lan: KadDHT); get [symbol](): true; get [Symbol.toStringTag](): string; init(components: Components): void; /** * Is this DHT running. */ isStarted(): boolean; /** * If 'server' this node will respond to DHT queries, if 'client' this node will not */ getMode(): Promise<"client" | "server">; /** * If 'server' this node will respond to DHT queries, if 'client' this node will not */ setMode(mode: 'client' | 'server'): Promise; /** * Start listening to incoming connections. */ start(): Promise; /** * Stop accepting incoming connections and sending outgoing * messages. */ stop(): Promise; /** * Store the given key/value pair in the DHT */ put(key: Uint8Array, value: Uint8Array, options?: QueryOptions): AsyncGenerator; /** * Get the value that corresponds to the passed key */ get(key: Uint8Array, options?: QueryOptions): AsyncGenerator; /** * Announce to the network that we can provide given key's value */ provide(key: CID, options?: AbortOptions): AsyncGenerator; /** * Search the dht for up to `K` providers of the given CID */ findProviders(key: CID, options?: QueryOptions): AsyncGenerator; /** * Search for a peer with the given ID */ findPeer(id: PeerId, options?: QueryOptions): AsyncGenerator; /** * Kademlia 'node lookup' operation */ getClosestPeers(key: Uint8Array, options?: QueryOptions): AsyncGenerator; refreshRoutingTable(): Promise; } //# sourceMappingURL=dual-kad-dht.d.ts.map