lolly/internal/stream/AGENTS.md
xfy 95030cd68a docs: 更新 AGENTS.md 文档
添加各模块的 AGENTS.md 文档文件,记录模块职责和代码结构

Co-Authored-By: Claude <noreply@anthropic.com>
2026-04-03 14:07:42 +08:00

39 lines
1020 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!-- Parent: ../AGENTS.md -->
<!-- Generated: 2026-04-03 | Updated: 2026-04-03 -->
# stream
## Purpose
TCP/UDP Stream 代理模块,支持四层代理和会话管理。
## Key Files
| File | Description |
|------|-------------|
| `stream.go` | Stream 代理核心TCP/UDP 服务器、连接转发、会话管理 |
| `stream_test.go` | Stream 代理测试 |
## For AI Agents
### Working In This Directory
- TCP 代理:监听端口、转发连接、支持多上游
- UDP 代理会话管理、超时控制、NAT 穿透
- 会话跟踪:源地址+端口作为键
- 超时配置:连接超时、空闲超时
### Testing Requirements
- 运行测试:`go test ./internal/stream/...`
- 测试 TCP/UDP 监听、连接转发、会话管理
### Common Patterns
- TCP 使用 net.Conn 进行双向数据拷贝
- UDP 使用会话映射表管理客户端连接
- 负载均衡策略与 HTTP 代理共享
## Dependencies
### Internal
- `../loadbalance/` - 目标选择
- `../config/` - Stream 配置
<!-- MANUAL: -->