$ show openclaw/proxyline
Proxyline is a Node.js library that installs a process-wide proxy routing policy across `node:http`, `node:https`, undici/fetch, WebSocket clients, and explicit HTTP CONNECT tunnels. It provides two modes: `managed` (fail-closed with a required proxy URL) and `ambient` (respects `HTTP_PROXY`/`HTTPS_PROXY`/`NO_PROXY` environment variables). The library patches global HTTP(S) methods, replaces global agents, installs a custom undici dispatcher, and patches fetch globals. It includes observability via `explain()` and lifecycle events, scoped proxy TLS trust, dynamic bypass registrations, and credential-safe URL redaction. The codebase is TypeScript, ESM-only, and requires Node.js 22.19+ with undici 8.5+ as a peer dependency. It is well-tested with an in-process proxy lab and has comprehensive documentation.
The LLM identified 2 files worth highlighting for reuse:
Implements parsing of proxy environment variables (`HTTP_PROXY`, `HTTPS_PROXY`, `ALL_PROXY`, `NO_PROXY` and lowercase variants) with support for bare endpoints, scheme defaults, IPv6, port-specific NO_PROXY entries, suffix/wildcard matching, and trailing dot normalization. The `createAmbientProxyResolver` function produces a `ProxyResolver` object used by the runtime. This module is self-contained and could be extracted as a standalone utility for any Node.js project needing consistent proxy environment parsing.
Provides a single function `connectToProxy` that creates a TCP or TLS socket to an HTTP/HTTPS proxy endpoint. It handles TLS options (CA, client certificates, SNI, ALPN), connection controls (custom DNS lookup), and rejects unsupported JavaScript properties. The module is only 50 lines, has no internal dependencies beyond `shared.ts` for TLS resolution, and demonstrates clean separation of proxy hop configuration from destination tunnel logic.