Network monitor: hub, probes, Docker and native installers

Hub (FastAPI + no-build web UI):
- Network health: live probe/target matrix, status strips, incidents
- Probes: add (with install command), rename, remove, latency and throughput charts
- Clients merged from AdGuard, DHCP, query log and probe ARP tables; names,
  categories, suspicious flag, notes, per-client DNS requests
- Query log, domain detail (clients, related subdomains), blocked domains via
  the AdGuard Home /control API

Probe: tests peers (ping, HTTP, throughput), gateway, LAN and public DNS,
internet URLs and an optional VPS; buffers results while the hub is down.
Gateway and ARP from /proc/net on Linux, route/arp on macOS.

Install: install.sh (hub) and install-probe.sh (generated from it), each in
docker mode (compose; default on Linux hosts) or native mode (venv + systemd
or launchd; default on macOS and in LXC). Both modes deploy with an update
command that checks the new commit and rolls back on failure.

CLAUDE.md carries shared context for Claude Code sessions on each machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
neil 2026-11-04 18:10:29 -08:00
commit 54a765510a
63 changed files with 6464 additions and 0 deletions

31
tests/test_app.py Normal file
View file

@ -0,0 +1,31 @@
from fastapi.testclient import TestClient
def test_main_defaults_to_hub():
from app.main import app
with TestClient(app) as client:
r = client.get("/healthz")
assert r.status_code == 200 and r.json()["role"] == "hub"
def test_index_assets_and_spa_fallback(hub):
page = hub.get("/")
assert page.status_code == 200 and "network monitor" in page.text.lower()
css = hub.get("/static/css/app.css")
assert css.status_code == 200 and css.headers["cache-control"] == "no-cache"
assert hub.get("/clients/aa:bb:cc:dd:ee:ff").status_code == 200 # client-side route
assert hub.get("/api/nope").status_code == 404
def test_info(hub):
j = hub.get("/api/info").json()
assert j["role"] == "hub" and j["adguard"] is False
def test_password(hub, monkeypatch):
monkeypatch.setenv("UI_PASSWORD", "s3cret")
assert hub.get("/api/info").status_code == 401
assert hub.get("/api/info", auth=("admin", "wrong")).status_code == 401
assert hub.get("/api/info", auth=("admin", "s3cret")).status_code == 200
assert hub.get("/healthz").status_code == 200
assert hub.post("/api/probe/report", json={}).status_code in (401, 422) # token auth, not the password