Compare commits
2 Commits
ae6609f0b0
...
038555ac62
Author | SHA1 | Date |
---|---|---|
Derrick Hammer | 038555ac62 | |
Derrick Hammer | b6469a6a45 |
|
@ -9,5 +9,6 @@ export declare class PeerDiscovery {
|
||||||
registerSource(name: string, source: PeerSource): boolean;
|
registerSource(name: string, source: PeerSource): boolean;
|
||||||
removeSource(name: string): boolean;
|
removeSource(name: string): boolean;
|
||||||
removeAllSources(): void;
|
removeAllSources(): void;
|
||||||
|
sourceExists(name: string): boolean;
|
||||||
discover(pubkey: string | Buffer, options?: {}): Promise<Peer | boolean>;
|
discover(pubkey: string | Buffer, options?: {}): Promise<Peer | boolean>;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,9 @@ class PeerDiscovery {
|
||||||
removeAllSources() {
|
removeAllSources() {
|
||||||
this._sources.clear();
|
this._sources.clear();
|
||||||
}
|
}
|
||||||
|
sourceExists(name) {
|
||||||
|
return this._sources.has(name);
|
||||||
|
}
|
||||||
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");
|
||||||
|
|
|
@ -36,6 +36,10 @@ export class PeerDiscovery {
|
||||||
this._sources.clear();
|
this._sources.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public sourceExists(name: string): boolean {
|
||||||
|
return this._sources.has(name);
|
||||||
|
}
|
||||||
|
|
||||||
public async discover(
|
public async discover(
|
||||||
pubkey: string | Buffer,
|
pubkey: string | Buffer,
|
||||||
options = {}
|
options = {}
|
||||||
|
|
Loading…
Reference in New Issue