feat: add new command to control firewall in banfogre interface
All checks were successful
CI.yml / build (push) Successful in 1m44s
All checks were successful
CI.yml / build (push) Successful in 1m44s
This commit is contained in:
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user