2024-01-15 16:12:01 -08:00
|
|
|
import { PeerStore } from "@libp2p/interface";
|
2023-08-17 19:50:35 +05:30
|
|
|
|
2024-09-06 01:10:54 +02:00
|
|
|
export const DNS_DISCOVERY_TAG = "@waku/bootstrap";
|
|
|
|
|
|
2023-08-17 19:50:35 +05:30
|
|
|
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[];
|
2025-03-24 11:23:16 +11:00
|
|
|
|
2023-08-17 19:50:35 +05:30
|
|
|
/**
|
|
|
|
|
* 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;
|
|
|
|
|
}
|
2024-09-06 01:10:54 +02:00
|
|
|
|
|
|
|
|
export interface DiscoveryTrigger {
|
|
|
|
|
findPeers: () => Promise<void>;
|
|
|
|
|
}
|