From 0c5bdf9c473e16f123b4dd16deb0194a30b1265f Mon Sep 17 00:00:00 2001 From: Dwi Siswanto Date: Sun, 3 Jul 2022 12:50:12 +0700 Subject: [PATCH] refactor: module name --- .goreleaser.yml | 4 ++-- Dockerfile | 4 ++-- Makefile | 2 +- README.md | 4 ++-- common/options.go | 2 +- go.mod | 2 +- internal/alert/alert.go | 6 +++--- internal/alert/discord.go | 2 +- internal/alert/telegram.go | 2 +- internal/event/event.go | 4 ++-- internal/event/server.go | 2 +- internal/runner/banner.go | 2 +- internal/runner/cache.go | 4 ++-- internal/runner/logs.go | 6 +++--- internal/runner/metrics.go | 6 +++--- internal/runner/options.go | 8 ++++---- internal/runner/runner.go | 12 ++++++------ internal/runner/validator.go | 10 +++++----- internal/runner/version.go | 2 +- cmd/teler/main.go => main.go | 2 +- pkg/cache/cache.go | 2 +- pkg/logs/file.go | 2 +- pkg/logs/zinc.go | 2 +- pkg/matchers/config.go | 2 +- pkg/matchers/config_test.go | 28 ++++++++++++++-------------- pkg/metrics/prometheus.go | 2 +- pkg/requests/resources.go | 8 ++++---- pkg/teler/teler.go | 4 ++-- pkg/teler/utils.go | 6 +++--- 29 files changed, 71 insertions(+), 71 deletions(-) rename cmd/teler/main.go => main.go (91%) diff --git a/.goreleaser.yml b/.goreleaser.yml index 241175c1..376eca5a 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -1,6 +1,6 @@ builds: - binary: teler - main: cmd/teler/main.go + main: main.go goos: - linux - windows @@ -11,7 +11,7 @@ builds: - arm - arm64 ldflags: - - -s -w -X ktbs.dev/teler/common.Version=v{{.Version}} + - -s -w -X teler.app/common.Version=v{{.Version}} archives: - id: tgz diff --git a/Dockerfile b/Dockerfile index eb752636..ef90ff7a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,8 @@ COPY ./go.mod . RUN go mod download COPY . . -RUN go build -ldflags "-s -w -X ktbs.dev/teler/common.Version=${VERSION}" \ - -o ./bin/teler ./cmd/teler +RUN go build -ldflags "-s -w -X teler.app/common.Version=${VERSION}" \ + -o ./bin/teler . FROM alpine:latest diff --git a/Makefile b/Makefile index 90834a68..2706895e 100644 --- a/Makefile +++ b/Makefile @@ -24,7 +24,7 @@ help: build: @echo "--- Building ${APP_NAME} ${VERSION}" @echo "GOPATH=${GOPATH}" - go build -ldflags "-s -w -X ktbs.dev/teler/common.Version=${VERSION}" -buildvcs=false -o ./bin/${APP_NAME} ./cmd/${APP_NAME} + go build -ldflags "-s -w -X teler.app/common.Version=${VERSION}" -buildvcs=false -o ./bin/${APP_NAME} . build-all: @echo "--- Cross-platform build ${APP_NAME} ${VERSION}" diff --git a/README.md b/README.md index 6efd5b36..0e1c9247 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@

- +

