mirror of
https://github.com/logos-messaging/logos-messaging-js.git
synced 2026-01-12 21:13:09 +00:00
Nodes returned by DNS Discovery are not guaranteed to be reachable. Hence, setting an upfront limit based on sought capability does not provide any guarantees that such capability should be reached. The discovery's mechanism role is to find Waku 2 nodes. As many as possible. It is then the role of the peer manager to decide: - whether to attempt connecting to the node based on advertised capabilities - retain connection to the node based on actual mounted protocols. We still want to prevent infinite loops, hence the `maxGet` parameter. Also, there was a dichotomy between code tested, and code actually used by libp2p peer discovery, now resolved. # Conflicts: # packages/discovery/src/dns/constants.ts
44 lines
898 B
TypeScript
44 lines
898 B
TypeScript
import { PeerStore } from "@libp2p/interface";
|
|
|
|
export const DNS_DISCOVERY_TAG = "@waku/bootstrap";
|
|
|
|
export type SearchContext = {
|
|
domain: string;
|
|
publicKey: string;
|
|
visits: { [key: string]: boolean };
|
|
};
|
|
|
|
export interface DnsClient {
|
|
resolveTXT: (domain: string) => Promise<string[]>;
|
|
}
|
|
|
|
export interface DnsDiscoveryComponents {
|
|
peerStore: PeerStore;
|
|
}
|
|
|
|
export interface DnsDiscOptions {
|
|
/**
|
|
* ENR URL to use for DNS discovery
|
|
*/
|
|
enrUrls: string | string[];
|
|
|
|
/**
|
|
* Tag a bootstrap peer with this name before "discovering" it (default: 'bootstrap')
|
|
*/
|
|
tagName?: string;
|
|
|
|
/**
|
|
* The bootstrap peer tag will have this value (default: 50)
|
|
*/
|
|
tagValue?: number;
|
|
|
|
/**
|
|
* Cause the bootstrap peer tag to be removed after this number of ms (default: 2 minutes)
|
|
*/
|
|
tagTTL?: number;
|
|
}
|
|
|
|
export interface DiscoveryTrigger {
|
|
findPeers: () => Promise<void>;
|
|
}
|