EdgeFlow CDN control plane — configuration management and API service.
flowchart LR
Console[Web Console] -->|REST API :8090| Control
API[Third-party] -->|REST API| Control
subgraph Control[Control Plane]
Gin[Gin Router + JWT]
Handlers[Domain / Origin / Cert / Purge / Node]
end
Control -->|gRPC :9091| Edge1[Edge Node 1]
Control -->|gRPC :9091| Edge2[Edge Node 2]
Control --> PG[(PostgreSQL)]
Control --> Redis[(Redis)]
- REST API (Gin) for domain, origin, cache rule, certificate, and node management
- PostgreSQL storage with auto-migration
- JWT authentication with bcrypt passwords
- Admin/user role-based access control
- Cache purge task management (URL, directory, full site)
- Cache prefetch API
- Certificate PEM parsing and storage
- gRPC server for edge node communication:
- Config push (streaming updates)
- Purge command dispatch
- Node heartbeat collection
# Prerequisites: PostgreSQL running on localhost:5432
# Build
go build -o bin/cdn-control ./cmd
# Run
./bin/cdn-control -config configs/control-config.yaml
# Docker
docker build -t cdn-control .Default admin credentials: admin / admin123
| Method | Path | Description |
|---|---|---|
| POST | /api/v1/auth/login | Login, get JWT token |
| CRUD | /api/v1/domains | Domain management |
| CRUD | /api/v1/domains/:id/origins | Origin management |
| CRUD | /api/v1/domains/:id/cache-rules | Cache rules |
| POST | /api/v1/purge/url | Purge by URL |
| POST | /api/v1/purge/dir | Purge by directory |
| POST | /api/v1/purge/all | Purge entire domain |
| POST | /api/v1/prefetch | Cache prefetch |
| CRUD | /api/v1/domains/:id/certs | Certificate management |
| GET | /api/v1/nodes | Node list |
# Unit tests (no DB required)
go test ./middleware/... -v
# Integration tests (requires PostgreSQL)
TEST_DATABASE_URL="postgres://user:pass@localhost:5432/edgeflow_test?sslmode=disable" go test ./handler/... -v