Real-time HTTP Intrusion Detection @@ -88,7 +88,7 @@ Here is a preview of `teler` with conditions of use as: ## Documentation -All related documentation about installation, usage & configuration is on our [Wiki page](https://www.notion.so/kitabisa/teler-a1fd9d874e9a4448a45d9d3add434b54). +All related documentation about installation, usage & configuration is on **[teler.app](https://teler.app)**. ## Supporting Materials diff --git a/common/options.go b/common/options.go index 440b1686..106ac373 100644 --- a/common/options.go +++ b/common/options.go @@ -3,7 +3,7 @@ package common import ( "os" - "ktbs.dev/teler/pkg/parsers" + "teler.app/pkg/parsers" ) // Options contains the configuration options diff --git a/go.mod b/go.mod index 16291576..135c180b 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module ktbs.dev/teler +module teler.app go 1.18 diff --git a/internal/alert/alert.go b/internal/alert/alert.go index 0895eff8..c385f98f 100644 --- a/internal/alert/alert.go +++ b/internal/alert/alert.go @@ -3,9 +3,9 @@ package alert import ( "reflect" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/matchers" - "ktbs.dev/teler/pkg/utils" + "teler.app/common" + "teler.app/pkg/matchers" + "teler.app/pkg/utils" ) // New will initialize notification provider & send threat alerts diff --git a/internal/alert/discord.go b/internal/alert/discord.go index 682eb3ca..48d116dc 100644 --- a/internal/alert/discord.go +++ b/internal/alert/discord.go @@ -8,7 +8,7 @@ import ( "strings" "github.com/bwmarrin/discordgo" - "ktbs.dev/teler/pkg/errors" + "teler.app/pkg/errors" ) // token can be webhook URL if webhooked is true diff --git a/internal/alert/telegram.go b/internal/alert/telegram.go index 9bacdd23..63229fdb 100644 --- a/internal/alert/telegram.go +++ b/internal/alert/telegram.go @@ -6,7 +6,7 @@ import ( "strconv" telegramBot "github.com/go-telegram-bot-api/telegram-bot-api" - "ktbs.dev/teler/pkg/errors" + "teler.app/pkg/errors" ) func toTelegram(token string, chatID string, log map[string]string) { diff --git a/internal/event/event.go b/internal/event/event.go index 7a48c5c1..44e48953 100644 --- a/internal/event/event.go +++ b/internal/event/event.go @@ -14,8 +14,8 @@ import ( "github.com/r3labs/sse/v2" "goji.io" "goji.io/pat" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/errors" + "teler.app/common" + "teler.app/pkg/errors" ) // Run SSE diff --git a/internal/event/server.go b/internal/event/server.go index 9ad808a7..f7e3d8ff 100644 --- a/internal/event/server.go +++ b/internal/event/server.go @@ -2,7 +2,7 @@ package event import ( "github.com/r3labs/sse/v2" - "ktbs.dev/teler/common" + "teler.app/common" ) type server struct { diff --git a/internal/runner/banner.go b/internal/runner/banner.go index 654b0520..2f9f679f 100644 --- a/internal/runner/banner.go +++ b/internal/runner/banner.go @@ -2,7 +2,7 @@ package runner import ( "github.com/projectdiscovery/gologger" - "ktbs.dev/teler/common" + "teler.app/common" ) // showBanner is used to show the banner to the user diff --git a/internal/runner/cache.go b/internal/runner/cache.go index 0cfcd341..7205f183 100644 --- a/internal/runner/cache.go +++ b/internal/runner/cache.go @@ -2,8 +2,8 @@ package runner import ( "github.com/projectdiscovery/gologger" - "ktbs.dev/teler/pkg/cache" - "ktbs.dev/teler/pkg/errors" + "teler.app/pkg/cache" + "teler.app/pkg/errors" ) func rmCache() { diff --git a/internal/runner/logs.go b/internal/runner/logs.go index 45f84966..f66cad75 100644 --- a/internal/runner/logs.go +++ b/internal/runner/logs.go @@ -4,9 +4,9 @@ import ( "fmt" "reflect" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/errors" - "ktbs.dev/teler/pkg/logs" + "teler.app/common" + "teler.app/pkg/errors" + "teler.app/pkg/logs" ) func log(options *common.Options, data map[string]string) { diff --git a/internal/runner/metrics.go b/internal/runner/metrics.go index 35f198c6..86285266 100644 --- a/internal/runner/metrics.go +++ b/internal/runner/metrics.go @@ -8,9 +8,9 @@ import ( "github.com/projectdiscovery/gologger" "github.com/prometheus/client_golang/prometheus/promhttp" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/errors" - "ktbs.dev/teler/pkg/metrics" + "teler.app/common" + "teler.app/pkg/errors" + "teler.app/pkg/metrics" ) func metric(options *common.Options) { diff --git a/internal/runner/options.go b/internal/runner/options.go index f9d5e211..bb73512d 100644 --- a/internal/runner/options.go +++ b/internal/runner/options.go @@ -6,10 +6,10 @@ import ( "os" "strings" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/cache" - "ktbs.dev/teler/pkg/errors" - "ktbs.dev/teler/pkg/requests" + "teler.app/common" + "teler.app/pkg/cache" + "teler.app/pkg/errors" + "teler.app/pkg/requests" ) // ParseOptions will parse args/opts diff --git a/internal/runner/runner.go b/internal/runner/runner.go index c66be758..580cccf1 100644 --- a/internal/runner/runner.go +++ b/internal/runner/runner.go @@ -11,12 +11,12 @@ import ( "github.com/projectdiscovery/gologger" "github.com/remeh/sizedwaitgroup" "github.com/satyrius/gonx" - "ktbs.dev/teler/common" - "ktbs.dev/teler/internal/alert" - "ktbs.dev/teler/internal/event" - "ktbs.dev/teler/pkg/errors" - "ktbs.dev/teler/pkg/metrics" - "ktbs.dev/teler/pkg/teler" + "teler.app/common" + "teler.app/internal/alert" + "teler.app/internal/event" + "teler.app/pkg/errors" + "teler.app/pkg/metrics" + "teler.app/pkg/teler" ) // New read & pass stdin log diff --git a/internal/runner/validator.go b/internal/runner/validator.go index 1565ecab..9837e652 100644 --- a/internal/runner/validator.go +++ b/internal/runner/validator.go @@ -12,11 +12,11 @@ import ( "strings" "gopkg.in/validator.v2" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/errors" - "ktbs.dev/teler/pkg/matchers" - "ktbs.dev/teler/pkg/parsers" - "ktbs.dev/teler/pkg/utils" + "teler.app/common" + "teler.app/pkg/errors" + "teler.app/pkg/matchers" + "teler.app/pkg/parsers" + "teler.app/pkg/utils" ) func validate(options *common.Options) { diff --git a/internal/runner/version.go b/internal/runner/version.go index 8b5a0c89..a89581ae 100644 --- a/internal/runner/version.go +++ b/internal/runner/version.go @@ -4,7 +4,7 @@ import ( "fmt" "os" - "ktbs.dev/teler/common" + "teler.app/common" ) func showVersion() { diff --git a/cmd/teler/main.go b/main.go similarity index 91% rename from cmd/teler/main.go rename to main.go index 5cd7bbdf..b7e3db79 100644 --- a/cmd/teler/main.go +++ b/main.go @@ -4,7 +4,7 @@ import ( "github.com/projectdiscovery/gologger" "github.com/projectdiscovery/gologger/levels" "go.uber.org/automaxprocs/maxprocs" - "ktbs.dev/teler/internal/runner" + "teler.app/internal/runner" ) func init() { diff --git a/pkg/cache/cache.go b/pkg/cache/cache.go index ed5662e6..6e404b7d 100644 --- a/pkg/cache/cache.go +++ b/pkg/cache/cache.go @@ -7,7 +7,7 @@ import ( "time" "github.com/kirsle/configdir" - "ktbs.dev/teler/pkg/errors" + "teler.app/pkg/errors" ) // Cache defines resources cache file informations diff --git a/pkg/logs/file.go b/pkg/logs/file.go index 00dcb218..a6ce0d62 100644 --- a/pkg/logs/file.go +++ b/pkg/logs/file.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "ktbs.dev/teler/common" + "teler.app/common" ) // File write detected threats into it diff --git a/pkg/logs/zinc.go b/pkg/logs/zinc.go index b86f35a0..2022bde3 100644 --- a/pkg/logs/zinc.go +++ b/pkg/logs/zinc.go @@ -8,7 +8,7 @@ import ( "io/ioutil" "net/http" - e "ktbs.dev/teler/pkg/errors" + e "teler.app/pkg/errors" ) // Zinc logs insertion diff --git a/pkg/matchers/config.go b/pkg/matchers/config.go index 6fb7303b..7c1e8cd1 100644 --- a/pkg/matchers/config.go +++ b/pkg/matchers/config.go @@ -5,7 +5,7 @@ import ( "strconv" "strings" - "ktbs.dev/teler/pkg/errors" + "teler.app/pkg/errors" ) func errValidate(key string) { diff --git a/pkg/matchers/config_test.go b/pkg/matchers/config_test.go index 0d22494e..ee0e0189 100644 --- a/pkg/matchers/config_test.go +++ b/pkg/matchers/config_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "ktbs.dev/teler/pkg/errors" + "teler.app/pkg/errors" ) func TestIsLogformat(t *testing.T) { @@ -22,21 +22,21 @@ func TestIsLogformat(t *testing.T) { }{ { name: "Invalid log format", - args: args { + args: args{ s: "", }, wantErr: true, }, { name: "Invalid log format: need $ sign", - args: args { + args: args{ s: "remote_addr", }, wantErr: true, }, { name: "Log format is valid", - args: args { + args: args{ s: "$request_method", }, wantErr: false, @@ -67,21 +67,21 @@ func TestIsToken(t *testing.T) { }{ { name: "Invalid token", - args: args { + args: args{ s: "hola", }, wantErr: true, }, { name: "Token is valid", - args: args { + args: args{ s: "xoxp-0123456789-012345678901-y", }, wantErr: false, }, { name: "Token is valid", - args: args { + args: args{ s: "012345678:abcdefghijklmnopqrstuvwxyz012345678", }, wantErr: false, @@ -112,21 +112,21 @@ func TestIsHexcolor(t *testing.T) { }{ { name: "Invalid hex color code", - args: args { + args: args{ s: "\u2713", }, wantErr: true, }, { name: "Invalid hex color code", - args: args { + args: args{ s: "#af01", }, wantErr: true, }, { name: "Hex color code is valid", - args: args { + args: args{ s: "#F00000", }, wantErr: false, @@ -176,14 +176,14 @@ func TestIsChannel(t *testing.T) { }{ { name: "Invalid Slack channel ID", - args: args { + args: args{ s: "hola", }, wantErr: true, }, { name: "Slack channel ID is valid", - args: args { + args: args{ s: randomChannelID(), }, wantErr: false, @@ -214,14 +214,14 @@ func TestIsChatID(t *testing.T) { }{ { name: "Invalid Telegram chat_id", - args: args { + args: args{ s: "hola", }, wantErr: true, }, { name: "Telegram chat_id is valid", - args: args { + args: args{ s: "12345678", }, wantErr: false, diff --git a/pkg/metrics/prometheus.go b/pkg/metrics/prometheus.go index 9cee3f4f..0ba7291e 100644 --- a/pkg/metrics/prometheus.go +++ b/pkg/metrics/prometheus.go @@ -4,7 +4,7 @@ import ( "strings" "github.com/prometheus/client_golang/prometheus" - "ktbs.dev/teler/common" + "teler.app/common" ) // PrometheusInsert logs into metrics diff --git a/pkg/requests/resources.go b/pkg/requests/resources.go index b05f5899..21b49557 100644 --- a/pkg/requests/resources.go +++ b/pkg/requests/resources.go @@ -9,10 +9,10 @@ import ( "time" "github.com/briandowns/spinner" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/cache" - "ktbs.dev/teler/pkg/errors" - "ktbs.dev/teler/resource" + "teler.app/common" + "teler.app/pkg/cache" + "teler.app/pkg/errors" + "teler.app/resource" ) var ( diff --git a/pkg/teler/teler.go b/pkg/teler/teler.go index 10ec2d39..9124223a 100644 --- a/pkg/teler/teler.go +++ b/pkg/teler/teler.go @@ -12,8 +12,8 @@ import ( "github.com/satyrius/gonx" "github.com/valyala/fastjson" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/matchers" + "teler.app/common" + "teler.app/pkg/matchers" ) // Analyze logs from threat resources diff --git a/pkg/teler/utils.go b/pkg/teler/utils.go index 9f3c675d..a5423242 100644 --- a/pkg/teler/utils.go +++ b/pkg/teler/utils.go @@ -4,9 +4,9 @@ import ( "reflect" "unicode/utf8" - "ktbs.dev/teler/common" - "ktbs.dev/teler/pkg/matchers" - "ktbs.dev/teler/resource" + "teler.app/common" + "teler.app/pkg/matchers" + "teler.app/resource" ) func getDatasets() {