Add progressive throttle for follows ACL mode (v0.48.10)
Some checks failed
Go / build-and-release (push) Has been cancelled

- Add progressive throttle feature for follows ACL mode, allowing
  non-followed users to write with increasing delay instead of blocking
- Delay increases linearly per event (default 200ms) and decays at 1:1
  ratio with elapsed time, capping at configurable max (default 60s)
- Track both IP and pubkey independently to prevent evasion
- Add periodic cleanup to remove fully-decayed throttle entries
- Fix BBolt serial resolver to return proper errors when buckets or
  entries are not found

Files modified:
- app/config/config.go: Add ORLY_FOLLOWS_THROTTLE_* env vars
- app/handle-event.go: Apply throttle delay before event processing
- app/listener.go: Add getFollowsThrottleDelay helper method
- pkg/acl/follows.go: Integrate throttle with follows ACL
- pkg/acl/follows_throttle.go: New progressive throttle implementation
- pkg/bbolt/save-event.go: Return errors from serial lookups
- pkg/version/version: Bump to v0.48.10

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
woikos
2026-01-09 17:39:04 +01:00
parent 41a3b5c0a5
commit e7bc9a4a97
8 changed files with 261 additions and 7 deletions

View File

@@ -350,12 +350,15 @@ func (r *bboltSerialResolver) GetPubkeyBySerial(serial uint64) (pubkey []byte, e
r.b.db.View(func(tx *bolt.Tx) error {
bucket := tx.Bucket(bucketSpk)
if bucket == nil {
err = errors.New("bbolt: spk bucket not found")
return nil
}
val := bucket.Get(makeSerialKey(serial))
if val != nil {
pubkey = make([]byte, 32)
copy(pubkey, val)
} else {
err = errors.New("bbolt: pubkey serial not found")
}
return nil
})
@@ -374,12 +377,15 @@ func (r *bboltSerialResolver) GetEventIdBySerial(serial uint64) (eventID []byte,
r.b.db.View(func(tx *bolt.Tx) error {
bucket := tx.Bucket(bucketSei)
if bucket == nil {
err = errors.New("bbolt: sei bucket not found")
return nil
}
val := bucket.Get(makeSerialKey(serial))
if val != nil {
eventID = make([]byte, 32)
copy(eventID, val)
} else {
err = errors.New("bbolt: event serial not found")
}
return nil
})