← Back to PRs

#11098: Support dual-stack custom and LAN gateway binds

by zUZWqEHF open 2026-02-07 11:41 View on GitHub →
gateway stale
This change enables IPv4+IPv6 dual-stack binding for custom and LAN modes. When bindHost is 0.0.0.0, the gateway additionally tries to bind :: and listens on both stacks if available. Custom bind hosts now accept IPv6 addresses as valid targets, while the existing fallback behavior remains unchanged when binding is not possible. <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR updates gateway networking utilities to support dual-stack binds in LAN/custom modes: - `resolveGatewayBindHost` now treats both IPv4 and IPv6 literals as valid custom bind targets. - `resolveGatewayListenHosts` expands `127.0.0.1` to also listen on `::1` when possible, and expands `0.0.0.0` to also listen on `::` when possible. - Tests were updated to cover the new LAN dual-stack behavior. These functions are used by the gateway startup/runtime path (e.g. `src/gateway/server-runtime-state.ts`) to decide which addresses the HTTP/WebSocket server(s) bind to. <h3>Confidence Score: 3/5</h3> - This PR is close to safe to merge, but has a couple behavior changes/leaks that should be fixed first. - Core dual-stack logic looks consistent with how bind hosts are consumed, and tests cover the new `0.0.0.0` => `::` behavior. Remaining concerns are (1) a breaking change for custom binds that previously could use hostnames but now reject them, and (2) `canBindToHost` not closing the server on error, which can leak handles in error cases/repeated calls. - src/gateway/net.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs