fix(fed): sanitize peer rows, cap peer bytes, add --peer-blocklist
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 24s
CI / Tests (Linux, race detector) (push) Successful in 34s
CI / Dependency audit (push) Successful in 14s
Release / Plan (reuse the published image?) (push) Successful in 3s
Release / ci (push) Skipped
Release / Build image (amd64) (push) Skipped
Release / Build image (arm64) (push) Skipped
Release / Publish tags (push) Successful in 13s
Release / Gitea release (push) Successful in 4s

Peer events and summary rows are rebuilt from validated fields (address,
country code, category) and the forged/unban flags from peers are
ignored. The live relay drops a peer that exceeds about 1 MB/s, also
within a single window. --peer-blocklist=off keeps the hub's blocklist
to local observations. UI polish: plural forms, blocklist preview and
downloads follow the active slice, compact IP cards on phones. Docs for
the 1.1.0 interface.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Lucas RayanandClaude Opus 5.5 committed 2026-11-14 18:10:54 -03:00
1 parent f4b295f582
commit 783b0cba3e
31 files changed
+355 -127

No files matched your search

+13 -1
View File
@@ -136,7 +136,7 @@ func (e *LiveEvent) Sanitize(now int64) bool {
if e.Status < 0 || e.Status > 999 {
e.Status = 0
}
e.Unban = false
e.Unban, e.Forged = false, false
e.CC = validCC2(clipS(e.CC, 2))
if e.Src != nil {
if !validLatLon(e.Src.Lat, e.Src.Lon) {
@@ -158,3 +158,15 @@ func validCC2(cc string) string {
// String is for debugging.
func (l Location) String() string { return fmt.Sprintf("%.4f,%.4f %s", l.Lat, l.Lon, l.Label) }
// SanitizeFeed validates a feed row that came from a peer's summary; false drops it.
func SanitizeFeed(r *FeedEvent) bool {
a, err := netip.ParseAddr(r.IP)
if err != nil || a.Zone() != "" {
return false
}
r.IP = a.Unmap().String()
r.CC = validCC2(clipS(r.CC, 2))
r.Unban, r.Forged = false, false
return true
}