lolly/AGENTS.md
xfy 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

2.1 KiB
Raw Blame History

lolly

Purpose

高性能 HTTP 服务器,类似 nginx 的纯 Go 实现。使用 YAML 配置单二进制运行支持静态文件服务、反向代理、负载均衡、SSL/TLS、安全控制等功能。

Key Files

File Description
main.go 程序入口CLI 参数解析和启动逻辑
go.mod Go 模块定义,依赖 fasthttp、zerolog、yaml.v3
go.sum 依赖版本锁定
Makefile 构建脚本,支持多平台编译、测试、覆盖率
lolly.yaml 默认配置文件示例
config.example.yaml 完整配置文件示例(所有字段枚举)
.gitignore Git 忽略规则

Subdirectories

Directory Purpose
internal/ 核心业务代码(不可被外部导入)
bin/ 编译输出目录
docs/ 项目文档和实现计划
scripts/ 构建/测试辅助脚本(回归检测)
.github/ CI/CD 工作流定义

For AI Agents

Working In This Directory

  • 这是 Go 项目,使用 go mod 管理依赖
  • 使用 make build 构建二进制文件到 bin/ 目录
  • 使用 make test 运行测试,make test-cover 生成覆盖率报告
  • 配置文件使用 YAML 格式,结构定义在 internal/config/config.go
  • HTTP 库使用 fasthttp比 net/http 快 6 倍),路由使用 fasthttp/router
  • 日志库使用 zerolog零分配JSON 输出)

Testing Requirements

  • 运行测试前确保依赖已下载:go mod download
  • 测试覆盖率目标 >80%
  • 使用 make check 运行完整检查fmt + lint + test

Common Patterns

  • 配置结构体使用 yaml 标签,通过 gopkg.in/yaml.v3 解析
  • 中间件使用 fasthttp.RequestHandler 函数签名
  • 版本信息通过 -ldflags 在编译时注入
  • 信号处理SIGTERM/SIGINT 快速停止SIGQUIT 优雅停止

Dependencies

External

  • github.com/valyala/fasthttp - 高性能 HTTP 服务器
  • github.com/fasthttp/router - 基于 radix tree 的路由器
  • github.com/rs/zerolog - 零分配 JSON 日志库
  • gopkg.in/yaml.v3 - YAML 解析库