@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.
54 lines (53 loc) • 1.51 kB
TypeScript
/**
* TLS Protocol Parser
* Generic TLS parsing utilities separated from implementation logic
*/
import { Buffer } from 'buffer';
import type { ITlsExtension } from './types.js';
/**
* Result of a ClientHello parse operation
*/
export interface IClientHelloParseResult {
isValid: boolean;
version?: [number, number];
random?: Buffer;
sessionId?: Buffer;
hasSessionId: boolean;
cipherSuites?: Buffer;
compressionMethods?: Buffer;
extensions: ITlsExtension[];
serverNameList?: string[];
hasSessionTicket: boolean;
hasPsk: boolean;
hasEarlyData: boolean;
error?: string;
}
/**
* TLS protocol parser utilities
*/
export declare class TlsParser {
/**
* Checks if a buffer contains a TLS handshake record
*/
static isTlsHandshake(buffer: Buffer): boolean;
/**
* Checks if a buffer contains a TLS ClientHello message
*/
static isClientHello(buffer: Buffer): boolean;
/**
* Gets the record length from a TLS record header
*/
static getTlsRecordLength(buffer: Buffer): number;
/**
* Parses a TLS ClientHello message and extracts all components
*/
static parseClientHello(buffer: Buffer): IClientHelloParseResult;
/**
* Parses the server name extension data and extracts hostnames
*/
static parseServerNameExtension(data: Buffer): string[];
/**
* Extract SNI (Server Name Indication) from ClientHello
*/
static extractSNI(buffer: Buffer): string | null;
}