From dca0241f172fbf4a3d990e86a5683cf5a2700ce6 Mon Sep 17 00:00:00 2001 From: d3m0k1d Date: Thu, 22 Jan 2026 00:11:29 +0300 Subject: [PATCH] fix: golangci-lint --fix run --- internal/judge/judge.go | 37 +++++++++++++++++++++++++++++++++---- internal/storage/db.go | 5 +++-- 2 files changed, 36 insertions(+), 6 deletions(-) diff --git a/internal/judge/judge.go b/internal/judge/judge.go index d64a8da..5415dce 100644 --- a/internal/judge/judge.go +++ b/internal/judge/judge.go @@ -20,7 +20,12 @@ type Judge struct { resultCh chan *storage.LogEntry } -func New(db *storage.DB, b blocker.BlockerEngine, resultCh chan *storage.LogEntry, entryCh chan *storage.LogEntry) *Judge { +func New( + db *storage.DB, + b blocker.BlockerEngine, + resultCh chan *storage.LogEntry, + entryCh chan *storage.LogEntry, +) *Judge { return &Judge{ db: db, logger: logger.New(false), @@ -46,7 +51,15 @@ func (j *Judge) Tribunal() { j.logger.Info("Tribunal started") for entry := range j.entryCh { - j.logger.Debug("Processing entry", "ip", entry.IP, "service", entry.Service, "status", entry.Status) + j.logger.Debug( + "Processing entry", + "ip", + entry.IP, + "service", + entry.Service, + "status", + entry.Status, + ) rules, serviceExists := j.rulesByService[entry.Service] if !serviceExists { @@ -86,7 +99,15 @@ func (j *Judge) Tribunal() { err = j.db.AddBan(entry.IP, rule.BanTime) if err != nil { - j.logger.Error("Failed to add ban to database", "ip", entry.IP, "ban_time", rule.BanTime, "error", err) + j.logger.Error( + "Failed to add ban to database", + "ip", + entry.IP, + "ban_time", + rule.BanTime, + "error", + err, + ) break } @@ -94,7 +115,15 @@ func (j *Judge) Tribunal() { j.logger.Error("Failed to ban IP at firewall", "ip", entry.IP, "error", err) break } - j.logger.Info("IP banned successfully", "ip", entry.IP, "rule", rule.Name, "ban_time", rule.BanTime) + j.logger.Info( + "IP banned successfully", + "ip", + entry.IP, + "rule", + rule.Name, + "ban_time", + rule.BanTime, + ) j.resultCh <- entry break } diff --git a/internal/storage/db.go b/internal/storage/db.go index 054d9a2..bada3a5 100644 --- a/internal/storage/db.go +++ b/internal/storage/db.go @@ -3,12 +3,13 @@ package storage import ( "database/sql" "fmt" + "os" + "time" + "github.com/d3m0k1d/BanForge/internal/config" "github.com/d3m0k1d/BanForge/internal/logger" "github.com/jedib0t/go-pretty/v6/table" _ "modernc.org/sqlite" - "os" - "time" ) type DB struct {