mirror of
https://github.com/Sagit-chu/flvx.git
synced 2026-09-29 16:06:36 +08:00
f01c0481cd
- Update root AGENTS.md with expanded anti-patterns and notes - Add handler/AGENTS.md for high-complexity backend handlers - Add connector/AGENTS.md for GOST connector protocols - Add socket/AGENTS.md for GOST socket utilities
1.5 KiB
1.5 KiB
BACKEND HTTP HANDLER KNOWLEDGE BASE
Generated: Fri Feb 13 2026
OVERVIEW
HTTP request handlers for FLVX Admin API. Core business logic layer. Stack: Go 1.23, net/http, raw SQL (no ORM).
STRUCTURE
handler/
├── handler.go # Main Handler struct, login/captcha, job scheduling
├── control_plane.go # Node control plane API (add/delete/list)
├── federation.go # Federation/cluster sync API
├── flow_policy.go # Traffic policy API
├── jobs.go # Background job management (sync, cleanup)
├── mutations.go # CRUD for users, tunnels, forwards (largest: 100k+ LOC)
└── upgrade.go # System upgrade API
WHERE TO LOOK
| Task | Location | Notes |
|---|---|---|
| User/Tunnel CRUD | mutations.go |
Largest file; all create/update/delete ops |
| Login/Captcha | handler.go |
Login flow, captcha verification |
| Federation Sync | federation.go |
Panel-to-panel sync |
| Traffic Policies | flow_policy.go |
Flow limiting, quota management |
| Background Jobs | jobs.go |
Scheduled sync/cleanup tasks |
CONVENTIONS
- Inherits from parent: raw SQL, no ORM, JWT in Authorization header.
- Large files expected (
mutations.go>100k LOC). - Uses
sqlite.Repositoryfor DB access viarepo.XXX()methods.
ANTI-PATTERNS
- Do NOT add ORM here - uses raw SQL throughout.
- Do NOT change handler signatures without updating router.go.
COMMANDS
cd go-backend
go test ./internal/http/handler/...