mirror of
https://github.com/239573049/FastGateway.git
synced 2026-10-16 21:10:58 +08:00
f7ebf85f62
- FileStorageService 增加分片上传(暂存目录白名单校验、24h 过期清理、合并/放弃接口) - 新增 MergeChunksRequest / AbortUploadRequest DTO 并注册到 AOT JsonContext - 前端文件管理器:分片上传队列、复制/移动/压缩/解压/下载,剪贴板存节点快照 - 抽出 motion 动画组件与 routes/lazy-pages 路由懒加载单源,侧边栏 hover 预取 - 补全 README 架构、源码布局、运行数据流与隧道数据路径说明
3.5 KiB
3.5 KiB
Repository Guidelines
FastGateway is a self-hosted reverse-proxy and tunnel gateway: a .NET 10 control plane (JWT-protected Minimal API plus per-server Kestrel/YARP gateways) with a React 19 dashboard and an outbound tunnel agent.
Project Structure & Module Organization
src/FastGateway— main host. Key areas:Gateway/(YARP route/cluster construction, TCP/UDPStreamProxyManager),Services/(Minimal API endpoint groups),Middleware/(client-IP, statistics, timeout, access control, failover),Tunnels/(server-side tunnel registration and streams),Infrastructure/(JWT helpers, AOT JSON contexts, IP policy matching, settings), plusDto/,Options/,BackgroundTask/,Extensions/..github/workflows/— CI:docker-image.ymlbuilds the container images,release.ymlpublishes a portable single-file build (-p:PublishAot=false).src/TunnelClient— standalone tunnel agent. Readstunnel.json, registers via/internal/gateway/Server/register, forwards traffic to local services over HTTP/2 or WebSocket.src/Core— shared stream wrappers and entities/enums used by server and agent.src/Certes— vendored, AOT-compatible ACME client. Must stay free of Newtonsoft.Json/BouncyCastle.web— React 19 + TypeScript + Vite dashboard. Itsdistoutput lands inwwwrootviabuild.bat(intopublish/wwwroot) or via the Dockerfile'swebstage (COPY --from=web /web/dist ./src/FastGateway/wwwrootbeforedotnet publish).- No test projects exist yet; place new ones under
tests/.
Build, Test, and Development Commands
dotnet build FastGateway.sln # build backend
dotnet run --project src/FastGateway/FastGateway.csproj # run host (http://localhost:5202)
dotnet run --project src/TunnelClient/TunnelClient.csproj -- -c ./src/TunnelClient/tunnel.json
cd web && npm install && npm run dev # dashboard dev server, proxies /api to :5202
cd web && npm run build # type-check (tsc -b) + production build
cd web && npm run lint # ESLint, zero warnings allowed
docker compose -f docker-compose.yml up -d --build # full stack
Native AOT is enabled by default; pass -p:PublishAot=false for a portable single-file build (as the release workflow does).
Coding Style & Naming Conventions
- C#: 4-space indentation, file-scoped namespaces, PascalCase types/methods; follow existing patterns in
Services/andMiddleware/. - TypeScript/React: functional components, PascalCase component files, camelCase functions/variables; ESLint enforces style with
--max-warnings 0. - Comments: brief and high-signal — explain intent, invariants, or non-obvious behavior (e.g. AOT
JsonTypeInfoconstraints); never restate the code. - Keep
src/CertesAOT-safe: no reflection-heavy serializers or dynamic loading.
Testing Guidelines
No automated tests exist yet. If you add them, use xUnit under tests/ and name tests <Method>_<Scenario>_<Expectation>. Run with dotnet test FastGateway.sln.
Commit & Pull Request Guidelines
- Conventional Commits:
feat:,fix:, optionally scoped (fix(acme):). Descriptive Chinese or English summaries are both accepted (seegit log). - One logical change per commit; squash feature branches before merging.
- PRs: reference the linked issue, describe the change and how it was verified, include screenshots for UI changes, and ensure
npm run lintanddotnet buildpass.