bot.go 426 B

123456789101112131415161718192021
  1. package policy
  2. import (
  3. "fmt"
  4. "github.com/TecharoHQ/anubis/internal"
  5. "github.com/TecharoHQ/anubis/lib/policy/checker"
  6. "github.com/TecharoHQ/anubis/lib/policy/config"
  7. )
  8. type Bot struct {
  9. Rules checker.Impl
  10. Challenge *config.ChallengeRules
  11. Weight *config.Weight
  12. Name string
  13. Action config.Rule
  14. }
  15. func (b Bot) Hash() string {
  16. return internal.SHA256sum(fmt.Sprintf("%s::%s", b.Name, b.Rules.Hash()))
  17. }