limits: sync streams, listings per author, inbound connections per IP

A peer may hold 4 sync streams and open 1500 a minute; banned peers get none and cannot redial. A node keeps at most 100 unexpired listings per author (--max-per-author); updates, renewals and deletions of held ones still work. At most 16 inbound connections per public IP or IPv6 /64 (--max-conns-per-ip); local and private addresses are exempt.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AeFqV96dVeBX94inzcgZKw
This commit is contained in:
2026-11-19 00:30:36 +01:00
co-authored by Claude Sonnet 5.5
parent 0b3ead4b23
commit 5ac02360c4
12 changed files with 527 additions and 23 deletions
+6
View File
@@ -61,6 +61,12 @@ type syncRequest struct {
func (n *Node) handleSync(s network.Stream) {
defer s.Close()
end, ok := n.guard.beginSync(s.Conn().RemotePeer())
if !ok {
_ = s.Reset()
return
}
defer end()
_ = s.SetDeadline(time.Now().Add(syncTimeout))
var req syncRequest