mirror of
https://github.com/coder/code-server.git
synced 2026-01-20 20:46:49 +08:00
* Implement net.Server * Move Socket class into Client This way we don't need to expose anything. * Remove some unused imports * Pass environment variables to bootstrap fork * Add debug log for when socket disconnects from server * Use VSCODE_ALLOW_IO for shared process only * Extension host can send messages now * Support callback for logging This lets us do potentially expensive operations which will only be performed if the log level is sufficiently low. * Stop extension host from committing suicide * Blank line * Add static serve (#21) * Add extension URLs * how did i remove this * Fix writing an empty string * Implement dialogs on window service
56 lines
1.3 KiB
TypeScript
56 lines
1.3 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 {
|
|
// @ts-ignore
|
|
return this.client.Socket;
|
|
}
|
|
|
|
public get Server(): typeof net.Server {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
public connect(): net.Socket {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
public createConnection(target: string | number | net.NetConnectOpts, host?: string | Function, callback?: Function): net.Socket {
|
|
if (typeof target === "object") {
|
|
throw new Error("not implemented");
|
|
}
|
|
|
|
return this.client.createConnection(target, typeof host === "function" ? host : callback) 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 {
|
|
return this.client.createServer() as net.Server;
|
|
}
|
|
|
|
}
|