Commit Graph
146 Commits
Author SHA1 Message Date
tokenandCursor 2cc6644ccb fix: 修复 Program.cs 对象初始化器多余括号导致的编译失败
CreateSlimBuilder 的 WebApplicationOptions 被多写了一个 ),CI Native AOT 发布因此中断。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 20:39:12 +08:00
tokenandCursor 2c669b29d3 revert: 撤回对明文上游强制 HTTP/2 的转发配置
h2c VersionPolicy 会导致部分上游异常,先恢复由 YARP 默认协商协议。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 20:23:01 +08:00
tokenandCursor 2b8bfc1666 fix(stats): 暴露统计库失败原因并修复 Docker 目录权限
chiseled 镜像以 UID 1654 运行,chmod 给宿主机登录用户不够。仪表盘改为展示真实错误,权限恢复后自动重试,compose 启动时 chown 数据目录。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 20:22:59 +08:00
tokenandCursor f226606c41 feat: 支持明文上游 HTTP/2(h2c)
打开 Http2UnencryptedSupport,让 YARP 对 http:// 上游走 prior-knowledge HTTP/2,避免静默降到 HTTP/1.1 占满连接。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 10:55:25 +08:00
tokenandCursor de605253b2 docs: 补充集群说明与产品截图
README 增加主从集群、访问节点中继,并配上控制面与隧道截图。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 01:37:57 +08:00
tokenandCursor 67521ad227 fix(stats): Native AOT 下显式初始化 SQLite 并提示统计降级
裁剪会丢掉 SQLitePCLRaw 模块初始化器,导致 stats.db 打不开、仪表盘静默变成暂无数据。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 01:37:57 +08:00
tokenandCursor 095c2cb80f fix(ui): 访问节点下拉移到目标页,无集群时不显示
独立部署或尚未接入从节点时隐藏该选项,避免干扰原有路由表单。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-13 01:37:57 +08:00
tokenandCursor 59d2af3ba6 feat: 支持地区黑名单与集群访问节点中继
基于 ip2region 预编译地区 IP 区间实现零查询封禁,并支持域名指定集群节点回源时在节点间安全中继。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 15:03:27 +08:00
tokenandCursor 5179aed038 chore(release): v2.15.0 更新日志
Co-authored-by: Cursor <cursoragent@cursor.com>
v2.15.0
2026-08-12 13:38:06 +08:00
tokenandCursor 356558c765 feat: 集群管理与 MessagePack 节点同步协议,重写限流引擎并优化统计性能
- 集群:主/从角色、接入码一键加入、WebSocket 全量配置+证书同步、
  心跳与节点管理,前端新增集群管理页与 /api/v1/cluster 接口组
- 协议:节点间通信采用 MessagePack + LZ4 二进制编码,源生成 Resolver
  完全兼容 Native AOT,证书文件原生二进制传输
- 限流:移除 AspNetCoreRateLimit,改用内置 System.Threading.RateLimiting
  按 IP 分区固定窗口限流
- 性能:静态站点 ETag/304 协商缓存、统计链路内存封顶与两代缓存、
  配置服务并发安全加固
