mirror of
https://github.com/coder/code-server.git
synced 2026-05-06 20:41:59 +02:00
53 lines
1.1 KiB
TypeScript
53 lines
1.1 KiB
TypeScript
import * as net from "net";
|
|
import { Client } from "../client";
|
|
|
|
type NodeNet = typeof net;
|
|
|
|
/**
|
|
* Implementation of net for the browser.
|
|
*/
|
|
export class Net implements NodeNet {
|
|
|
|
public constructor(
|
|
private readonly client: Client,
|
|
) {}
|
|
|
|
public get Socket(): typeof net.Socket {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
public get Server(): typeof net.Server {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
public connect(): net.Socket {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
// tslint:disable-next-line no-any
|
|
public createConnection(...args: any[]): net.Socket {
|
|
//@ts-ignore
|
|
return this.client.createConnection(...args) as net.Socket;
|
|
}
|
|
|
|
public isIP(_input: string): number {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
public isIPv4(_input: string): boolean {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
public isIPv6(_input: string): boolean {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
public createServer(
|
|
_options?: { allowHalfOpen?: boolean, pauseOnConnect?: boolean } | ((socket: net.Socket) => void),
|
|
_connectionListener?: (socket: net.Socket) => void,
|
|
): net.Server {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
}
|