/** * MultiProtocolProxyChain.js * * Node.js class that implements a local proxy server (http/https/socks4/socks5/ssh) * whose outgoing connections are strictly chained through a user-provided list * of upstream proxies in the given order: * * client -> local proxy -> proxies[0] -> proxies[1] -> ... -> target * * Upstream proxy object format (example): * { * protocol: 'socks5' | 'socks4' | 'http' | 'https' | 'ssh', * host: '1.2.3.4', * port: 1080, * userId: 'user', // optional for auth * password: 'pass' // optional * } * * Dependencies: ssh2 * npm i ssh2 * * NOTE: This implementation focuses on correctness of chaining and * protocol handshakes; it is not production-hardened for all * edge-cases (e.g. full HTTP header rewriting, TLS certificate generation). */ import { EventEmitter } from 'events'; type ProxySpec = { protocol: 'socks5' | 'socks4' | 'http' | 'https' | 'ssh'; host: string; port: number; userId?: string; password?: string; }; /** * MultiProtocolProxyChain class */ export declare class MultiProtocolProxyChain extends EventEmitter { private proxies; private servers; private logger; constructor(opts?: { logger?: { log: (...args: any[]) => void; error: (...args: any[]) => void; }; }); /** * Set upstream proxies array (in order). * @param {Array} proxies */ setProxies(proxies: ProxySpec[]): void; /** * Start a local proxy server of given protocol on given port. * protocol: 'http' | 'https' | 'socks5' | 'socks4' | 'ssh' (local 'ssh' server is a raw TCP passthrough) * returns URL string for local proxy (eg 'socks5://127.0.0.1:2000') */ start(protocol: ProxySpec['protocol'], port: number, host?: string): Promise; /** * Stop all started servers */ stopAll(): Promise; } export {}; //# sourceMappingURL=multi-protocol-proxy-chain.d.ts.map