import { Duplex } from 'stream'; import { EnvType, IRequestExtension } from '../types'; export interface IVpcConnectorTunnelTarget { cloudTag: string; host: string; port: number; } /** * Opens a TCP stream to a private VPC host via the Ductape VPC connector relay. * Used by hosted proxy / SDK when cloud connection networking mode is vpc_connector. */ export declare function openVpcConnectorTunnelStream(target: IVpcConnectorTunnelTarget, ctx: { environment: EnvType; auth: IRequestExtension; timeoutMs?: number; }): Promise; /** * Starts a loopback-only local TCP proxy that forwards bytes to/from the given tunnel * stream. Used so database drivers that cannot accept a custom socket/stream (MySQL, * MariaDB, MongoDB, Cassandra) can connect over an ordinary TCP connection to * `127.0.0.1:` instead of the unreachable private host, mirroring the Go and Java * SDKs' "rewrite the connection string to point at a local proxy" pattern. * * Accepts exactly one connection (the listener is closed immediately after accept, so no * further connections are accepted), then pipes bytes bidirectionally between the accepted * socket and `stream`. The returned promise resolves once the server is listening — callers * do not need to wait for a connection to be accepted before rewriting the connection * string and handing it to a driver. */ export declare function startLocalTunnelProxy(stream: Duplex): Promise<{ host: string; port: number; close: () => void; }>; /** * Replaces the host:port of a database connection URL with the given local loopback * address, preserving scheme, credentials, path, and query parameters. Handles bare * `host:port` connection strings (no `scheme://` prefix) the same way the Go SDK's * `rewriteConnectionStringHost` does, by temporarily attaching a placeholder scheme for * parsing and stripping it back off afterwards. */ export declare function rewriteConnectionStringHost(connectionUrl: string, localHost: string, localPort: number): string;