feat!: Urutau 2.0.0, ultralight probes and a single analysis hub
Each server runs an ultralight probe (scratch image, ~7 MiB RSS) that tails the logs, ships raw lines to the hub over HTTPS with an on-disk spool, and applies enforce decisions locally. The hub keeps one node per probe (primary node = the 1.x data dir, unchanged), does all analysis and serves the UI. Peer federation is removed. 'urutau import' brings 1.x data dirs in with hash and count verification. UI: probes page, host qualified incidents, IPs never wrap, egress heatmap labels, live and replay globes no longer auto-rotate, replay repeat, live traffic metrics. BREAKING CHANGE: URUTAU_PEERS, URUTAU_PEER_* and /api/v1/peer/* are gone; log path variables move from the hub to the probe. See docs/migration-2.0.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
23a7a5963a
commit
8546d14cef
130 files changed
+9396
-3311
No files matched your search
@@ -1,9 +1,6 @@
|
||||
package server
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/http/httptest"
|
||||
"net/netip"
|
||||
"strconv"
|
||||
"testing"
|
||||
@@ -70,30 +67,4 @@ func TestEgressAPI(t *testing.T) {
|
||||
if w := do(h, "GET", "/api/v1/egress?range=24h", map[string]string{"Authorization": "Bearer peer-secret"}, nil); w.Code == 200 {
|
||||
t.Fatalf("peer token must not open the user route")
|
||||
}
|
||||
|
||||
// peer endpoint (registered by the daemon next to the other peer routes)
|
||||
s := &Server{opt: Options{PeerTokens: []string{"peer-secret"}, Token: userTok, Store: st, Now: time.Now}, ses: newSessions(), lim: newLimiter()}
|
||||
m := http.NewServeMux()
|
||||
m.HandleFunc("GET /api/v1/peer/egress", s.peerEgress)
|
||||
call := func(tok string) *httptest.ResponseRecorder {
|
||||
r := httptest.NewRequest("GET", "/api/v1/peer/egress?range=24h", nil)
|
||||
r.RemoteAddr = "198.51.100.1:1234"
|
||||
if tok != "" {
|
||||
r.Header.Set("Authorization", "Bearer "+tok)
|
||||
}
|
||||
w := httptest.NewRecorder()
|
||||
m.ServeHTTP(w, r)
|
||||
return w
|
||||
}
|
||||
if w := call(""); w.Code != 401 {
|
||||
t.Fatalf("peer no token: %d", w.Code)
|
||||
}
|
||||
if w := call(userTok); w.Code != 401 {
|
||||
t.Fatalf("user token on peer route: %d", w.Code)
|
||||
}
|
||||
w := call("peer-secret")
|
||||
var rep egress.Report
|
||||
if w.Code != 200 || json.Unmarshal(w.Body.Bytes(), &rep) != nil || len(rep.Findings) == 0 {
|
||||
t.Fatalf("peer: %d %s", w.Code, w.Body)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user