- 前端:证书/限流/安全/隧道/端口转发等页面动画补齐

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-12 13:37:56 +08:00
token f7ebf85f62 feat: 文件存储分片上传与前端动画/路由重构,补充架构文档
- FileStorageService 增加分片上传(暂存目录白名单校验、24h 过期清理、合并/放弃接口)
- 新增 MergeChunksRequest / AbortUploadRequest DTO 并注册到 AOT JsonContext
- 前端文件管理器:分片上传队列、复制/移动/压缩/解压/下载,剪贴板存节点快照
- 抽出 motion 动画组件与 routes/lazy-pages 路由懒加载单源,侧边栏 hover 预取
- 补全 README 架构、源码布局、运行数据流与隧道数据路径说明
2026-08-08 02:30:04 +08:00
token b7561cd08c feat: implement system settings for log retention configuration
- Added a new SystemSettingPage for managing log retention days.
- Introduced LogRetention service to handle log retention settings.
- Updated SettingService to include methods for getting and setting log retention.
- Enhanced AbnormalIpMonitor to manage IP entries more efficiently with eviction logic.
- Refactored ClusterRequestFailoverMiddleware to improve request handling and routing.
- Improved BlacklistAndWhitelistService to utilize IpPolicyMatcher for IP policies.
- Added a new FailoverRouteTable and FailoverEntry classes for better route management.
- Updated various services to support new configuration versioning.
- Enhanced error handling and logging throughout the middleware and services.
2026-07-24 23:56:23 +08:00
token 36b5dd192f feat: improve gateway service cards and client IP sources 2026-07-24 16:17:55 +08:00
token 4c96ca2ed1 Merge pull request #32 from 239573049/fix/acme-challenge-empty-payload-aot
fix(acme): 修复 internal 载荷属性在 AOT 下被丢弃导致 finalize CSR 为空
2026-07-22 18:50:26 +08:00
tokenandClaude Fable 5 2d61d02ed9 fix(acme): 修复 internal 载荷属性在 AOT 下被丢弃导致 finalize CSR 为空
Order.Payload.Csr 与 Account.Payload.OnlyReturnExisting 声明为 internal,
System.Text.Json 源生成器只序列化 public 成员,二者被静默丢弃:
- finalize 请求缺少 csr 字段,Let's Encrypt 报
  'asn1: syntax error: sequence truncated'
- onlyReturnExisting 丢失会破坏"仅返回已有账号"流程

改为 public 并加 [JsonInclude]。外层 Payload 类本身是 internal,
不会扩大公共 API 表面。

本地验证:真实 CSR 经签名后 csr 字段完整往返(DER 278B,tag 0x30),
onlyReturnExisting 正常序列化。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 18:46:40 +08:00
token b67c2d5498 Merge pull request #31 from 239573049/fix/acme-challenge-empty-payload-aot
fix(acme): 修复挑战验证阶段匿名 {} 载荷在 AOT 下无 JsonTypeInfo 崩溃
2026-07-22 18:11:38 +08:00
tokenandClaude Fable 5 01d17e92b4 fix(acme): 修复挑战验证阶段匿名 {} 载荷在 AOT 下无 JsonTypeInfo 崩溃
ChallengeContext.Validate 使用 new {} 作为空对象载荷,Native AOT 下
CertesJsonContext.GetTypeInfo(匿名类型) 返回 null,JwsSigner.Sign 调用
JsonSerializer.Serialize(payload, null) 抛出 ArgumentNullException,
导致证书申请在挑战验证阶段失败。

- 新增已注册的 EmptyObject 载荷类型,序列化为 {}(RFC 8555 §7.5.1)
- JwsSigner.Sign 对无法解析元数据的载荷抛出可诊断的 InvalidOperationException,
  而非深层 STJ 的裸 ArgumentNullException
- 保留 null 载荷 -> 空串(POST-as-GET)语义

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-22 18:05:50 +08:00
token 23e2a25516 fix: 更新 JwsHeader 中的 Jwk 和 OldKey 属性为 object 类型,以支持运行时类型序列化 v2.14.1 2026-07-22 17:26:48 +08:00
token e7963b5282 fix: 更新 Dockerfile,添加 Microsoft apt 源以安装 libmsquic 2026-07-22 16:15:52 +08:00
tokenandClaude Opus 4.8 6f96f0d880 fix(aot): 隔离 PerformanceCounter 以修复 Linux Native AOT 构建失败
System.Diagnostics.PerformanceCounter 依赖反射、不兼容 Native AOT,
导致 linux-x64/arm64 的 dotnet publish 在 AOT 链接阶段失败。

