@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.
83 lines (82 loc) • 2.69 kB
TypeScript
import type { NfTablesStatus } from '../nftables-proxy/models/interfaces.js';
import type { IRouteConfig } from './models/route-types.js';
import type { SmartProxy } from './smart-proxy.js';
/**
* Manages NFTables rules based on SmartProxy route configurations
*
* This class bridges the gap between SmartProxy routes and the NFTablesProxy,
* allowing high-performance kernel-level packet forwarding for routes that
* specify NFTables as their forwarding engine.
*/
export declare class NFTablesManager {
private smartProxy;
private rulesMap;
/**
* Creates a new NFTablesManager
*
* @param smartProxy The SmartProxy instance
*/
constructor(smartProxy: SmartProxy);
/**
* Provision NFTables rules for a route
*
* @param route The route configuration
* @returns A promise that resolves to true if successful, false otherwise
*/
provisionRoute(route: IRouteConfig): Promise<boolean>;
/**
* Remove NFTables rules for a route
*
* @param route The route configuration
* @returns A promise that resolves to true if successful, false otherwise
*/
deprovisionRoute(route: IRouteConfig): Promise<boolean>;
/**
* Update NFTables rules when route changes
*
* @param oldRoute The previous route configuration
* @param newRoute The new route configuration
* @returns A promise that resolves to true if successful, false otherwise
*/
updateRoute(oldRoute: IRouteConfig, newRoute: IRouteConfig): Promise<boolean>;
/**
* Generate a unique ID for a route
*
* @param route The route configuration
* @returns A unique ID string
*/
private generateRouteId;
/**
* Create NFTablesProxy options from a route configuration
*
* @param route The route configuration
* @returns NFTableProxyOptions object
*/
private createNfTablesOptions;
/**
* Expand port range specifications
*
* @param ports The port range specification
* @returns Expanded port range
*/
private expandPortRange;
/**
* Get status of all managed rules
*
* @returns A promise that resolves to a record of NFTables status objects
*/
getStatus(): Promise<Record<string, NfTablesStatus>>;
/**
* Check if a route is currently provisioned
*
* @param route The route configuration
* @returns True if the route is provisioned, false otherwise
*/
isRouteProvisioned(route: IRouteConfig): boolean;
/**
* Stop all NFTables rules
*
* @returns A promise that resolves when all rules have been stopped
*/
stop(): Promise<void>;
}