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.

58 lines (57 loc) 1.86 kB
import type { SmartProxy } from './smart-proxy.js'; /** * Interface for connection information used for SNI extraction */ interface IConnectionInfo { sourceIp: string; sourcePort: number; destIp: string; destPort: number; } /** * Manages TLS-related operations including SNI extraction and validation */ export declare class TlsManager { private smartProxy; constructor(smartProxy: SmartProxy); /** * Check if a data chunk appears to be a TLS handshake */ isTlsHandshake(chunk: Buffer): boolean; /** * Check if a data chunk appears to be a TLS ClientHello */ isClientHello(chunk: Buffer): boolean; /** * Extract Server Name Indication (SNI) from TLS handshake */ extractSNI(chunk: Buffer, connInfo: IConnectionInfo, previousDomain?: string): string | undefined; /** * Handle session resumption attempts */ handleSessionResumption(chunk: Buffer, connectionId: string, hasSNI: boolean): { shouldBlock: boolean; reason?: string; }; /** * Check for SNI mismatch during renegotiation */ checkRenegotiationSNI(chunk: Buffer, connInfo: IConnectionInfo, expectedDomain: string, connectionId: string): { hasMismatch: boolean; extractedSNI?: string; }; /** * Create a renegotiation handler function for a connection */ createRenegotiationHandler(connectionId: string, lockedDomain: string, connInfo: IConnectionInfo, onMismatch: (connectionId: string, reason: string) => void): (chunk: Buffer) => void; /** * Analyze TLS connection for browser fingerprinting * This helps identify browser vs non-browser connections */ analyzeClientHello(chunk: Buffer): { isBrowserConnection: boolean; isRenewal: boolean; hasSNI: boolean; }; } export {};