libp2p
    Preparing search index...

    Interface KadDHT

    interface KadDHT {
        a: number;
        d: number;
        k: number;
        cancelReprovide(key: CID): Promise<void>;
        findPeer(id: PeerId, options?: RoutingOptions): AsyncIterable<QueryEvent>;
        findProviders(
            key: CID,
            options?: RoutingOptions,
        ): AsyncIterable<QueryEvent>;
        get(key: Uint8Array, options?: RoutingOptions): AsyncIterable<QueryEvent>;
        getClosestPeers(
            key: Uint8Array,
            options?: RoutingOptions,
        ): AsyncIterable<QueryEvent>;
        getMode(): "client" | "server";
        provide(key: CID, options?: RoutingOptions): AsyncIterable<QueryEvent>;
        put(
            key: Uint8Array,
            value: Uint8Array,
            options?: RoutingOptions,
        ): AsyncIterable<QueryEvent>;
        refreshRoutingTable(): Promise<void>;
        setMode(mode: "client" | "server"): Promise<void>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    a: number

    Query concurrency factor - this controls how many peers we contact in parallel during a query.

    d: number

    From section 4.4 of the S/Kademlia paper - this is how many disjoint paths are used during a query.

    k: number

    This is the maximum size of the k-buckets and how many peers are looked up when searching for peers close to a key.

    Methods

    • Provider records must be re-published every 24 hours - pass a previously provided CID here to not re-publish a record for it any more

      Parameters

      Returns Promise<void>

    • Returns the mode this node is in

      Returns "client" | "server"

    • If 'server' this node will respond to DHT queries, if 'client' this node will not.

      Parameters

      • mode: "client" | "server"

      Returns Promise<void>