From 66d460dbfc8d85c400448d3e111608b3c85300f7 Mon Sep 17 00:00:00 2001 From: d3m0k1d Date: Mon, 23 Feb 2026 20:03:40 +0300 Subject: [PATCH] feat: add simple actions without integration to another code --- internal/actions/interface.go | 7 +++++++ internal/actions/webhooks.go | 24 ++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 internal/actions/interface.go create mode 100644 internal/actions/webhooks.go diff --git a/internal/actions/interface.go b/internal/actions/interface.go new file mode 100644 index 0000000..4620e4e --- /dev/null +++ b/internal/actions/interface.go @@ -0,0 +1,7 @@ +package actions + +type Action struct { + Name string + Type string + Args []string +} diff --git a/internal/actions/webhooks.go b/internal/actions/webhooks.go new file mode 100644 index 0000000..cdbb5da --- /dev/null +++ b/internal/actions/webhooks.go @@ -0,0 +1,24 @@ +package actions + +import ( + "bytes" + "net/http" + "time" +) + +func SendWebhook(url string, data []byte) (int, error) { + client := &http.Client{ + Timeout: 30 * time.Second, + } + req, err := http.NewRequest("POST", url, bytes.NewReader(data)) + if err != nil { + return 0, err + } + req.Header.Set("Content-Type", "application/json") + // #nosec G704 validating by admin + resp, err := client.Do(req) + if err != nil { + return 0, err + } + return resp.StatusCode, nil +}