UNPKG

@waku/discovery

Version:

Contains various discovery mechanisms: DNS Discovery (EIP-1459, Peer Exchange, Local Peer Cache Discovery.

33 lines (32 loc) 1.44 kB
import type { DnsClient, IEnr, NodeCapabilityCount } from "@waku/interfaces"; export declare class DnsNodeDiscovery { private readonly dns; private readonly _DNSTreeCache; private readonly _errorTolerance; static dnsOverHttp(dnsClient?: DnsClient): Promise<DnsNodeDiscovery>; /** * Returns a list of verified peers listed in an EIP-1459 DNS tree. Method may * return fewer peers than requested if @link wantedNodeCapabilityCount requires * larger quantity of peers than available or the number of errors/duplicate * peers encountered by randomized search exceeds the sum of the fields of * @link wantedNodeCapabilityCount plus the @link _errorTolerance factor. */ getPeers(enrTreeUrls: string[], wantedNodeCapabilityCount: Partial<NodeCapabilityCount>): Promise<IEnr[]>; constructor(dns: DnsClient); /** * {@inheritDoc getPeers} */ getNextPeer(enrTreeUrls: string[], wantedNodeCapabilityCount: Partial<NodeCapabilityCount>): AsyncGenerator<IEnr>; /** * Runs a recursive, randomized descent of the DNS tree to retrieve a single * ENR record as an ENR. Returns null if parsing or DNS resolution fails. */ private _search; /** * Retrieves the TXT record stored at a location from either * this DNS tree cache or via DNS query. * * @throws if the TXT Record contains non-UTF-8 values. */ private _getTXTRecord; }