Commit Graph

14 Commits

Author SHA1 Message Date
BergaBruh 3c2e7c5a81 config: drop concrete IP from egress allowlist; docs: fix host reference
- configs/tunnel.yaml: replace hardcoded address with wildcard
  *.projectshitpost.fun:8443 (covers both edge nodes)
- internal/tunnel/tunnel_test.go: use TEST-NET-1 (RFC 5737) IP
  192.0.2.10 instead of a real one
- docs/AUTH.md: token issue command now runs on stats host
2026-05-10 14:43:42 +05:00
bergamot a674955ad1 Merge pull request 'proto: add RecordSpeedTest RPC + request/response messages' (#1) from feature/speedtest-telemetry into main
Reviewed-on: #1
2026-05-10 09:28:38 +00:00
BergaBruh f7030686b2 snapshot: prune speedtests older than 30 days (retention via existing storage primitive) 2026-05-09 23:43:09 +05:00
BergaBruh d0fb8f3dad stats-site: convert speedtest page to static HTML to match build.sh pipeline 2026-05-09 19:05:05 +05:00
BergaBruh c01341c63a snapshot+hugo: speedtest tab with recent table + per-node aggregates 2026-05-09 19:01:24 +05:00
BergaBruh e6f1f63b8d cmd/speedtest-sync: fail-fast on bad timestamps + minor cleanups
- Skip rows with null/malformed timestamps instead of silently
  re-stamping with time.Now() (data corruption hidden behind a
  fallback). Drops the time import.
- Replace ad-hoc parentDir() with stdlib filepath.Dir().
- Add t.Fatal error checks to TestExtractRows_SkipsBadExtra
  (CREATE TABLE / INSERT) and switch sql.Open to checked form.
- New TestExtractRows_SkipsBadTimestamp covers the null-ts path.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 18:53:34 +05:00
BergaBruh 367db68837 cmd/speedtest-sync: read LibreSpeed local SQLite, sync to stats via gRPC 2026-05-09 18:46:23 +05:00
BergaBruh 4bacd227ff service: add RecordSpeedTest gRPC handler with JWT auth + validation 2026-05-09 18:37:28 +05:00
BergaBruh d1692842b3 storage: add speedtests table + Save/List/Delete + retention
Adds a Store-method API for the RecordSpeedTest RPC (Task 8) and the
retention sweep (Task 14):
  - SaveSpeedTest / ListRecentSpeedTests / DeleteSpeedTestsBefore
  - SpeedTest struct (no json tags; that decision deferred to Task 10)

Schema lives in migrations/002_speedtests.sql to match the existing
embed.FS pattern (rather than inline in Go). The migrate() loop now
iterates every *.sql in lexical order, so future migrations drop in
without code changes. Both files use CREATE ... IF NOT EXISTS so the
existing 001 migration remains idempotent on already-initialised DBs.

CHECK constraints enforce node IN ('fl','pl1') and non-negative metric
values at the DB level. country has no DB CHECK — validation belongs
to the gRPC handler in Task 8.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 18:30:17 +05:00
BergaBruh ff85f21f5d proto: add RecordSpeedTest RPC + request/response messages 2026-05-09 18:21:43 +05:00
BergaBruh 1245c6eb43 fix(stats-site): correct gitea repo URL bergabruh → bergamot
Source-of-truth gitea repo lives at bergamot/stats-gateway, not
bergabruh/stats-gateway (404). Fixes user-facing dashboard footer
+ about page links.

Note: Go module path 'gitea.projectshitpost.fun/bergabruh/...' is
still wrong but rename touches every import + protobuf — separate
refactor PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-09 02:51:22 +05:00
bergamot 731b60863a feat: tunnel JWT auth
Tunnel method now requires Bearer JWT (HMAC-HS256) in gRPC metadata.
   - internal/auth: pure-stdlib verifier + issuer + revoked-jti list
   - internal/tunnel: per-target rate limiter + egress allowlist with
     wildcard support + crypto/rand frame padding to {1KB, 4KB, 16KB}
   - cmd/server reads /etc/stats-gateway/{jwt.key,tunnel.yaml,revoked.txt}
     via --config-dir flag
   - cmd/issue-token Go binary wraps auth.Issue
   - configs/tunnel.yaml example with projectshitpost wildcard


Tests: 13 PASS across 5 packages.
2026-05-05 21:28:37 +05:00
bergamot 0e3a3b4b0e fix(stats-site): chmod 755/644 in TMP before rsync (nginx 403 fix) 2026-05-05 21:12:54 +05:00
bergamot 4059e94759 Initial commit: stats-gateway gRPC service + dashboard + CLI 2026-05-05 21:04:32 +05:00