/**
 * Node.js net module shim
 * Basic Socket and Server classes for virtual networking
 */
import { EventEmitter } from './events';
import { Duplex, Buffer } from './stream';
export interface AddressInfo {
    address: string;
    family: string;
    port: number;
}
export interface SocketOptions {
    allowHalfOpen?: boolean;
    readable?: boolean;
    writable?: boolean;
}
export interface ServerOptions {
    allowHalfOpen?: boolean;
    pauseOnConnect?: boolean;
}
export interface ListenOptions {
    port?: number;
    host?: string;
    backlog?: number;
}
/**
 * Virtual Socket implementation
 */
export declare class Socket extends Duplex {
    private _connecting;
    private _connected;
    private _destroyed;
    private _remoteAddress;
    private _remotePort;
    private _localAddress;
    private _localPort;
    localAddress: string;
    localPort: number;
    remoteAddress?: string;
    remotePort?: number;
    remoteFamily?: string;
    connecting: boolean;
    destroyed: boolean;
    readyState: string;
    constructor(options?: SocketOptions);
    connect(portOrOptions: number | {
        port: number;
        host?: string;
    }, hostOrCallback?: string | (() => void), callback?: () => void): this;
    address(): AddressInfo | null;
    setEncoding(encoding: BufferEncoding): this;
    setTimeout(timeout: number, callback?: () => void): this;
    setNoDelay(noDelay?: boolean): this;
    setKeepAlive(enable?: boolean, initialDelay?: number): this;
    ref(): this;
    unref(): this;
    destroy(error?: Error): this;
    _receiveData(data: Buffer | string): void;
    _receiveEnd(): void;
}
/**
 * Virtual Server implementation
 */
export declare class Server extends EventEmitter {
    private _listening;
    private _address;
    private _connections;
    private _maxConnections;
    listening: boolean;
    maxConnections?: number;
    constructor(optionsOrConnectionListener?: ServerOptions | ((socket: Socket) => void), connectionListener?: (socket: Socket) => void);
    listen(portOrOptions?: number | ListenOptions, hostOrCallback?: string | number | (() => void), backlogOrCallback?: number | (() => void), callback?: () => void): this;
    address(): AddressInfo | null;
    close(callback?: (err?: Error) => void): this;
    getConnections(callback: (err: Error | null, count: number) => void): void;
    ref(): this;
    unref(): this;
    _handleConnection(socket: Socket): void;
}
export declare function createServer(optionsOrConnectionListener?: ServerOptions | ((socket: Socket) => void), connectionListener?: (socket: Socket) => void): Server;
export declare function createConnection(portOrOptions: number | {
    port: number;
    host?: string;
}, hostOrCallback?: string | (() => void), callback?: () => void): Socket;
export declare const connect: typeof createConnection;
export declare function isIP(input: string): number;
export declare function isIPv4(input: string): boolean;
export declare function isIPv6(input: string): boolean;
/**
 * Minimal shim of Node's net.BlockList — supports the common IPv4
 * address/range/subnet cases; IPv6 rules only match by exact address.
 */
export declare class BlockList {
    private rulesList;
    addAddress(address: string, type?: "ipv4" | "ipv6"): void;
    addRange(start: string, end: string, type?: "ipv4" | "ipv6"): void;
    addSubnet(network: string, prefix: number, type?: "ipv4" | "ipv6"): void;
    check(address: string, type?: "ipv4" | "ipv6"): boolean;
    get rules(): string[];
}
declare const _default: {
    Socket: typeof Socket;
    Server: typeof Server;
    createServer: typeof createServer;
    createConnection: typeof createConnection;
    connect: typeof createConnection;
    isIP: typeof isIP;
    isIPv4: typeof isIPv4;
    isIPv6: typeof isIPv6;
    BlockList: typeof BlockList;
};
export default _default;
//# sourceMappingURL=net.d.ts.map