4789265ca8
fix: add synchronization for concurrent access in server/app/http3/stream
2026-06-05 12:31:41 +08:00
6f17bbad7e
chore: remove trailing blank lines and clean up whitespace
2026-06-03 18:08:34 +08:00
2734b04d8f
refactor: remove 16.8k lines of dead code across all internal packages
...
- Delete unused files: tempfile subsystem, matcher variants, server/internal
- Remove 200+ unused functions across proxy, ssl, lua, http2/3, stream, variable
- Fix proxy test type errors (backgroundRefresh ctx→Request)
- Move bench/tools mock backend into internal/testutil
- Remove corresponding test functions for all deleted code
2026-06-03 16:15:43 +08:00
9f7090df67
test(handler,middleware,server,ssl,proxy): 扩展测试覆盖率
...
- handler: 添加 sendfile 和 static 处理器测试
- middleware/security: 添加访问控制、认证、请求头、限流测试
- server: 添加池、pprof、清理、状态、升级、vhost 测试
- ssl: 添加客户端验证、OCSP、SSL 测试
- proxy: 添加代理覆盖率补充测试
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-22 10:42:05 +08:00
7a96db9f05
test(server): 重构并扩展服务器测试
...
- 拆分 server_extended_test.go 到独立测试文件
- 添加 pprof、purge、vhost、internal 测试
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-21 08:12:33 +08:00
c418baeb90
feat(vhost): 增强 server_name 匹配支持通配符和正则
...
按 nginx server_name 规则实现多类型匹配:
- 精确匹配:example.com
- 前缀通配:*.example.com(最长匹配优先)
- 后缀通配:example.*
- 正则匹配:~regex(按配置顺序)
- 匹配优先级:精确 → 前缀通配 → 后缀通配 → 正则 → 默认
更新 AddHost 返回 error 以支持正则编译错误反馈
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-17 09:26:47 +08:00
8b382606df
Merge branch 'lint-fix' - resolve sendfile.go conflict
...
Conflict: sendfile.go (!linux build tag) was incorrectly modified to
include linuxSendfile and getSocketFd functions which already exist
in sendfile_linux.go.
Resolution: Keep HEAD version (simple fallback returning ENOTSUP) as
Linux implementation is properly separated in sendfile_linux.go.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-13 09:26:48 +08:00
fc71cf4835
refactor(test): 统一测试文件错误处理风格
...
使用空白标识符忽略测试辅助函数中 Close、ReadFrom、Set 等返回值,
与主代码风格保持一致。
Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 17:37:05 +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
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
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