mirror of
https://github.com/logos-messaging/logos-delivery-js.git
synced 2026-03-13 13:13:08 +00:00
* remove IBaseProtocol * fix references, interfaces and integration * fix ci * up mock * up lock * add mock for local storage * add missing prop, fix tests * up lock
31 lines
802 B
TypeScript
31 lines
802 B
TypeScript
import type { PeerDiscovery } from "@libp2p/interface";
|
|
import {
|
|
enrTree,
|
|
wakuDnsDiscovery,
|
|
wakuLocalPeerCacheDiscovery,
|
|
wakuPeerExchangeDiscovery
|
|
} from "@waku/discovery";
|
|
import { CreateNodeOptions, type Libp2pComponents } from "@waku/interfaces";
|
|
|
|
export function getPeerDiscoveries(
|
|
enabled?: CreateNodeOptions["discovery"]
|
|
): ((components: Libp2pComponents) => PeerDiscovery)[] {
|
|
const dnsEnrTrees = [enrTree["SANDBOX"]];
|
|
|
|
const discoveries: ((components: Libp2pComponents) => PeerDiscovery)[] = [];
|
|
|
|
if (enabled?.dns) {
|
|
discoveries.push(wakuDnsDiscovery(dnsEnrTrees));
|
|
}
|
|
|
|
if (enabled?.localPeerCache) {
|
|
discoveries.push(wakuLocalPeerCacheDiscovery());
|
|
}
|
|
|
|
if (enabled?.peerExchange) {
|
|
discoveries.push(wakuPeerExchangeDiscovery());
|
|
}
|
|
|
|
return discoveries;
|
|
}
|