rule.go 925 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. package model
  2. const (
  3. // LimitTypeDefault .
  4. LimitTypeDefault = "limit"
  5. // LimitTypeRestrict .
  6. LimitTypeRestrict = "restrict"
  7. // LimitTypeBlack .
  8. LimitTypeBlack = "black"
  9. // LimitTypeWhite .
  10. LimitTypeWhite = "white"
  11. // LimitScopeLocal .
  12. LimitScopeLocal = "local"
  13. // LimitScopeGlobal .
  14. LimitScopeGlobal = "global"
  15. )
  16. // AggregateRule .
  17. type AggregateRule struct {
  18. Area string `json:"area"`
  19. LimitType string `json:"limit_type"`
  20. GlobalAllowedCounts int64 `json:"global_allowed_counts"`
  21. LocalAllowedCounts int64 `json:"local_allowed_counts"`
  22. GlobalDurationSec int64 `json:"global_dur"`
  23. LocalDurationSec int64 `json:"local_dur"`
  24. }
  25. // Rule .
  26. type Rule struct {
  27. ID int64 `json:"id"`
  28. Area string `json:"area"`
  29. AllowedCounts int64 `json:"allowed_counts"`
  30. LimitType string `json:"limit_type"`
  31. LimitScope string `json:"limit_scope"`
  32. DurationSec int64 `json:"dur"`
  33. }