Compare commits
2 Commits
e2ed9ed184
...
ae6609f0b0
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | ae6609f0b0 | |
Derrick Hammer | 0a9197315c |
|
@ -8,5 +8,6 @@ export declare class PeerDiscovery {
|
||||||
private _sources;
|
private _sources;
|
||||||
registerSource(name: string, source: PeerSource): boolean;
|
registerSource(name: string, source: PeerSource): boolean;
|
||||||
removeSource(name: string): boolean;
|
removeSource(name: string): boolean;
|
||||||
|
removeAllSources(): void;
|
||||||
discover(pubkey: string | Buffer, options?: {}): Promise<Peer | boolean>;
|
discover(pubkey: string | Buffer, options?: {}): Promise<Peer | boolean>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,6 +21,9 @@ class PeerDiscovery {
|
||||||
this._sources.delete(name);
|
this._sources.delete(name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
removeAllSources() {
|
||||||
|
this._sources.clear();
|
||||||
|
}
|
||||||
async discover(pubkey, options = {}) {
|
async discover(pubkey, options = {}) {
|
||||||
if (!b4a_1.default.isBuffer(pubkey)) {
|
if (!b4a_1.default.isBuffer(pubkey)) {
|
||||||
pubkey = b4a_1.default.from(pubkey, "hex");
|
pubkey = b4a_1.default.from(pubkey, "hex");
|
||||||
|
|
|
@ -32,6 +32,10 @@ export class PeerDiscovery {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public removeAllSources(): void {
|
||||||
|
this._sources.clear();
|
||||||
|
}
|
||||||
|
|
||||||
public async discover(
|
public async discover(
|
||||||
pubkey: string | Buffer,
|
pubkey: string | Buffer,
|
||||||
options = {}
|
options = {}
|
||||||
|
|
Loading…
Reference in New Issue