diff --git a/src/index.ts b/src/index.ts index 98c6a4f..3331ddc 100644 --- a/src/index.ts +++ b/src/index.ts @@ -5,7 +5,10 @@ export interface Peer { port: number; } -export type PeerSource = (pubkey: Buffer) => Promise; +export type PeerSource = ( + pubkey: Buffer, + options?: any +) => Promise; export class PeerDiscovery { private _sources: Map = new Map(); @@ -29,13 +32,16 @@ export class PeerDiscovery { return true; } - public async discover(pubkey: string | Buffer): Promise { + public async discover( + pubkey: string | Buffer, + options = {} + ): Promise { if (!b4a.isBuffer(pubkey)) { pubkey = b4a.from(pubkey, "hex") as Buffer; } for (const source of this._sources.values()) { - const result = await source(pubkey); + const result = await source(pubkey, options); if (result) { return result;