mirror of https://github.com/waku-org/js-waku.git
26 lines
663 B
TypeScript
26 lines
663 B
TypeScript
import type { PeerDiscovery } from "@libp2p/interface";
|
|
import {
|
|
enrTree,
|
|
wakuDnsDiscovery,
|
|
wakuLocalPeerCacheDiscovery,
|
|
wakuPeerExchangeDiscovery
|
|
} from "@waku/discovery";
|
|
import { type Libp2pComponents, PubsubTopic } from "@waku/interfaces";
|
|
|
|
const DEFAULT_NODE_REQUIREMENTS = {
|
|
lightPush: 1,
|
|
filter: 1,
|
|
store: 1
|
|
};
|
|
|
|
export function defaultPeerDiscoveries(
|
|
pubsubTopics: PubsubTopic[]
|
|
): ((components: Libp2pComponents) => PeerDiscovery)[] {
|
|
const discoveries = [
|
|
wakuDnsDiscovery([enrTree["SANDBOX"]], DEFAULT_NODE_REQUIREMENTS),
|
|
wakuLocalPeerCacheDiscovery(),
|
|
wakuPeerExchangeDiscovery(pubsubTopics)
|
|
];
|
|
return discoveries;
|
|
}
|