feat: add new command to control firewall in banfogre interface
All checks were successful
CI.yml / build (push) Successful in 1m44s

This commit is contained in:
d3m0k1d
2026-01-14 17:47:29 +03:00
parent 36508201ad
commit 7a7f57f5ae
2 changed files with 94 additions and 13 deletions

View File

@@ -1,6 +1,27 @@
package blocker
import (
"fmt"
"github.com/d3m0k1d/BanForge/internal/logger"
)
type BlockerEngine interface {
Ban(ip string) error
Unban(ip string) error
}
func GetBlocker(fw string, config string) BlockerEngine {
switch fw {
case "ufw":
return NewUfw(logger.New(false))
case "iptables":
return NewIptables(logger.New(false), config)
case "nftables":
return NewNftables(logger.New(false), config)
case "firewalld":
return NewFirewalld(logger.New(false))
default:
panic(fmt.Sprintf("Unknown firewall: %s", fw))
}
}