From eaf276bd3f22faecc61eb7b1feee6484eea719f1 Mon Sep 17 00:00:00 2001 From: d3m0k1d Date: Thu, 15 Jan 2026 18:06:48 +0300 Subject: [PATCH] docs: Add new docs and fix rule command --- cmd/banforge/command/rule.go | 6 ++++- docs/cli.md | 51 ++++++++++++++++++++++++++++++++++++ docs/config.md | 0 3 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 docs/cli.md create mode 100644 docs/config.md diff --git a/cmd/banforge/command/rule.go b/cmd/banforge/command/rule.go index 8435744..94d6dc5 100644 --- a/cmd/banforge/command/rule.go +++ b/cmd/banforge/command/rule.go @@ -29,7 +29,11 @@ var AddCmd = &cobra.Command{ fmt.Printf("Rule name can't be empty\n") os.Exit(1) } - if service == "" && path == "" && status == "" && method == "" { + if service == "" { + fmt.Printf("Service name can't be empty\n") + os.Exit(1) + } + if path == "" && status == "" && method == "" { fmt.Printf("At least 1 rule field must be filled in.") os.Exit(1) } diff --git a/docs/cli.md b/docs/cli.md new file mode 100644 index 0000000..ca11311 --- /dev/null +++ b/docs/cli.md @@ -0,0 +1,51 @@ +# CLI commands BanForge +BanForge provides a command-line interface (CLI) to manage IP blocking, +configure detection rules, and control the daemon process. +## Commands +### init - create a deps file + +```shell +banfogre init +``` + +**Description** +This command creates the necessary directories and base configuration files +required for the daemon to operate. +### daemon - Starts the BanForge daemon process + +```shell +banforge daemon +``` + +**Description** +This command starts the BanForge daemon process in the background. +The daemon continuously monitors incoming requests, detects anomalies, +and applies firewall rules in real-time. + +### firewall - Manages firewall rules +```shell +banforge ban +banforge unban +``` + +**Description** +These commands provide an abstraction over your firewall. If you want to simplify the interface to your firewall, you can use these commands. + +### rule - Manages detection rules + +```shell +banforge rule add -n rule.name -m 403 +banforge rule list +``` + +**Description** +These command help you to create and manage detection rules in CLI interface. + +| Flag | Required | +| ----------- | -------- | +| -n -name | + | +| -s -service | + | +| -p -path | - | +| -m -method | - | +| -c -status | - | +You must specify at least 1 of the optional flags to create a rule. diff --git a/docs/config.md b/docs/config.md new file mode 100644 index 0000000..e69de29