37 lines
1.4 KiB
Markdown
37 lines
1.4 KiB
Markdown
# stats-gateway
|
|
|
|
gRPC service collecting and publishing HTTP/TCP/DNS/TLS-handshake timing
|
|
metrics for two geo-distributed OpenSpeedTest nodes (FL — Finland, PL1 — Poland).
|
|
Powers the dashboard at <https://stats.projectshitpost.fun/>.
|
|
|
|
## Components
|
|
|
|
- **`cmd/server`** — gRPC server (TLS terminated by nginx, listens on loopback).
|
|
- **`cmd/collector`** — periodic prober (HTTP HEAD with httptrace), runs every 5 min via systemd timer.
|
|
- **`cmd/snapshot`** — generates `snapshot.json` for the dashboard, runs every 10 min.
|
|
- **`internal/probes`** — timing logic (DNS, TCP, TLS handshake, HTTP).
|
|
- **`internal/storage`** — SQLite WAL with embedded migrations.
|
|
- **`internal/service`** — gRPC handlers (`RecentResults`, `Aggregate`, `Tunnel`).
|
|
- **`proto/`** — protobuf definitions; generated Go in `gen/`.
|
|
- **`stats-site/`** — static dashboard (vanilla JS + canvas charts, no framework deps).
|
|
- **`psp-stats-cli/`** — Go CLI for querying the API.
|
|
- **`systemd/`** — ops units for running the service + timers.
|
|
- **`docs/AUTH.md`** — auth doc for the `Tunnel` method (Bearer JWT/HS256, used by internal CI agents).
|
|
|
|
## Build
|
|
|
|
make build # ./bin/{stats-gateway,stats-collector,stats-snapshot}
|
|
make test
|
|
cd psp-stats-cli && make build
|
|
|
|
## API
|
|
|
|
grpcurl -d '{"node":"fl","limit":5}' \
|
|
stats.projectshitpost.fun:443 stats.v1.SpeedStatus/RecentResults
|
|
|
|
See `proto/stats.proto`.
|
|
|
|
## License
|
|
|
|
MIT — see [LICENSE](./LICENSE).
|