Skip to content

feat: optional Tailscale Funnel public access via codeg-tsnet sidecar#337

Open
ijry wants to merge 10 commits into
xintaofei:mainfrom
ijry:feat/libtailscale-funnel-sidecar
Open

feat: optional Tailscale Funnel public access via codeg-tsnet sidecar#337
ijry wants to merge 10 commits into
xintaofei:mainfrom
ijry:feat/libtailscale-funnel-sidecar

Conversation

@ijry

@ijry ijry commented Jul 14, 2026

Copy link
Copy Markdown

中文

背景

为 Codeg Web 服务提供可选的公网 HTTPS 访问能力,同时保持本地 Web 服务独立可用,且不接管系统 Tailscale。

方案

  • 新增纯 Go sidecar codeg-tsnettsnet userspace),以 sidecar 模式支持 Windows/macOS/Linux
  • Funnel 反向代理到 http://127.0.0.1:<webPort>
  • 独立状态目录:<CODEG_DATA_DIR>/tailscale(可用 CODEG_TS_STATE_DIR 覆盖)
  • 默认 hostname:codeg-<data_dir hash 前 8 hex>(可用 CODEG_TS_HOSTNAME 覆盖)
  • 控制面:仅监听 127.0.0.1,请求头 X-Codeg-Tsnet-Token
  • 桌面端:浏览器 OAuth/login URL 引导授权
  • 服务端/Docker:启用 Funnel 时要求 CODEG_TS_AUTHKEY
  • 启用开关:设置项 funnelEnabled + 环境变量 CODEG_TS_FUNNEL
  • 打包对齐 codeg-mcpprepare-sidecars、Tauri externalBin、release.yml、Docker、installers
  • Funnel 失败不影响本地 Web 服务;Codeg token 在公网 URL 上仍然必填

验证

  • cd codeg-tsnet && go test ./...
  • cargo test --no-default-features --lib --jobs 1 web::tailscale ✅(7 passed)
  • pnpm exec vitest run src/components/settings/web-service-funnel-section.test.tsx ✅(2 passed)
  • cargo check --no-default-features --jobs 1 --bin codeg-server

English

Background

Add optional public HTTPS access for the Codeg Web Service without taking over system Tailscale, and without breaking local web availability.

Approach

  • New pure-Go sidecar codeg-tsnet (tsnet userspace) for Windows/macOS/Linux
  • Funnel reverse-proxies to http://127.0.0.1:<webPort>
  • Private state dir: <CODEG_DATA_DIR>/tailscale (CODEG_TS_STATE_DIR override)
  • Default hostname: codeg-<first 8 hex of data_dir hash> (CODEG_TS_HOSTNAME override)
  • Localhost-only control plane with X-Codeg-Tsnet-Token
  • Desktop: browser OAuth/login URL
  • Server/Docker: CODEG_TS_AUTHKEY required when Funnel is enabled
  • Enable via settings funnelEnabled and/or CODEG_TS_FUNNEL
  • Packaging mirrors codeg-mcp across prepare-sidecars, Tauri externalBin, release matrix, Docker, and installers
  • Funnel failures degrade only Funnel; Codeg bearer token remains required over the public URL

Validation

  • cd codeg-tsnet && go test ./...
  • cargo test --no-default-features --lib --jobs 1 web::tailscale ✅ (7 passed)
  • pnpm exec vitest run src/components/settings/web-service-funnel-section.test.tsx ✅ (2 passed)
  • cargo check --no-default-features --jobs 1 --bin codeg-server

jry added 10 commits July 14, 2026 13:36
Capture the approved design for optional public Web Service access via
a Go tsnet sidecar (codeg-tsnet), with independent state dir, desktop
OAuth, server auth-key, and Windows-friendly packaging.
Break the approved Funnel sidecar design into task-sized implementation
steps covering codeg-tsnet, Rust controller, UI, packaging, and PR.
Introduce a pure Go tsnet sidecar with loopback control API, independent
state directory, browser/auth-key login hooks, and Funnel reverse-proxy
lifecycle for public HTTPS access without touching system Tailscale.
Introduce codeg-tsnet bootstrap/status protocol types, binary resolution, and Funnel status mapping under an independent state directory.
Hook Funnel enable/disable into desktop and codeg-server web start/stop paths, and expose status/enable/login via Tauri commands and HTTP routes.
Add Funnel status UI, API client wrappers, and i18n keys so desktop users can enable Funnel, open login, and copy the public URL.
Ship codeg-tsnet via prepare-sidecars, Tauri externalBin, release matrix, installers, and Docker images next to codeg-mcp.
Document CODEG_TS_FUNNEL, auth key, state dir, hostname, and private userspace node behavior in EN/ZH README.
Create 0-byte placeholders for both Tauri externalBin sidecars in build.rs, and fix prettier formatting in the Funnel settings component/test.
Static export typecheck failed because Funnel copy toast referenced a missing copyFailed message key.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant