[bedtime-architecture] Deepen named tunnel addressing#10
Closed
mmkal wants to merge 4 commits into
Closed
Conversation
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This architecture PR centralizes Captun's named tunnel addressing rules in
src/tunnel-addressing.ts.The CLI, Worker route parsing, and E2E URL helpers now share the same folder-vs-subdomain classifier and the same public/connect URL builders. That removes the duplicated URL logic that tonight's cookie-selector work had already exposed as drift-prone.
Design Choice
Chosen candidate: Named Tunnel Addressing.
The important choice is that URL construction now follows the Worker router's classification, including concrete custom subdomain hosts. That keeps folder hosts such as
captun.account.workers.devon/<name>routes, while subdomain hosts such asmy-test.my-tunnels.comuse the host root for public and connect URLs.Captun's current Worker router does not support path-prefixed server routes because it treats the first path segment as the tunnel name. The shared addressing API now fails fast for path-prefixed server URLs and route patterns instead of generating connect URLs that cannot attach to a tunnel.
Verification
pnpm run typecheckpnpm testReplacement Branches
mmkal/26/05/19/runtime-adapterspnpm install,pnpm run build,pnpm run typecheck,pnpm test, andpnpm --filter @captun/cloudflare-example testfix/server-session-undefined-hook-on-abortpnpm run typecheckandpnpm testmmkal/26/05/19/add-oxlint-oxfmtpnpm install,pnpm run check, andpnpm testmmkal/26/05/19/cookie-rooted-folder-tunnelspnpm run typecheckandpnpm testmmkal/26/05/19/browser-demo-pagenode --check docs/browser-demo.js,node --check docs/browser-demo-client.js,pnpm run typecheck, andpnpm testmmkal/26/05/19/browser-demo-handler-sandboxnode --check docs/browser-demo.js,node --check docs/browser-demo-client.js,node --check docs/browser-demo-handler-worker.js,pnpm run typecheck, andpnpm testmmkal/26/05/19/cookie-selector-affordancesrc/tunnel-addressing.ts; verified withpnpm run typecheckandpnpm test