feat: 1.1.0 interface, geography drill-down and live attack map
Release / Plan (reuse the published image?) (push) Successful in 4s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 19s
CI / Tests (Linux, race detector) (push) Successful in 35s
CI / Dependency audit (push) Successful in 16s
Release / ci (push) Successful in 35s
Release / Build image (arm64) (push) Successful in 51s
Release / Build image (amd64) (push) Successful in 1m11s
Release / Publish tags (push) Successful in 13s
Release / Gitea release (push) Skipped

A new console interface (side rail, seven pages, opening sentence and
active slice on every page, IP drawer, light and dark design tokens);
a Geography page that drills from the world to a country's regions and
cities; a Live page drawing attacks as arcs on a flat map or a globe.

Backend: GET /api/v1/geo, GET /api/v1/live/recent, host/src/dst on live
events, --location, a strict static file pattern, and live federation
through GET /api/v1/peer/stream (peer token only, bounded and sanitized
relay on the hub).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-14 17:47:28 -03:00
1 parent ff143ec4a2
commit f4b295f582
37 files changed
+5312 -1000

No files matched your search

+13 -1
View File
@@ -61,6 +61,7 @@ type peerState struct {
latency int64
version string
exports map[string]store.PeerExport
live bool
}
// Hub polls peers and serves their latest summaries.
@@ -69,6 +70,10 @@ type Hub struct {
Token string
Interval time.Duration
client *http.Client
stream *http.Client // long-lived SSE: no overall timeout, no redirects
lmu sync.Mutex
live liveState
mu sync.RWMutex
state map[string]*peerState
@@ -78,6 +83,9 @@ type Hub struct {
func NewHub(peers []Peer, token string) *Hub {
h := &Hub{Peers: peers, Token: token, Interval: 15 * time.Second,
client: &http.Client{Timeout: 4 * time.Second, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}, state: map[string]*peerState{}}
tr := http.DefaultTransport.(*http.Transport).Clone()
tr.ResponseHeaderTimeout = 10 * time.Second
h.stream = &http.Client{Transport: tr, CheckRedirect: func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse }}
for _, p := range peers {
h.state[p.Name] = &peerState{exports: map[string]store.PeerExport{}}
}
@@ -186,6 +194,7 @@ func (h *Hub) Run(ctx context.Context) {
if len(h.Peers) == 0 {
return
}
h.Stream(ctx)
h.Refresh(ctx)
t := time.NewTicker(h.Interval)
defer t.Stop()
@@ -206,11 +215,14 @@ func (h *Hub) Hosts() []store.HostInfo {
out := make([]store.HostInfo, 0, len(h.Peers))
for _, p := range h.Peers {
st := h.state[p.Name]
hi := store.HostInfo{Name: p.Name, Online: st.online, Error: st.err, LastSeen: st.lastOK, LatencyMS: st.latency, Version: st.version}
hi := store.HostInfo{Name: p.Name, Online: st.online, Error: st.err, LastSeen: st.lastOK, LatencyMS: st.latency, Version: st.version, Live: st.live && st.online}
if e, ok := st.exports["24h"]; ok && st.online {
s := e.Summary
hi.Requests, hi.Malicious = s.Totals.Requests, s.Totals.Malicious
hi.HostileIPs, hi.ActiveBans = s.Totals.HostileIPs, s.Totals.ActiveBans
if len(s.Hosts) > 0 {
hi.Location = s.Hosts[0].Location
}
}
out = append(out, hi)
}