/** * Loopback CONNECT tunnel and plain-HTTP forward proxy. This is the endpoint * DSH's launcher already routes through `HTTPS_PROXY`; decisions cover the * destination host and port only, so no certificate authority is involved and * no body is ever inspected here. * @module dsh-sensitive-guard/egress/server */ import { type IncomingMessage } from 'node:http'; import type { EgressRecord } from '../audit.js'; import type { GuardMode, Logger } from '../contracts.js'; import { type EgressPolicy, type EgressTarget } from './policy.js'; export interface EgressServerOptions { /** Loopback port; `0` asks the kernel for one (tests only). */ port: number; host?: string; policy: EgressPolicy; mode: () => GuardMode; record: (record: EgressRecord) => void; logger?: Logger; /** Optional upstream HTTP proxy to chain CONNECT tunnels through. */ upstream?: string; connectTimeoutMs?: number; idleTimeoutMs?: number; } export interface EgressServer { readonly port: number; close(): Promise; } /** Model-visible code explaining a refusal; the caller sees `fetch failed`. */ export declare function guardHeaderCode(reason: string): string; interface ParsedHttpRequest { target: EgressTarget; path: string; } /** Resolve the destination of a plain-HTTP proxy request without any I/O. */ export declare function parseHttpTarget(request: IncomingMessage): ParsedHttpRequest | undefined; /** Start the listener; resolves only after `listen` succeeded. */ export declare function startEgressServer(options: EgressServerOptions): Promise; export {}; //# sourceMappingURL=server.d.ts.map