@push.rocks/smartproxy
Version:
A powerful proxy package with unified route-based configuration for high traffic management. Features include SSL/TLS support, flexible routing patterns, WebSocket handling, advanced security options, and automatic ACME certificate management.
17 lines (16 loc) • 599 B
TypeScript
/**
* Socket Tracker Utility
* Provides standardized socket cleanup with proper listener and timer management
*/
import type { Socket } from 'net';
export type SocketTracked = {
cleanup: () => void;
addListener: <E extends string>(event: E, listener: (...args: any[]) => void) => void;
addTimer: (t: NodeJS.Timeout | null | undefined) => void;
safeDestroy: (reason?: Error) => void;
};
/**
* Create a socket tracker to manage listeners and timers
* Ensures proper cleanup and prevents memory leaks
*/
export declare function createSocketTracker(socket: Socket): SocketTracked;