///
import * as net from "net";
import { ClientProxy, ClientServerProxy } from "../common/proxy";
import { NetModuleProxy, NetServerProxy, NetSocketProxy } from "../server/net";
import { Duplex } from "./stream";
interface ClientNetSocketProxy extends NetSocketProxy, ClientServerProxy {
}
export declare class Socket extends Duplex implements net.Socket {
private _connecting;
private _destroyed;
constructor(proxyPromise: Promise | ClientNetSocketProxy, connecting?: boolean);
connect(options: number | string | net.SocketConnectOpts, host?: string | Function, callback?: Function): this;
end(data?: any, encoding?: string | Function, callback?: Function): void;
write(data: any, encoding?: string | Function, fd?: string | Function): boolean;
readonly connecting: boolean;
readonly destroyed: boolean;
readonly bufferSize: number;
readonly bytesRead: number;
readonly bytesWritten: number;
readonly localAddress: string;
readonly localPort: number;
address(): net.AddressInfo | string;
setTimeout(): this;
setNoDelay(): this;
setKeepAlive(): this;
unref(): void;
ref(): void;
}
interface ClientNetServerProxy extends NetServerProxy, ClientServerProxy {
onConnection(cb: (proxy: ClientNetSocketProxy) => void): Promise;
}
export declare class Server extends ClientProxy implements net.Server {
private socketId;
private readonly sockets;
private _listening;
constructor(proxyPromise: Promise | ClientNetServerProxy);
listen(handle?: net.ListenOptions | number | string, hostname?: string | number | Function, backlog?: number | Function, callback?: Function): this;
readonly connections: number;
readonly listening: boolean;
readonly maxConnections: number;
address(): net.AddressInfo | string;
close(callback?: () => void): this;
ref(): this;
unref(): this;
getConnections(cb: (error: Error | null, count: number) => void): void;
protected handleDisconnect(): void;
}
declare type NodeNet = typeof net;
interface ClientNetModuleProxy extends NetModuleProxy, ClientServerProxy {
createSocket(options?: net.SocketConstructorOpts): Promise;
createConnection(target: string | number | net.NetConnectOpts, host?: string): Promise;
createServer(options?: {
allowHalfOpen?: boolean;
pauseOnConnect?: boolean;
}): Promise;
}
export declare class NetModule implements NodeNet {
private readonly proxy;
readonly Socket: typeof net.Socket;
readonly Server: typeof net.Server;
constructor(proxy: ClientNetModuleProxy);
createConnection: (target: string | number | net.TcpNetConnectOpts | net.IpcNetConnectOpts, host?: string | Function | undefined, callback?: Function | undefined) => net.Socket;
createServer: (options?: {
allowHalfOpen?: boolean | undefined;
pauseOnConnect?: boolean | undefined;
} | ((socket: net.Socket) => void) | undefined, callback?: ((socket: net.Socket) => void) | undefined) => net.Server;
connect: () => net.Socket;
isIP: () => number;
isIPv4: () => boolean;
isIPv6: () => boolean;
}
export {};