feat: integration actions to judge logic and update docs for this
Some checks failed
build / build (push) Failing after 1m55s
Some checks failed
build / build (push) Failing after 1m55s
This commit is contained in:
@@ -31,7 +31,7 @@ type Rule struct {
|
||||
Method string `toml:"method"`
|
||||
MaxRetry int `toml:"max_retry"`
|
||||
BanTime string `toml:"ban_time"`
|
||||
Action []Action
|
||||
Action []Action `toml:"action"`
|
||||
}
|
||||
|
||||
type Metrics struct {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/d3m0k1d/BanForge/internal/actions"
|
||||
"github.com/d3m0k1d/BanForge/internal/blocker"
|
||||
"github.com/d3m0k1d/BanForge/internal/config"
|
||||
"github.com/d3m0k1d/BanForge/internal/logger"
|
||||
@@ -124,6 +125,17 @@ func (j *Judge) Tribunal() {
|
||||
metrics.IncError()
|
||||
break
|
||||
}
|
||||
|
||||
for _, action := range rule.Action {
|
||||
executor := &actions.Executor{Action: action}
|
||||
if err := executor.Execute(); err != nil {
|
||||
j.logger.Error("Action execution failed",
|
||||
"rule", rule.Name,
|
||||
"action_type", action.Type,
|
||||
"error", err)
|
||||
}
|
||||
}
|
||||
|
||||
j.logger.Info(
|
||||
"IP banned successfully",
|
||||
"ip",
|
||||
|
||||
Reference in New Issue
Block a user