2023-01-12 17:50:38 +00:00
|
|
|
import { PeerOptions, DataSocketOptions } from "./peer.js";
|
|
|
|
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 _socketOptions: DataSocketOptions;
|
|
|
|
protected _autostart: boolean;
|
2023-03-15 12:14:29 +00:00
|
|
|
constructor({ swarm, protocol, onopen, onreceive, onsend, onclose, onchannel, listen, autostart, emulateWebsocket, createDefaultMessage, }: ProxyOptions);
|
2023-01-12 17:50:38 +00:00
|
|
|
private _swarm;
|
|
|
|
get swarm(): any;
|
|
|
|
private _protocol;
|
|
|
|
get protocol(): string;
|
|
|
|
handlePeer({ peer, muxer, ...options }: DataSocketOptions & PeerOptions): void;
|
|
|
|
protected _init(): void;
|
|
|
|
private init;
|
|
|
|
private _handleConnection;
|
|
|
|
}
|