Add progressive throttle for follows ACL mode (v0.48.10)
Some checks failed
Go / build-and-release (push) Has been cancelled
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:
@@ -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
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user