- csproj: 按 RID 定义 WINDOWS 常量,PerformanceCounter 包仅 Windows 目标引用
- QpsService/ISystemUsage: 用 #if WINDOWS 隔离所有 PerformanceCounter 引用,
  非 Windows 走已有的 /proc 与 P/Invoke 实现,CPU/磁盘统计降级为 0
- ConfigurationService: 顺带修复 AOT 迁移遗漏的 _jsonOptions,改用源生成上下文

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 15:20:27 +08:00
token 1e18177c88 Merge branch 'main' of https://github.com/239573049/FastGateway 2026-07-22 14:49:19 +08:00
token fdf52f5656 fix: 更新 Dockerfile,切换 Node.js 版本并优化构建阶段,增强 Native AOT 支持 2026-07-22 14:46:07 +08:00
token c8e9efb9f6 Merge pull request #30 from 239573049/vendor-certes-aot
Vendor certes aot
2026-07-22 14:45:53 +08:00
token 0ef26345d6 Merge branch 'main' into vendor-certes-aot 2026-07-22 14:45:42 +08:00
token 401f6b1ec2 Merge branch 'main' into vendor-certes-aot 2026-07-22 14:41:23 +08:00
token ace59e5b36 feat: Enhance JSON serialization and DTO usage across services
- Introduced AppJsonContext for optimized JSON serialization with source generation.
- Updated ResultFilter to handle EmptyHttpResult and EmptyResult correctly.
- Refactored ClusterRequestFailoverMiddleware and ProxyErrorResponseMiddleware to use DTOs for error responses.
- Modified ConfigurationService to utilize the new JSON context for configuration loading and saving.
- Enhanced FileStorageService to return structured DTOs instead of anonymous objects.
- Updated QpsService to return structured QPS data using DTOs.
- Refactored RateLimitService to return structured error responses using DTOs.
- Implemented SqlRunner for lightweight ADO.NET operations, replacing Dapper for compatibility with Native AOT.
- Refactored Statistics services to utilize SqlRunner for database operations, ensuring type safety and explicit parameter binding.
- Updated SystemService to return structured system information using DTOs.
- Enhanced StreamForwardService to return structured data for port forwarding lists.
2026-07-22 14:30:22 +08:00
token 224e109618 fix: 优化后台服务异常处理,避免影响网关主流程;改进配置文件写入逻辑,增强稳定性 2026-07-22 11:41:16 +08:00
token 5c7b9ccbd9 xg 2026-07-22 10:03:37 +08:00
tokenandClaude Haiku 4.5 927f83f1f8 fix: 优化请求超时和连接超时配置,支持流式响应
1. ConnectTimeout 从 1s 提升到 10s:避免跨域/高延迟场景握手失败
2. RequestTimeout 从默认 100s 改为 10 分钟:防止大文件/慢上游/AI 流式响应在传输中被截断
3. 增强超时豁免机制:
   - 请求阶段检测标准 SSE(Accept: text/event-stream)直接豁免
   - 响应阶段检测流式响应(Content-Type: text/event-stream)二次豁免
   - 支持 AI SDK 的 stream:true + Accept: application/json 场景

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-07-22 09:42:06 +08:00
tokenandClaude Opus 4.8 7f129e91b6 vendor Certes 源码并移除 Newtonsoft.Json/BouncyCastle 以支持 AOT
将 fszlin/certes 3.0.4 源码内置到 src/Certes 独立类库项目,
FastGateway 由 PackageReference 改为 ProjectReference。

- 无任何外部包依赖,开启 IsAotCompatible/IsTrimmable
- Newtonsoft.Json → System.Text.Json + 源生成 CertesJsonContext,
  消除全部匿名对象,保留 JWK RFC 7638 属性顺序
- Portable.BouncyCastle → System.Security.Cryptography
  (ECDsa/RSA/CertificateRequest/X509Certificate2),
  FromPem 兼容读取旧 SEC1/PKCS1 账户密钥
