- app: 添加信号处理、配置重载、日志重开测试 - handler/sendfile: 添加小文件、偏移量、错误情况测试 - server: 添加统计追踪、监听器、TLS配置测试 - http3: 新增 adapter 和 server 单元测试 - 格式修复: 末尾换行符、注释对齐 - 文档: AGENTS.md 添加 http3 模块说明 Co-Authored-By: Claude <noreply@anthropic.com>
1.3 KiB
1.3 KiB
http3
Purpose
HTTP/3 (QUIC) 协议支持模块,提供基于 quic-go 的 HTTP/3 服务器实现,与现有 fasthttp handler 集成。
Key Files
| File | Description |
|---|---|
server.go |
HTTP/3 服务器核心实现(启动、停止、优雅关闭、统计) |
adapter.go |
fasthttp.RequestHandler 与 http.Handler 适配层 |
For AI Agents
Working In This Directory
- HTTP/3 需要 TLS 配置,必须与
internal/ssl/模块配合使用 - 使用 quic-go 库实现 QUIC 协议
- 通过 Adapter 将 fasthttp handler 转换为标准库 http.Handler
- 配置结构体定义在
internal/config/config.go的HTTP3Config
Testing Requirements
- 测试需要模拟 QUIC 连接
- 运行测试:
go test ./internal/http3/...
Common Patterns
- 使用
sync.Pool复用 RequestCtx 对象 - 使用
quic.ListenEarly创建 0-RTT 支持的监听器 - Alt-Svc 头用于告知客户端可使用 HTTP/3
Dependencies
Internal
rua.plus/lolly/internal/config- HTTP3Config 配置结构rua.plus/lolly/internal/logging- 日志输出
External
github.com/quic-go/quic-go- QUIC 协议实现github.com/quic-go/quic-go/http3- HTTP/3 服务器github.com/valyala/fasthttp- HTTP 处理器接口