UNPKG

@push.rocks/smartproxy

Version:

A powerful proxy package that effectively handles high traffic, with features such as SSL/TLS support, port proxying, WebSocket handling, dynamic routing with authentication options, and automatic ACME certificate management.

83 lines (82 loc) 2.06 kB
import * as plugins from '../plugins.js'; /** * Configuration options for NetworkProxy */ export interface INetworkProxyOptions { port: number; maxConnections?: number; keepAliveTimeout?: number; headersTimeout?: number; logLevel?: 'error' | 'warn' | 'info' | 'debug'; cors?: { allowOrigin?: string; allowMethods?: string; allowHeaders?: string; maxAge?: number; }; connectionPoolSize?: number; portProxyIntegration?: boolean; useExternalPort80Handler?: boolean; acme?: { enabled?: boolean; port?: number; contactEmail?: string; useProduction?: boolean; renewThresholdDays?: number; autoRenew?: boolean; certificateStore?: string; skipConfiguredCerts?: boolean; }; } /** * Interface for a certificate entry in the cache */ export interface ICertificateEntry { key: string; cert: string; expires?: Date; } /** * Interface for reverse proxy configuration */ export interface IReverseProxyConfig { destinationIps: string[]; destinationPorts: number[]; hostName: string; privateKey: string; publicKey: string; authentication?: { type: 'Basic'; user: string; pass: string; }; rewriteHostHeader?: boolean; } /** * Interface for connection tracking in the pool */ export interface IConnectionEntry { socket: plugins.net.Socket; lastUsed: number; isIdle: boolean; } /** * WebSocket with heartbeat interface */ export interface IWebSocketWithHeartbeat extends plugins.wsDefault { lastPong: number; isAlive: boolean; } /** * Logger interface for consistent logging across components */ export interface ILogger { debug(message: string, data?: any): void; info(message: string, data?: any): void; warn(message: string, data?: any): void; error(message: string, data?: any): void; } /** * Creates a logger based on the specified log level */ export declare function createLogger(logLevel?: string): ILogger;