|
|
612208616c
|
feat(status): 支持 Prometheus 格式输出
新增 Prometheus 格式的状态指标输出,用于监控系统集成。
包含连接数、请求数、缓存、Pool、Upstream、SSL、限流等指标。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-09 17:51:28 +08:00 |
|
|
|
83b2a35715
|
feat(config): 完善 Resolver/SSL 默认值及 YAML 输出
- 添加 Resolver/SessionTickets/ClientVerify 默认配置
- GenerateConfigYAML 输出改为非注释格式
- 新增 Resolver、SSL 默认值、YAML 可加载性测试
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-09 14:44:01 +08:00 |
|
|
|
909bccc1eb
|
refactor(http2): 使用 textproto.CanonicalMIMEHeaderKey 替代手动实现
使用标准库 net/textproto 提供的规范化函数,确保 HTTP 头键
按照 RFC 7230 规范正确处理,包括 MIME 头的特殊大小写规则。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-09 13:35:29 +08:00 |
|
|
|
392d0b3449
|
docs: 新增模块 AGENTS.md 文档,更新目录索引
- 新增 http2、integration、resolver、variable 模块 AGENTS.md
- 更新 internal/AGENTS.md 目录表,补充新模块条目
- 更新 docs/prompts.md 添加 generate-config 缺失项分析提示
- 同步更新日期戳至 2026-04-09
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-09 13:35:29 +08:00 |
|
|
|
a298ca7254
|
feat(config): 完善 GenerateConfigYAML HTTP/2 和认证配置示例输出
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-09 13:25:47 +08:00 |
|
|
|
e03546a580
|
feat(config): 完善 GenerateConfigYAML 配置示例输出
新增 Session Tickets、mTLS 客户端验证、auth_request 外部认证、
TCP SSL、DNS resolver 及全局变量配置的 YAML 示例生成
|
2026-04-09 13:10:15 +08:00 |
|
|
|
4d5dda5b69
|
style(variable): 添加文件末尾换行符
|
2026-04-09 12:19:22 +08:00 |
|
|
|
84c26c61ca
|
style(benchmark): 修复代码格式和忽略无用错误返回值
|
2026-04-09 12:19:08 +08:00 |
|
|
|
668ecde6db
|
feat(variable): 新增全局变量支持,自动注入请求上下文
|
2026-04-09 12:18:56 +08:00 |
|
|
|
412bfebdd8
|
feat(http2): 新增 HTTP/2 支持,集成到服务器和应用
|
2026-04-09 12:18:52 +08:00 |
|
|
|
25bdba4e01
|
test(benchmark): 新增组件级基准测试套件
- 新增 benchmark_context.go 标准化测试上下文构造器
- 新增静态文件处理器基准测试(缓存命中/未命中、try_files)
- 新增访问日志中间件基准测试
- 新增压缩中间件基准测试(gzip/brotli、Pool 复用)
- 新增限流器基准测试(令牌桶、滑动窗口、多客户端并发)
- 新增变量展开基准测试(模板展开、Pool 操作)
|
2026-04-08 18:25:38 +08:00 |
|
|
|
0602796ee1
|
feat(ratelimit): 新增后台自动清理和优雅关闭
- RateLimiter 启动时自动开启后台清理 goroutine
- 新增 StopCleanup 方法优雅关闭清理 goroutine
- 新增 AutoCleanup 和 StopCleanup 测试
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-08 15:03:10 +08:00 |
|
|
|
4de32812f2
|
perf(loadbalance): 预计算一致性哈希虚拟节点哈希值
- Target 结构新增 VirtualHashes 字段存储预计算哈希
- 新增 PrecomputeHashes 方法在初始化时计算虚拟节点哈希
- SelectExcludingByKey 使用预计算哈希避免运行时重复计算
- 新增 SelectExcludingByKey 测试和基准测试
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-08 15:03:10 +08:00 |
|
|
|
214ea4e9a6
|
perf(cache,proxy): 使用 uint64 哈希键优化代理缓存性能
- ProxyCache 的 entries 和 pending map 从 string 改为 uint64 键
- 新增 buildCacheKeyHash 使用 FNV-64a 计算哈希(零分配)
- 增加原始键碰撞验证,防止哈希冲突误匹配
- 更新相关测试和基准测试
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-08 15:03:10 +08:00 |
|
|
|
49d33f8b0c
|
feat(middleware/security): 新增 auth_request 外部认证中间件
- 支持将认证委托给外部服务,根据响应状态码决定请求是否继续
- 配置 URI、Method、Timeout 和自定义 Headers
- 支持 $request_uri 等变量在 Headers 中使用
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 14:37:29 +08:00 |
|
|
|
84d67c8570
|
feat(handler/static): 新增 alias 指令支持路径别名
- NewStaticHandlerWithAlias 创建带 alias 的静态文件处理器
- alias 与 root 互斥,支持路径替换而非附加
- 新增测试覆盖 alias 路径映射逻辑
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 14:37:20 +08:00 |
|
|
|
d48caf5183
|
feat(proxy): 新增代理响应临时文件处理,保护内存
- TempFileHandler 检测响应大小,超过阈值写入临时文件
- TempFileCleaner 定期清理过期临时文件
- 避免 SSR 攻击和内存溢出风险
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 14:37:13 +08:00 |
|
|
|
1a9059b1ff
|
feat(stream): 新增 TCP/UDP Stream SSL/TLS 支持
- StreamSSLManager 管理服务端 TLS 终端和客户端 TLS 连接
- 支持证书加载、mTLS 客户端验证
- 并发安全的证书配置管理
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 14:37:02 +08:00 |
|
|
|
b7de258f4e
|
feat(variable): 新增 SSL 客户端证书变量支持
- 新增 ssl_client_verify、ssl_client_serial、ssl_client_subject 等变量
- 支持从 TLS 连接状态提取客户端证书信息
- 用于日志记录和访问控制决策
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 14:36:53 +08:00 |
|
|
|
9d49349ee1
|
feat(ssl,config): 新增 Session Tickets 和 mTLS 客户端证书验证
- SessionTicketsConfig 支持 TLS 1.3 会话恢复,密钥轮换和持久化
- ClientVerifyConfig 支持双向 TLS 认证,CA 证书池和 CRL
- TLSManager 集成 SessionTicketManager 和 ClientVerifier
- 新增完整测试覆盖密钥轮换和客户端验证逻辑
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 14:36:47 +08:00 |
|
|
|
61455412eb
|
feat(variable,proxy): 新增上游变量支持,集成到代理请求处理
- 新增 upstream_addr、upstream_status、upstream_response_time 等变量
- 新增 UpstreamTiming 结构体捕获连接、首字节、响应时间
- Proxy.ServeHTTP 集成变量上下文,记录上游时间
- 新增测试覆盖上游变量和计时功能
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 14:36:37 +08:00 |
|
|
|
b72394eb3b
|
style(handler,server): 格式化测试代码结构体字段对齐
- 对齐 errorpage_test.go、static_test.go、pprof_test.go 中的结构体字段
- 纯代码格式化,无逻辑变更
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 13:30:00 +08:00 |
|
|
|
3711b12fad
|
docs(server/pprof): 添加详细函数文档注释,修复注释错字
- 为 pprof.go 和 pprof_impl.go 的所有公开函数添加文档注释
- 包含参数说明、返回值描述、使用示例和注意事项
- 修复注释错字"厉止"→"停止"
- 补充包级文档说明核心功能和用途
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 13:30:00 +08:00 |
|
|
|
9495a548e6
|
feat(proxy,server,logging): 集成变量系统和 DNS 解析器
变量系统集成:
- logging: 访问日志使用 variable 包展开模板
- rewrite: 重写规则支持变量展开
- proxy: 请求/响应头设置支持变量展开
DNS 解析器集成:
- app: 创建并启用 Resolver
- server: SetResolver/GetResolver 方法传递给 proxy
- proxy: SetResolver/Start 方法,后台 DNS 刷新协程
- proxy_dns.go: DNS 刷新逻辑和 IP 直连支持
新增集成测试:
- internal/integration/variable_test.go
- internal/integration/resolver_test.go
文档更新:
- docs/config-reference.md 配置参考文档
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-08 11:36:49 +08:00 |
|
|
|
5a6f4d351f
|
feat(resolver): 新增 DNS 解析器支持
新增 internal/resolver 包,提供动态 DNS 解析功能:
- Resolver 类型支持配置多个 DNS 服务器
- 内置缓存支持 TTL 和最大条目数限制
- 统计信息追踪查询次数和缓存命中率
配置层面:
- ResolverConfig 支持 addresses/valid/timeout/ipv4/ipv6/cache_size
- 添加配置验证逻辑
Target 增强:
- 新增 hostname/resolvedIPs 字段支持 IP 缓存
- NeedsResolve 方法判断是否需要重新解析
- NewTargetFromConfig 工厂函数
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-08 11:36:49 +08:00 |
|
|
|
c95f474539
|
feat(variable): 新增变量系统支持
新增 internal/variable 包,提供 Nginx 风格的变量展开功能:
- 支持 $remote_addr、$host、$uri、$args 等 30+ 内置变量
- 使用 sync.Pool 优化 VariableContext 分配
- 支持 set_response_info 存储响应状态信息
添加 github.com/google/uuid 依赖用于请求 ID 生成。
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-08 11:36:49 +08:00 |
|
|
|
b6f8894d78
|
test(handler,middleware,server): 新增 try_files、错误页面、pprof 单元测试
- static_test.go: 新增 try_files 配置解析、占位符解析、SPA 场景测试
- errorpage_test.go: 新增错误页面管理器完整测试覆盖
- errorintercept_test.go: 新增错误拦截中间件功能测试
- pprof_test.go: 新增 pprof 性能分析端点测试
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 11:15:39 +08:00 |
|
|
|
238fa20e41
|
docs(config): 在默认配置生成中添加已实现功能的注释示例
新增 client_max_body_size、try_files、next_upstream、error_page 等功能的配置注释
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 10:35:45 +08:00 |
|
|
|
d482e44bec
|
refactor(server/pprof): 简化 switch 语句并移除未使用变量
- 将 switch 语句改为更简洁的 case 匹配形式
- 移除未使用的 cpuProfileWriter 变量
- 忽略 Flush/WriteTo 等无关的错误返回值
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 09:58:11 +08:00 |
|
|
|
3758f410ff
|
style(benchmark): 修复文件末尾换行符
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 09:58:11 +08:00 |
|
|
|
ee4f7a5ca9
|
refactor(config): 移除已废弃的配置字段
移除以下已标记废弃的字段:
- AuthConfig.MinPasswordLength (auth)
- FileCacheConfig.LRUEviction (file_cache)
- TransportConfig.MaxIdleConns (transport)
同时清理相关的验证逻辑、默认值设置、测试代码和文档。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-08 09:50:32 +08:00 |
|
|
|
b30c84a38b
|
feat(config): 标记废弃字段,新增负载均衡算法验证
- MinPasswordLength 和 MaxIdleConns 添加 Deprecated 注释
- 验证时对废弃字段输出警告提示
- 新增 stream 负载均衡算法有效性验证
- 添加负载均衡算法验证测试用例
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-08 09:33:55 +08:00 |
|
|
|
58e420b3ab
|
docs(config): 新增完整配置字段参考文档
- 添加 docs/config-reference.md,列出所有配置字段及枚举值
- 更新 defaults.go 注释,补充 client_max_body_size、try_files、error_page 字段说明
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-07 22:22:21 +08:00 |
|
|
|
766e9255fa
|
feat(config,server,makefile): 新增 pprof 性能分析端点支持
- 新增 PprofConfig 配置结构,支持路径和 IP 访问控制
- 实现 PprofHandler 处理器,提供 CPU/heap/goroutine/block/mutex profile
- Makefile 新增 build-perf、build-pgo、pgo-collect 目标
- 支持 PGO (Profile-Guided Optimization) 构建
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-07 18:21:03 +08:00 |
|
|
|
2688ed6a9c
|
docs: 更新 AGENTS.md 文档,新增 benchmark/netutil/scripts 目录
- 根目录新增 scripts/ 和 .github/ 目录说明
- internal 新增 benchmark/ 和 netutil/ 目录说明
- middleware 新增 bodylimit/ 和 errorintercept/ 目录说明
- 更新日期为 2026-04-07
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-07 17:51:31 +08:00 |
|
|
|
0c2ac445c2
|
refactor(benchmark,proxy): 改进错误处理,忽略未使用返回值
- benchmark tools 使用空白标识符忽略明确不关心的返回值
- proxy bench 测试统一错误处理风格
- 符合 Go 最佳实践,避免编译器警告
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-07 17:51:09 +08:00 |
|
|
|
cb45e824d4
|
feat(middleware,rewrite): 增强 FlagLast 语义与循环检测
- FlagLast 重新从第一条规则开始匹配(nginx 兼容行为)
- 新增全局迭代计数器检测循环,限制最多 10 次迭代
- FlagBreak 不触发循环检测,直接停止
- 新增测试覆盖跨规则循环、迭代限制、nginx 兼容语义
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-07 17:50:50 +08:00 |
|
|
|
23f5c08614
|
feat(handler,server): 静态文件新增 try_files 配置,集成新增中间件
- StaticHandler 支持 try_files 配置,用于 SPA 部署回退
- 支持 $uri 和 $uri/ 占位符解析
- Server 集成 bodylimit 中间件(全局和路径级别配置)
- Server 集成 errorintercept 中间件(错误页面拦截)
- Server 预加载错误页面到内存
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-07 17:50:38 +08:00 |
|
|
|
827d26c2b5
|
feat(handler,middleware,errorintercept): 新增自定义错误页面支持
- ErrorPageManager 预加载错误页面到内存,运行时无文件 I/O
- ErrorIntercept 中间件拦截 4xx/5xx 响应并应用自定义页面
- 支持特定状态码页面和默认页面配置
- 支持可选的响应状态码覆盖(如返回 200 OK)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-07 17:49:59 +08:00 |
|
|
|
deb9b3139a
|
feat(middleware,bodylimit): 新增请求体大小限制中间件
- 支持 client_max_body_size 配置,单位支持 b/kb/mb/gb
- 支持全局配置和路径级别覆盖
- 超限返回 413 Request Entity Too Large
- 使用 io.LimitReader 强制限制实际读取字节数
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-07 17:49:47 +08:00 |
|
|
|
f6245c19e0
|
feat(proxy,loadbalance,config): 新增故障转移 (next_upstream) 支持
- 配置新增 NextUpstreamConfig 支持 tries 和 http_codes 参数
- 负载均衡器新增 SelectExcluding 方法用于故障转移排除选择
- 代理请求失败时自动尝试下一个健康后端
- 健康检查新增 MarkHealthy 方法用于故障转移成功后恢复状态
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-07 17:49:10 +08:00 |
|
|
|
0979b60ff2
|
test(cache,loadbalance,proxy,benchmark): 新增核心模块基准测试
- cache: LRU Get/Set 性能测试
- loadbalance: 负载均衡算法性能测试
- proxy: 代理处理性能测试
- benchmark/tools: 负载生成器和模拟后端工具
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-07 17:06:08 +08:00 |
|
|
|
83e1fe38ba
|
feat(config,handler,server): 支持多静态目录配置,新增路径前缀匹配
- Static 配置从单对象改为数组,支持多个静态目录
- StaticConfig 新增 Path 字段用于路径前缀匹配
- 添加 validateStatics 和 validatePathConflicts 验证函数
- 删除 config.example.yaml 示例文件(配置可通过 --generate 生成)
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-07 16:26:55 +08:00 |
|
|
|
f2352ab9cc
|
docs(config,stream,logging,handler,proxy,cache,server,ssl,middleware): 为核心模块添加详细 GoDoc 文档注释
- config: 为 Config 和所有子配置结构添加完整文档,包含使用示例和注意事项
- stream: 为负载均衡器和服务器添加详细的参数、返回值和功能说明
- logging: 为日志格式化和输出函数添加文档,说明支持的变量替换
- handler: 为路由器、静态文件和 sendfile 处理器添加文档
- proxy: 为健康检查器和代理功能添加完整文档
- cache/server/ssl/middleware: 补充相关模块的文档注释
- config.example.yaml: 添加可信代理配置、加密套件示例,更新压缩级别说明
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-07 15:36:09 +08:00 |
|
|
|
038c0639fd
|
feat(middleware,http3,config): 增强 gzip_static 支持 Brotli,新增 HTTP/3 0-RTT 与性能配置验证
- gzip_static: 支持 .br 和 .gz 预压缩文件,按 br > gzip 优先级选择
- http3/server: 新增 Enable0RTT 配置,启用时输出安全警告
- config: 废弃 FileCache.LRUEviction 字段,新增 validatePerformance 验证
- 新增 gzip_static 完整测试套件覆盖编码优先级、路径遍历防护等场景
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-07 14:25:28 +08:00 |
|
|
|
20016ebb59
|
feat(config): 增强配置验证功能,添加多项验证函数
新增 validateLogging、validateRewrite、validateSecurityHeaders 验证函数,
完善限流算法、滑动窗口模式、一致性哈希键格式验证,
在 YAML 默认配置中添加 trusted_proxies 字段说明。
Co-Authored-By: Claude <noreply@anthropic.com>
|
2026-04-07 13:15:27 +08:00 |
|
|
|
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 |
|
|
|
ff260def3b
|
test(loadbalance,security): 完善模块测试覆盖率
loadbalance 模块覆盖率从 52.4% 提升至 96.1%:
- TestConsistentHash: 一致性哈希算法测试
- TestIsValidAlgorithm: 算法验证函数测试
security 模块覆盖率从 50.2% 提升至 63.7%:
- TestNewSlidingWindowLimiter: 滑动窗口限流器创建测试
- TestSlidingWindowLimiter_Allow: 请求允许/拒绝测试
- TestSlidingWindowLimiter_Reset/ResetAll: 重置测试
- TestSlidingWindowLimiter_Cleanup: 清理测试
- TestSlidingWindowLimiter_GetStats/GetCount: 统计测试
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-03 18:38:35 +08:00 |
|
|
|
0a50678b55
|
test(handler): 完善 handler 模块测试覆盖率
覆盖率从 45.3% 提升至 58.5%,新增测试:
- TestStaticHandler_SetFileCache: 文件缓存设置测试
- TestStaticHandler_SetGzipStatic: Gzip 静态文件设置测试
- TestStaticHandler_Handle_HeadRequest: HEAD 请求测试
- TestStaticHandler_Handle_WithCache: 带缓存处理测试
- TestStaticHandler_Handle_Precompressed: 预压缩文件测试
- TestStaticHandler_Handle_LargeFile: 大文件处理测试
- TestStaticHandler_Handle_Symlink: 符号链接测试
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
2026-04-03 18:35:39 +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 |
|