2023-04-16 02:17:57 +00:00
|
|
|
import { DataSocketOptions, PeerOptions } from "./peer.js";
|
2023-01-12 17:50:38 +00:00
|
|
|
export interface ProxyOptions extends DataSocketOptions {
|
|
|
|
swarm: any;
|
|
|
|
protocol: string;
|
|
|
|
listen?: boolean;
|
|
|
|
autostart?: boolean;
|
|
|
|
}
|
2023-04-15 22:40:09 +00:00
|
|
|
export default abstract class Proxy {
|
2023-04-15 23:35:19 +00:00
|
|
|
protected _listen: any;
|
|
|
|
protected _autostart: boolean;
|
2023-04-16 02:17:57 +00:00
|
|
|
constructor({ swarm, protocol, onopen, onreceive, onsend, onclose, onchannel, listen, autostart, emulateWebsocket, }: ProxyOptions);
|
2023-04-15 23:45:35 +00:00
|
|
|
protected _socketOptions: DataSocketOptions;
|
|
|
|
get socketOptions(): DataSocketOptions;
|
2023-01-12 17:50:38 +00:00
|
|
|
private _swarm;
|
|
|
|
get swarm(): any;
|
|
|
|
private _protocol;
|
|
|
|
get protocol(): string;
|
2023-04-16 02:17:57 +00:00
|
|
|
protected abstract handlePeer({ peer, muxer, ...options }: DataSocketOptions & PeerOptions): any;
|
2023-01-12 17:50:38 +00:00
|
|
|
protected _init(): void;
|
|
|
|
private init;
|
|
|
|
private _handleConnection;
|
|
|
|
}
|