implemented nip-86 relay management API and added to relay client
Some checks failed
Go / build (push) Has been cancelled
Go / release (push) Has been cancelled

This commit is contained in:
2025-10-16 17:20:04 +01:00
parent a4c4f14b87
commit bcd79aa967
19 changed files with 3122 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
package acl
import (
"next.orly.dev/pkg/encoders/event"
"next.orly.dev/pkg/interfaces/acl"
"next.orly.dev/pkg/utils/atomic"
)
@@ -78,3 +79,21 @@ func (s *S) AddFollow(pub []byte) {
}
}
}
// CheckPolicy checks if an event is allowed by the active ACL policy
func (s *S) CheckPolicy(ev *event.E) (allowed bool, err error) {
for _, i := range s.ACL {
if i.Type() == s.Active.Load() {
// Check if the ACL implementation has a CheckPolicy method
if policyChecker, ok := i.(interface {
CheckPolicy(ev *event.E) (allowed bool, err error)
}); ok {
return policyChecker.CheckPolicy(ev)
}
// If no CheckPolicy method, default to allowing
return true, nil
}
}
// If no active ACL, default to allowing
return true, nil
}