mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-03-22 06:43:14 +00:00
* move relay related code * move libp2p to utils * define CreateWakuNodeOptions * improve options * make libp2p use from create function * add bootstrapPeers option * fix lint * fix types, imports * fix exports * use bootstrap along default bootstrap * fix test as REST does not return peer though connection is made * rollback condition change * enable gossipSub back for every node
23 lines
745 B
TypeScript
23 lines
745 B
TypeScript
import type { PeerDiscovery } from "@libp2p/interface";
|
|
import { enrTree, wakuDnsDiscovery } from "@waku/dns-discovery";
|
|
import { type Libp2pComponents, PubsubTopic } from "@waku/interfaces";
|
|
import { wakuLocalPeerCacheDiscovery } from "@waku/local-peer-cache-discovery";
|
|
import { wakuPeerExchangeDiscovery } from "@waku/peer-exchange";
|
|
|
|
const DEFAULT_NODE_REQUIREMENTS = {
|
|
lightPush: 1,
|
|
filter: 1,
|
|
store: 1
|
|
};
|
|
|
|
export function defaultPeerDiscoveries(
|
|
pubsubTopics: PubsubTopic[]
|
|
): ((components: Libp2pComponents) => PeerDiscovery)[] {
|
|
const discoveries = [
|
|
wakuDnsDiscovery([enrTree["PROD"]], DEFAULT_NODE_REQUIREMENTS),
|
|
wakuLocalPeerCacheDiscovery(),
|
|
wakuPeerExchangeDiscovery(pubsubTopics)
|
|
];
|
|
return discoveries;
|
|
}
|