- 证书链直接使用 ACME 返回的 issuers,移除本地 PKIX 构建与内嵌根证书
- resx 资源类改为常量类,移除过时的异常序列化

Certes 单独构建 0 警告 0 错误;NativeAOT publish 通过;
CertService.cs 无需改动。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 09:24:28 +08:00
tokenandClaude Opus 4.8 169300d912 修正地理回填 UPDATE 参数名不匹配导致后台服务崩溃
Dapper 依匿名成员名生成 SQLite 命名参数,row.Id 推断为 @Id,
而 SQLite 参数区分大小写,SQL 中的 @id 无法绑定,后台服务启动即抛
InvalidOperationException 并停机。显式指定 id = row.Id 使成员名与占位符一致。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-22 03:03:54 +08:00
token 72ffa7aba9 统一地理统计中文化并回填国家维度数据
将 IP 地理解析扩展为国家、区域、省份字段,统一国家名为中文,并对最近保留周期内的请求日志及国家、省份聚合数据执行一次性回填。兼容历史英文国家名,合并重复维度并保留访问量与拦截量。

前端对世界地图和排行数据进行国家名称归一与同名聚合,避免历史英文数据导致国家重复显示;中国地图仍按省份维度展示。
2026-07-21 17:59:15 +08:00
token f9996ae3bc 修正 v4 地理库省份解析并回填历史省份统计
适配 ip2region_v4.xdb 的区域字段顺序,避免省份解析错位。统计服务启动时对最近保留周期内的中国请求日志回填省份,并在事务中重建省份维度聚合数据;通过元数据标记确保仅执行一次,地理库不可用时跳过回填。
2026-07-21 10:31:56 +08:00
token b232e8c29e feat(security): 添加拦截日志页面以支持安全审计 2026-07-21 01:09:15 +08:00
token 2b5ee9d64d Update package.json
修改
2026-07-21 00:50:11 +08:00
token 2bb4fc1252 feat(security): implement access control and threat detection features
- Refactor CreateBlacklistAndWhitelist component to enforce mandatory enabling of blacklist.
- Update RateLimitPage to improve UI and add warning for gateway rebuilds after changes.
- Remove redundant WhitelistPage and integrate its functionality into AccessControlPage.
- Create AccessControlPage for unified management of IP blacklists and whitelists.
- Add SecurityOverviewPage for a comprehensive security dashboard overview.
- Introduce SecurityFilterBar for consistent filtering across security-related pages.
- Develop ThreatDetectionPage to monitor and manage abnormal IPs with blacklist capabilities.
- Implement StatisticsService for fetching various statistical data related to security.
- Add TypeScript definitions for echarts-gl module.
2026-07-20 10:10:42 +08:00
token 90ee0fdc6b feat: 新增 TCP/UDP Stream 四层转发功能;HTTPS 重定向兼容 X-Forwarded-Proto
- 新增 StreamForward/StreamUpStream 实体、StreamProxyManager 代理管理、StreamForwardService 服务及前端管理页面
- 支持 TCP/UDP 协议、多种负载均衡策略
- HTTPS 重定向时检查 X-Forwarded-Proto 头,外网反向代理回源 HTTP 不再重复跳转
2026-07-17 18:35:12 +08:00
tokenandClaude Opus 4.8 d49dca2935 fix(docker): 构建前端并复制到 wwwroot,修复镜像缺少前端
此前 docker-image.yml 只把前端构建到 web/dist,Dockerfile 从未将其
复制到 wwwroot,导致发布镜像的 wwwroot 为空、无法提供前端页面。

- Dockerfile 新增 web 构建阶段(--platform=$BUILDPLATFORM,前端为架构无关
  静态文件,多架构构建时只构建一次,避免 QEMU 模拟),并在 publish 前将
  产物复制到 src/FastGateway/wwwroot
