UNPKG

@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.

80 lines (79 loc) 2.48 kB
/** * Protocol Detector * * Simplified protocol detection using the new architecture */ import type { IDetectionResult, IDetectionOptions } from './models/detection-types.js'; import type { IConnectionContext } from '../protocols/common/types.js'; /** * Main protocol detector class */ export declare class ProtocolDetector { private static instance; private fragmentManager; private tlsDetector; private httpDetector; private connectionProtocols; constructor(); private static getInstance; /** * Detect protocol from buffer data */ static detect(buffer: Buffer, options?: IDetectionOptions): Promise<IDetectionResult>; private detectInstance; /** * Detect protocol with connection tracking for fragmented data * @deprecated Use detectWithContext instead */ static detectWithConnectionTracking(buffer: Buffer, connectionId: string, options?: IDetectionOptions): Promise<IDetectionResult>; /** * Detect protocol with connection context for fragmented data */ static detectWithContext(buffer: Buffer, context: IConnectionContext, options?: IDetectionOptions): Promise<IDetectionResult>; private detectWithContextInstance; /** * Clean up resources */ static cleanup(): void; private cleanupInstance; /** * Destroy detector instance */ static destroy(): void; private destroyInstance; /** * Clean up old connection tracking entries * * @param _maxAge Maximum age in milliseconds (default: 30 seconds) */ static cleanupConnections(_maxAge?: number): void; /** * Clean up fragments for a specific connection */ static cleanupConnection(context: IConnectionContext): void; /** * Extract domain from connection info */ static extractDomain(connectionInfo: any): string | undefined; /** * Create a connection ID from connection parameters * @deprecated Use createConnectionContext instead */ static createConnectionId(params: { sourceIp?: string; sourcePort?: number; destIp?: string; destPort?: number; socketId?: string; }): string; /** * Create a connection context from parameters */ static createConnectionContext(params: { sourceIp?: string; sourcePort?: number; destIp?: string; destPort?: number; socketId?: string; }): IConnectionContext; }