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
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:
1 parent
f4b295f582
commit
783b0cba3e
31 files changed
+355
-127
No files matched your search
@@ -62,10 +62,12 @@ type Options struct {
|
||||
PeerAllow []netip.Prefix
|
||||
TrustedProxy []netip.Prefix
|
||||
NoAuth bool
|
||||
Version string
|
||||
Store *store.Store
|
||||
Hub *fed.Hub
|
||||
Now func() time.Time
|
||||
// LocalBlocklist makes the blocklist use only this instance's IPs (--peer-blocklist=off).
|
||||
LocalBlocklist bool
|
||||
Version string
|
||||
Store *store.Store
|
||||
Hub *fed.Hub
|
||||
Now func() time.Time
|
||||
}
|
||||
|
||||
// Server is the HTTP handler.
|
||||
@@ -464,13 +466,17 @@ func (s *Server) summary(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
// allIPs returns the merged IP table for the requested host selection.
|
||||
func (s *Server) allIPs(rangeName, host string) []store.IPSummary {
|
||||
return s.ipsOf(rangeName, host, false)
|
||||
}
|
||||
|
||||
func (s *Server) ipsOf(rangeName, host string, localOnly bool) []store.IPSummary {
|
||||
rg := store.ParseRange(rangeName)
|
||||
var lists [][]store.IPSummary
|
||||
self := s.opt.Store.Name()
|
||||
if host == "" || host == "all" || host == self {
|
||||
lists = append(lists, s.opt.Store.AllIPs(rg, false))
|
||||
}
|
||||
if s.opt.Hub != nil && host != self {
|
||||
if s.opt.Hub != nil && host != self && !localOnly {
|
||||
only := ""
|
||||
if host != "" && host != "all" {
|
||||
only = host
|
||||
@@ -711,7 +717,7 @@ func (s *Server) blocklist(asJSON bool) http.HandlerFunc {
|
||||
family = "all"
|
||||
}
|
||||
var out []store.IPSummary
|
||||
for _, x := range s.allIPs(rangeName, q.Get("host")) {
|
||||
for _, x := range s.ipsOf(rangeName, q.Get("host"), s.opt.LocalBlocklist) {
|
||||
if x.Score < min || !x.Strong || x.Admin {
|
||||
continue
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user