- docker-image.yml 移除冗余的前端构建步骤(改由 Dockerfile 内部完成,
  镜像构建自包含,本地 docker build 亦可用)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 14:27:07 +08:00
tokenandClaude Opus 4.8 0b84add399 fix(ci): release 工作流使用 Node 20 修复 web 构建失败
Tailwind CSS v4 使用原生 @tailwindcss/oxide 绑定并要求 Node 20+,
Node 18(npm 9)会触发 npm 可选依赖 bug(npm/cli#4828),导致
"Cannot find native binding"。与 docker-image.yml 保持一致改用 Node 20。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
v2.14.0
2026-07-03 12:41:01 +08:00
tokenandClaude Opus 4.8 4b54993c12 chore(release): 发布 2.14.0,新增更新日志
- 版本号 2.13.0 -> 2.14.0(小版本)
- 新增 CHANGELOG.md,整理 v2.13.0 之后的变更(证书上传/泛域名 DNS-01、
  HTTPS 重定向修复、健康检查、请求超时/故障转移、多平台构建等)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 11:57:14 +08:00
token 5c571d79a2 Merge pull request #27 from 239573049/feature/cert-upload-wildcard-https-redirect
feat(cert): 支持上传自定义证书、泛域名 DNS-01 及修复 HTTPS 重定向
2026-07-03 11:52:59 +08:00
tokenandClaude Opus 4.8 65ddd31cc1 feat(cert): 支持上传自定义证书、泛域名 DNS-01 及修复 HTTPS 重定向
证书管理:
- 新增上传自定义证书接口 (POST /api/v1/cert/upload),支持 PFX/P12 与 PEM 格式,
  统一转换为固定密码 pfx 落盘,校验私钥并读取有效期/颁发机构
- 新增 CertType 区分 Let's Encrypt 与用户上传证书,上传证书不参与自动续期
- 泛域名支持: SNI 按 *.example.com 匹配一级子域名,泛域名安全文件名处理,
  网关缓存按泛域名失效
- 泛域名申请: 新增 DNS-01 两步验证接口 (dns/prepare、dns/validate),
  生成 _acme-challenge TXT 记录供手动添加后签发;泛域名排除出 HTTP-01 自动续期
- 前端: 新增上传证书 / 重新上传 / DNS 验证对话框及入口

修复:
- HTTPS 重定向未生效: Server.RedirectHttps 此前从未被消费,现在网关在 ACME
  校验之后加入重定向中间件,将 80 端口明文请求 307 跳转到 HTTPS

文档与 CI:
- README(中/英) 补充证书管理说明与多平台下载
- release 工作流新增 linux/win/osx 的 x64 与 arm64 构建
- docker 镜像改为 linux/amd64,linux/arm64 多架构并修正触发分支

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-03 11:52:02 +08:00
token 823e70710f 性能点优化 2026-05-12 10:06:40 +08:00
token cd1415206e Merge pull request #26 from 239573049/feature/connection
Feature/connection
2026-03-28 03:59:31 +08:00
token 0b3874876c chore(docker): update gateway image registry 2026-03-22 16:02:11 +08:00
token bca6bf269c fix(tunnel): recover gateway reconnection after disconnect
- exit the gateway agent loop immediately when the control stream reaches EOF
2026-03-22 16:01:51 +08:00
token 0dbc89d543 feat(gateway): add request failover controls
- add request-level failover settings to server models and management UI
2026-03-22 16:01:31 +08:00
token 5c3ec47fa9 Merge pull request #25 from 239573049/feat/ui
增加健康检查状态
2026-01-04 20:21:35 +08:00
token 262cc80851 增加健康检查状态 2026-01-04 20:12:05 +08:00
tokenandClaude f1e520996c feat: 支持配置健康检查 Interval/Timeout
允许为路由配置健康检查的探测间隔与超时,减少误判并适配不同上游响应特性。

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-04 20:08:50 +08:00