15 Commits

Author SHA1 Message Date
xfy
d42844b2fa test(app,handler,server,http3): 补充单元测试覆盖率
- app: 添加信号处理、配置重载、日志重开测试
- handler/sendfile: 添加小文件、偏移量、错误情况测试
- server: 添加统计追踪、监听器、TLS配置测试
- http3: 新增 adapter 和 server 单元测试
- 格式修复: 末尾换行符、注释对齐
- 文档: AGENTS.md 添加 http3 模块说明

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 16:25:21 +08:00
xfy
ec916d882d feat(proxy,middleware,config): 集成配置与代码差异修复
- 集成一致性哈希负载均衡到 proxy.go,支持 hash_key 和 virtual_nodes 配置
- 集成滑动窗口限流算法到 ratelimit.go,支持 algorithm 选择
- 应用 Transport 连接池配置到 createHostClient
- 集成 HSTS 配置到安全头部中间件
- 补充 config.example.yaml 缺失配置(http3、gzip_static、sliding_window)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 16:08:45 +08:00
xfy
d6367a1c38 feat(http3,docs,middleware): 实现 Phase 9 HTTP/3 与性能优化扩展
- 新增 HTTP/3 (QUIC) 服务器支持,集成到 App 生命周期管理
- 新增 nginx 内置变量速查表文档
- 完善多篇 nginx 文档(代理、安全、流、限流、HTTP/2/3、核心事件)
- 新增一致性哈希负载均衡、gzip_static、滑动窗口限流中间件
- 扩展配置支持 HTTP/3 和日志格式选项

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 15:39:06 +08:00
xfy
a627d58832 test(server): 补充 buildMiddlewareChain 单元测试
- 新增访问日志、访问控制、限流中间件测试
- 新增重写、压缩、安全头中间件测试
- 新增全中间件组合测试
- 重命名 TestSetListeners 为 TestUpgradeSetListeners 避免命名冲突

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 15:15:37 +08:00
xfy
f894787a2b test(handler,server,proxy): 补充单元测试覆盖率
- sendfile_test.go: 新增 copyFile、platformSendfile、getSocketFd 测试
- upgrade_test.go: 新增监听器设置、PID文件处理、继承监听器测试
- websocket_test.go: 新增 WebSocket 桥接器、数据转发、连接关闭测试
- status_test.go: 新增 StatusHandler CIDR/IP访问控制、状态收集测试

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 15:02:51 +08:00
xfy
ac9153f09d fix(proxy,stream,server): Phase 8 问题修复与功能完善
- WebSocket 代理集成:handleWebSocket 现调用 ProxyWebSocket 实现
- 删除 UDP Stream 冗余代码:移除 udpListener 类型及相关测试
- 热升级监听器继承:改用 net.Listen + Serve 模式支持监听器传递
- 代码格式修复:注释格式调整、字段对齐、文件末尾换行符

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 14:28:00 +08:00
xfy
95030cd68a docs: 更新 AGENTS.md 文档
添加各模块的 AGENTS.md 文档文件,记录模块职责和代码结构

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 14:07:42 +08:00
xfy
80936ae66b feat(server,proxy,ssl,docs): 完成 Phase 7 功能完善
主要变更:
- WebSocket 代理支持 (internal/proxy/websocket.go)
- OCSP stapling 实现 (internal/ssl/ocsp.go)
- 监控状态端点 (internal/server/status.go)
- 新增 nginx 模块文档 (19-24)
- UDP 代理超时配置支持
- 多模块代码注释完善和功能增强

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 13:13:12 +08:00
xfy
aa64329ba2 feat(server,handler,proxy,app): 集成未使用的中间件和模块
- 集成 6 个安全/功能中间件到 server.go
- 集成 GoroutinePool 和 SendFile 零拷贝
- 集成 FileCache 和 ProxyCache 缓存模块
- 集成 Stream TCP/UDP 代理模块
- 添加 Stream 配置结构到 config.go

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-03 11:27:53 +08:00
xfy
6f3ecb0a9f feat(middleware,server): 实现访问日志中间件
- 新增 accesslog 中间件,记录请求方法、路径、状态码、响应大小和处理时间
- 集成到 Server 的 single 和 vhost 模式
- 支持 graceful shutdown 时关闭日志文件

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 10:54:53 +08:00
xfy
9d24263918 feat(stream,server,handler): 实现 Phase 6 性能优化和热升级
新增功能:
- stream 模块: 流式传输支持,优化大文件和实时数据传输
- Goroutine 池: 限制并发数量,减少调度开销
- 优雅升级: 零停机热升级,继承父进程监听器
- sendfile: 零拷贝文件传输,大文件直接从内核传输

重构改进:
- App 结构体封装,支持热升级和信号处理
- 配置结构字段对齐和代码清理
- 完善错误处理和日志记录

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 10:39:22 +08:00
xfy
e2c37e2bf8 feat(server,proxy,loadbalance): 集成反向代理和虚拟主机模式
- server: 集成反向代理路由,支持单服务器和虚拟主机两种模式
- loadbalance: 使用 atomic.Bool 替代 bool 实现并发安全的健康状态
- proxy: 适配 atomic.Bool,移除 HealthChecker 不必要的互斥锁
- config: 添加服务器超时配置字段,验证负载均衡算法
- 新增 algorithms.go 提供算法验证函数
- 新增 config.example.yaml 配置示例文件

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 09:26:20 +08:00
xfy
179aacac04 docs: 添加模块上下文文档 (AGENTS.md)
为各模块添加上下文文档,帮助 AI 助手理解代码结构:
- AGENTS.md: 项目根目录上下文
- docs/AGENTS.md: 文档目录说明
- internal/AGENTS.md: 内部包结构概览
- 各子模块 AGENTS.md: 模块特定上下文和约定

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 16:25:51 +08:00
xfy
413e418b37 test: 添加 handler/logging/middleware/server 模块单元测试
- internal/handler/static_test.go: 21 个测试用例覆盖静态文件服务和路径遍历安全
- internal/handler/router_test.go: 9 个测试用例覆盖路由注册和方法区分
- internal/logging/logging_test.go: 7 个测试用例覆盖日志级别解析
- internal/middleware/middleware_test.go: 4 个测试用例覆盖中间件链逆序包装
- internal/server/server_test.go: 5 个测试用例覆盖服务器创建和停止
- internal/server/vhost_test.go: 18 个测试用例覆盖虚拟主机路由

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 16:21:49 +08:00
xfy
b445bca96a feat(server): 实现基础 HTTP 服务器核心功能
使用 fasthttp 替代 net/http,实现 Phase 2 核心模块:
- HTTP 服务器:fasthttp.Server 配置超时和连接限制
- 路由系统:fasthttp/router 基于 radix tree 匹配
- 静态文件服务:安全检查、索引文件支持
- 日志系统:zerolog 结构化日志
- 中间件框架:链式组合接口
- 虚拟主机管理:按 Host 头选择处理器

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-02 15:23:54 +08:00