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.

48 lines (47 loc) 1.59 kB
import type { IConnectionRecord, IPortProxySettings } from './classes.pp.interfaces.js'; /** * Manages timeouts and inactivity tracking for connections */ export declare class TimeoutManager { private settings; constructor(settings: IPortProxySettings); /** * Ensure timeout values don't exceed Node.js max safe integer */ ensureSafeTimeout(timeout: number): number; /** * Generate a slightly randomized timeout to prevent thundering herd */ randomizeTimeout(baseTimeout: number, variationPercent?: number): number; /** * Update connection activity timestamp */ updateActivity(record: IConnectionRecord): void; /** * Calculate effective inactivity timeout based on connection type */ getEffectiveInactivityTimeout(record: IConnectionRecord): number; /** * Calculate effective max lifetime based on connection type */ getEffectiveMaxLifetime(record: IConnectionRecord): number; /** * Setup connection timeout * @returns The cleanup timer */ setupConnectionTimeout(record: IConnectionRecord, onTimeout: (record: IConnectionRecord, reason: string) => void): NodeJS.Timeout; /** * Check for inactivity on a connection * @returns Object with check results */ checkInactivity(record: IConnectionRecord): { isInactive: boolean; shouldWarn: boolean; inactivityTime: number; effectiveTimeout: number; }; /** * Apply socket timeout settings */ applySocketTimeouts(record: IConnectionRecord): void; }