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.

39 lines (38 loc) 1.53 kB
import type { IRouteConfig } from './models/route-types.js'; import type { IRustRouteConfig } from './models/rust-types.js'; /** * Preprocesses routes before sending them to Rust. * * Strips non-serializable fields (functions, callbacks) and classifies * routes that must be handled by TypeScript (socket-handler, dynamic host/port). */ export declare class RoutePreprocessor { /** * Map of route name/id → original route config (with JS functions preserved). * Used by the socket handler server to look up the original handler. */ private originalRoutes; /** * Preprocess routes for the Rust binary. * * - Routes with `socketHandler` callbacks are marked as socket-handler type * (Rust will relay these back to TS) * - Routes with dynamic `host`/`port` functions are converted to socket-handler * type (Rust relays, TS resolves the function) * - Non-serializable fields are stripped * - Original routes are preserved in the local map for handler lookup */ preprocessForRust(routes: IRouteConfig[]): IRustRouteConfig[]; /** * Get the original route config (with JS functions) by route name or id. */ getOriginalRoute(routeKey: string): IRouteConfig | undefined; /** * Get all original routes that have socket handlers or dynamic functions. */ getHandlerRoutes(): Map<string, IRouteConfig>; private preprocessRoute; private routeNeedsTsHandling; private cleanAction; private cleanTarget; }