2022-07-20 06:13:07 +00:00
|
|
|
/// <reference types="node" />
|
|
|
|
/// <reference types="node" />
|
|
|
|
import { EventEmitter } from "events";
|
|
|
|
import { ErrTuple } from "libskynet";
|
|
|
|
import { Buffer } from "buffer";
|
|
|
|
export declare class DHT {
|
2022-08-03 16:29:53 +00:00
|
|
|
private useDefaultDht;
|
|
|
|
private id;
|
|
|
|
constructor(useDefaultDht?: boolean);
|
2022-07-20 06:13:07 +00:00
|
|
|
connect(pubkey: string): Promise<Socket>;
|
|
|
|
ready(): Promise<ErrTuple>;
|
2022-07-20 07:27:17 +00:00
|
|
|
addRelay(pubkey: string): Promise<void>;
|
2022-07-20 22:03:37 +00:00
|
|
|
removeRelay(pubkey: string): Promise<void>;
|
|
|
|
clearRelays(): Promise<void>;
|
2022-08-14 11:33:04 +00:00
|
|
|
getRelays(): Promise<string[]>;
|
|
|
|
getRelayServers(): Promise<string[]>;
|
2022-08-03 16:29:53 +00:00
|
|
|
private create;
|
|
|
|
close(): Promise<boolean>;
|
2022-08-03 16:37:15 +00:00
|
|
|
private setup;
|
2022-07-20 06:13:07 +00:00
|
|
|
}
|
|
|
|
export declare class Socket extends EventEmitter {
|
|
|
|
private id;
|
|
|
|
private eventUpdates;
|
|
|
|
constructor(id: number);
|
|
|
|
on(eventName: string, listener: (...args: any[]) => void): this;
|
|
|
|
off(type: string, listener: any): this;
|
|
|
|
write(message: string | Buffer): void;
|
2022-09-01 00:35:02 +00:00
|
|
|
close(): void;
|
2022-07-20 06:13:07 +00:00
|
|
|
private ensureEvent;
|
|
|
|
private trackEvent;
|
|
|
|
}
|
|
|
|
//# sourceMappingURL=index.d.ts.map
|