|
|
3cc2dc7625
|
style(netutil,server,test): 修复代码格式问题,更新文档
- 修复 server.go 缩进问题
- 添加文件末尾换行符
- 格式化测试文件表格对齐
- 更新 update-prompts.md 添加新任务
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-07 11:38:54 +08:00 |
|
|
|
77fdb11b06
|
test(server): 完善 server 模块测试覆盖率
覆盖率从 44.2% 提升至 45.8%,新增测试:
- TestPoolWrapHandler: 协程池处理器包装测试
- TestPoolWrapHandler_WhenStopped: 池停止时包装测试
- TestServer_Proxies: 代理管理测试
- TestServer_Running: 运行状态测试
- TestServer_StopWithNilFastServer: 无服务器停止测试
- TestServer_GracefulStopWithNilFastServer: 无服务器优雅停止测试
- TestServer_GetProxyCacheStats: 代理缓存统计测试
- TestServer_BuildMiddlewareChain_EmptyConfig: 空配置中间件链测试
- TestServer_TrackStats_EmptyBody: 空响应体统计测试
注:Start/startSingleMode 等启动函数适合集成测试
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-03 18:33:10 +08:00 |
|
|
|
7a98a0b044
|
refactor: 抽取网络工具函数到 netutil 包,移除冗余代码
- 新增 internal/netutil 包,统一 IP 提取和 URL 解析函数
- proxy/websocket/middleware 使用 netutil 替代重复实现
- 移除 handler/sendfile 中未使用的 BufferPool 相关代码
- 移除 http3/adapter 中未使用的反向转换函数
- 提取 server.registerStaticHandler 函数改进代码结构
- 优化 access.go 锁范围,减少持锁时间
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-03 18:24:21 +08:00 |
|
|
|
cd2d1a8194
|
refactor: 优化字符串构建方式,统一测试错误处理风格
- 使用 fmt.Fprintf 替代冗余的 WriteString(fmt.Sprintf) 组合
- 测试中 nil 检查使用 t.Fatal 替代 t.Error 立即终止
- .gitignore 添加 html/ 目录忽略
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-03 17:49:11 +08:00 |
|
|
|
fc71cf4835
|
refactor(test): 统一测试文件错误处理风格
使用空白标识符忽略测试辅助函数中 Close、ReadFrom、Set 等返回值,
与主代码风格保持一致。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-03 17:37:05 +08:00 |
|
|
|
96ed39e162
|
refactor(http3,handler,server,middleware): 改进错误处理与代码优化
- 使用 _ 忽略 Close、Write、Shutdown 等返回值
- compression 使用 switch-case 替代 if-else 链
- http3/adapter 使用 for-range 替代 VisitAll 遍历头部
- sendfile 添加 nolint 注释说明 buffer pool 设计决策
- defer 关闭文件使用 func() { _ = file.Close() } 确保执行
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-03 17:36:58 +08:00 |
|
|
|
92cd93d4c0
|
refactor: 代码改进与注释补充
- logging: 补充包文档说明
- pool: 修复 workers 计数器并发安全 (atomic 操作)
- stream: 完善注释与错误处理
- handler/static: 添加预压缩文件支持接口
- loadbalance: 补充算法注释
- vhost: 改进虚拟主机路由逻辑
- ssl: 优化证书加载注释
- main: 补充启动流程注释
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-03 16:57:59 +08:00 |
|
|
|
03b0df2c69
|
feat(proxy): 实现代理缓存功能与一致性哈希支持
- 新增缓存命中/过期/刷新逻辑
- 实现缓存锁防止缓存击穿 (stale-while-revalidate)
- 支持一致性哈希按 uri/ip/header 选择目标
- 新增 getProxyCacheStats 收集缓存统计
- 集成连接数限制中间件 (ConnLimiter)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-03 16:57:48 +08:00 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
a627d58832
|
test(server): 补充 buildMiddlewareChain 单元测试
- 新增访问日志、访问控制、限流中间件测试
- 新增重写、压缩、安全头中间件测试
- 新增全中间件组合测试
- 重命名 TestSetListeners 为 TestUpgradeSetListeners 避免命名冲突
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-03 15:15:37 +08:00 |
|
|
|
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 |
|
|
|
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 |
|
|
|
95030cd68a
|
docs: 更新 AGENTS.md 文档
添加各模块的 AGENTS.md 文档文件,记录模块职责和代码结构
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-03 14:07:42 +08:00 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|
|
|
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 |
|