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.

34 lines (33 loc) 1.28 kB
import * as plugins from '../../plugins.js'; import { type IProxyInfo, type IProxyParseResult } from '../../protocols/proxy/index.js'; export type { IProxyInfo, IProxyParseResult } from '../../protocols/proxy/index.js'; /** * Parser for PROXY protocol v1 (text format) * Spec: https://www.haproxy.org/download/1.8/doc/proxy-protocol.txt * * This class now delegates to the protocol parser but adds * smartproxy-specific features like socket reading and logging */ export declare class ProxyProtocolParser { static readonly PROXY_V1_SIGNATURE = "PROXY "; static readonly MAX_HEADER_LENGTH = 107; static readonly HEADER_TERMINATOR = "\r\n"; /** * Parse PROXY protocol v1 header from buffer * Returns proxy info and remaining data after header */ static parse(data: Buffer): IProxyParseResult; /** * Generate PROXY protocol v1 header */ static generate(info: IProxyInfo): Buffer; /** * Validate IP address format */ private static isValidIP; /** * Attempt to read a complete PROXY protocol header from a socket * Returns null if no PROXY protocol detected or incomplete */ static readFromSocket(socket: plugins.net.Socket, timeout?: number): Promise<IProxyParseResult | null>; }