/** * Shared proxy URL parsing for Playwright and Puppeteer wrappers. */ export interface ParsedProxy { server: string; username?: string; password?: string; } /** * Prepend http:// to schemeless proxy URLs so parsers can extract hostname. * Used by geoip resolution which only needs a valid hostname, not auth fields. */ export declare function ensureProxyScheme(proxyUrl: string): string; /** * Parse a proxy URL, extracting credentials into separate fields. * * Handles authenticated proxy URLs by extracting credentials into separate * fields. Also handles: no credentials, URL-encoded special chars, socks5://, * missing port, and bare proxy strings without a scheme. */ /** Proxy dict shape accepted by Playwright/Puppeteer wrappers. */ export type ProxyDict = { server: string; bypass?: string; username?: string; password?: string; }; /** Result of resolveProxyConfig — either Playwright dict OR Chrome arg, never both. */ export interface ProxyConfig { /** Playwright proxy option (for HTTP proxies). */ proxyOption?: ParsedProxy; /** Chrome CLI args (for SOCKS5 proxies, e.g. ["--proxy-server=socks5://..."]). */ proxyArgs: string[]; } /** * Check if a proxy uses the SOCKS5 protocol. */ export declare function isSocksProxy(proxy: string | ProxyDict | undefined | null): boolean; /** * Reconstruct a SOCKS5 URL with inline credentials from a proxy dict. */ export declare function reconstructSocksUrl(proxy: ProxyDict): string; /** * Re-encode credentials in a SOCKS5 URL string so Chromium's parser doesn't * truncate them at special chars like '='. Idempotent: pre-encoded input stays * the same (decoded then re-encoded). * * Parsing is done manually rather than via `new URL` + setters, because WHATWG * URL's username/password setters re-encode `%` on assignment, causing * double-encoding when we round-trip decode-then-encode. * * On any unexpected failure, logs a warning and returns the original string * so Chromium's own error handling can surface the real problem. */ export declare function normalizeSocksStringUrl(urlStr: string): string; /** * Reconstruct an HTTP(S) proxy URL with inline credentials from a proxy dict. */ export declare function reconstructHttpUrl(proxy: ProxyDict): string; /** * Re-encode credentials in an HTTP(S) proxy URL string for --proxy-server. * Same pattern as normalizeSocksStringUrl. */ export declare function normalizeHttpStringUrl(urlStr: string): string; /** * Resolve proxy into Playwright option and/or Chrome args. * * Proxies with credentials (SOCKS5 or HTTP/HTTPS on supported platforms) are * passed via Chrome's --proxy-server flag with inline credentials, bypassing * Playwright's CDP auth interceptor which breaks on some proxies (#182). */ export declare function resolveProxyConfig(proxy: string | ProxyDict | undefined, browserVersion?: string, licenseKey?: string): ProxyConfig; export declare function parseProxyUrl(proxy: string): ParsedProxy; //# sourceMappingURL=proxy.d.ts.map