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.

63 lines (62 loc) 1.85 kB
import * as plugins from '../../plugins.js'; /** * Shared Route Context Interface * * This interface defines the route context object that is used by both * SmartProxy and NetworkProxy, ensuring consistent context throughout the system. */ /** * Route context for route matching and function-based target resolution */ export interface IRouteContext { port: number; domain?: string; clientIp: string; serverIp: string; path?: string; query?: string; headers?: Record<string, string>; isTls: boolean; tlsVersion?: string; routeName?: string; routeId?: string; targetHost?: string | string[]; targetPort?: number; timestamp: number; connectionId: string; } /** * Extended context interface with HTTP-specific objects * Used only in NetworkProxy for HTTP request handling */ export interface IHttpRouteContext extends IRouteContext { req?: plugins.http.IncomingMessage; res?: plugins.http.ServerResponse; method?: string; } /** * Extended context interface with HTTP/2-specific objects * Used only in NetworkProxy for HTTP/2 request handling */ export interface IHttp2RouteContext extends IHttpRouteContext { stream?: plugins.http2.ServerHttp2Stream; headers?: Record<string, string>; } /** * Create a basic route context from connection information */ export declare function createBaseRouteContext(options: { port: number; clientIp: string; serverIp: string; domain?: string; isTls: boolean; tlsVersion?: string; connectionId: string; }): IRouteContext; /** * Convert IHttpRouteContext to IRouteContext * This is used to ensure type compatibility when passing HTTP-specific context * to methods that require the base IRouteContext type */ export declare function toBaseContext(httpContext: IHttpRouteContext): IRouteContext;