feat!: Urutau 2.0.0, ultralight probes and a single analysis hub
CI / Format and vet (pull_request) Failing after 53s
CI / Dependency audit (pull_request) Successful in 33s
CI / Tests (Linux, race detector) (pull_request) Successful in 2m1s
CI / Docker images (build and smoke test) (pull_request) Failing after 47s

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:
Lucas RayanandClaude Opus 5.5 committed 2026-11-15 22:14:50 -03:00
1 parent 23a7a5963a
commit 8546d14cef
130 files changed
+9396 -3311

No files matched your search

+18 -3
View File
@@ -16,8 +16,12 @@ import (
// Config configures the engine. Mode must be observe or on (off means no engine).
type Config struct {
Mode string
Path string // decision file
Mode string
Path string // decision file
// Sink, when set, receives every decision (kind wire.CmdDecision) and unban
// request (wire.CmdUnban) line instead of the files: the hub queues them for
// the probe of the host. Path and UnbanPath are then only informational.
Sink func(kind, line string) error
UnbanPath string // unban requests read by the host (empty: unbanning is unavailable)
StatePath string // enforce.json, empty: no persistence
Host string // name of this instance, written in every line
@@ -233,6 +237,17 @@ func New(c Config) *Engine {
return e
}
// writeLog delivers one decision line to the sink or the decision file.
func (e *Engine) writeLog(line string) error {
if e.cfg.Sink != nil {
return e.cfg.Sink("decision", line)
}
return e.log.write(line)
}
// HasSink reports whether decisions go to a sink instead of local files.
func (e *Engine) HasSink() bool { return e.cfg.Sink != nil }
// Mode returns the mode of the engine.
func (e *Engine) Mode() string { return e.cfg.Mode }
@@ -622,7 +637,7 @@ func (e *Engine) apply(a netip.Addr, st *ipState, d Decision, src string, now ti
}
line, err := FormatLine(now, a, d.Reason, d.Score, d.TTL, e.cfg.Host, src)
if err == nil {
err = e.log.write(line)
err = e.writeLog(line)
}
if err != nil {
e.counts.WriteErrors++
+6 -2
View File
@@ -47,7 +47,7 @@ func UnbanLine(t time.Time, a netip.Addr, allow int) string {
// Unban writes the request for the host, drops the active ban of the address
// and, when allowS > 0, keeps the engine from banning it for that long.
func (e *Engine) Unban(a netip.Addr, allowS int, src string) error {
if e.cfg.UnbanPath == "" {
if e.cfg.UnbanPath == "" && e.cfg.Sink == nil {
return ErrNoUnbanLog
}
if allowS < 0 || allowS > MaxAllow {
@@ -55,7 +55,11 @@ func (e *Engine) Unban(a netip.Addr, allowS int, src string) error {
}
a = a.Unmap().WithZone("")
now := e.cfg.Now()
if err := e.unlog.write(UnbanLine(now, a, allowS)); err != nil {
if e.cfg.Sink != nil {
if err := e.cfg.Sink("unban", UnbanLine(now, a, allowS)); err != nil {
return err
}
} else if err := e.unlog.write(UnbanLine(now, a, allowS)); err != nil {
return err
}
e.mu.Lock()