diff --git a/.goreleaser.yml b/.goreleaser.yml index 4fce594..5a951f4 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -51,7 +51,7 @@ brews: - client tap: - owner: russtone + owner: nt0xa name: homebrew-sonar token: "{{ .Env.HOMEBREW_TAP_GITHUB_TOKEN }}" @@ -69,10 +69,10 @@ changelog: dockers: - image_templates: - - "ghcr.io/russtone/sonar:latest" - - "ghcr.io/russtone/sonar:{{.Major}}" - - "ghcr.io/russtone/sonar:{{.Major}}.{{.Minor}}" - - "ghcr.io/russtone/sonar:{{.Major}}.{{.Minor}}.{{.Patch}}" + - "ghcr.io/nt0xa/sonar:latest" + - "ghcr.io/nt0xa/sonar:{{.Major}}" + - "ghcr.io/nt0xa/sonar:{{.Major}}.{{.Minor}}" + - "ghcr.io/nt0xa/sonar:{{.Major}}.{{.Minor}}.{{.Patch}}" build_flag_templates: - "--pull" - "--label=org.opencontainers.image.created={{.Date}}" diff --git a/README.md b/README.md index 8371ce4..443289b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Sonar -[![Build and test](https://img.shields.io/github/actions/workflow/status/russtone/sonar/build-and-test.yml?branch=master)](https://github.com/russtone/sonar/actions?query=workflow%3A%22Build+and+test%22) -[![Go report](https://goreportcard.com/badge/github.com/russtone/sonar)](https://goreportcard.com/report/github.com/russtone/sonar) -[![Code coverage](https://img.shields.io/codecov/c/gh/russtone/sonar.svg)](https://codecov.io/gh/russtone/sonar) +[![Build and test](https://img.shields.io/github/actions/workflow/status/nt0xa/sonar/build-and-test.yml?branch=master)](https://github.com/nt0xa/sonar/actions?query=workflow%3A%22Build+and+test%22) +[![Go report](https://goreportcard.com/badge/github.com/nt0xa/sonar)](https://goreportcard.com/report/github.com/nt0xa/sonar) +[![Code coverage](https://img.shields.io/codecov/c/gh/nt0xa/sonar.svg)](https://codecov.io/gh/nt0xa/sonar) diff --git a/cmd/client/main.go b/cmd/client/main.go index 62a47c6..af1aef4 100644 --- a/cmd/client/main.go +++ b/cmd/client/main.go @@ -15,10 +15,10 @@ import ( "github.com/spf13/cobra" "github.com/spf13/viper" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/cmd" - "github.com/russtone/sonar/internal/modules/api/apiclient" - "github.com/russtone/sonar/internal/templates" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/cmd" + "github.com/nt0xa/sonar/internal/modules/api/apiclient" + "github.com/nt0xa/sonar/internal/templates" ) var ( diff --git a/cmd/server/main.go b/cmd/server/main.go index 9b66d79..bad7a2a 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -10,15 +10,15 @@ import ( "github.com/kelseyhightower/envconfig" "github.com/sirupsen/logrus" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/cache" - "github.com/russtone/sonar/internal/cmd/server" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/pkg/dnsx" - "github.com/russtone/sonar/pkg/ftpx" - "github.com/russtone/sonar/pkg/httpx" - "github.com/russtone/sonar/pkg/smtpx" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/cache" + "github.com/nt0xa/sonar/internal/cmd/server" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/pkg/dnsx" + "github.com/nt0xa/sonar/pkg/ftpx" + "github.com/nt0xa/sonar/pkg/httpx" + "github.com/nt0xa/sonar/pkg/smtpx" ) func main() { @@ -125,7 +125,7 @@ func main() { go func() { srv := dnsx.New( - ":53", + "127.0.0.1:7753", dnsHandler, dnsx.NotifyStartedFunc(waitDNS.Done), ) @@ -168,7 +168,7 @@ func main() { go func() { srv := httpx.New( - ":80", + "127.0.0.1:7780", server.HTTPHandler( db, cfg.Domain, @@ -190,7 +190,7 @@ func main() { go func() { srv := httpx.New( - ":443", + "127.0.0.1:7443", server.HTTPHandler( db, cfg.Domain, @@ -213,7 +213,7 @@ func main() { go func() { // Pass TLS config to be able to handle "STARTTLS" command. srv := smtpx.New( - ":25", + "127.0.0.1:7725", smtpx.ListenerWrapper(server.SMTPListenerWrapper(1<<20, time.Second*5)), smtpx.Messages(smtpx.Msg{Greet: cfg.Domain, Ehlo: cfg.Domain}), smtpx.OnClose(func(e *smtpx.Event) { @@ -234,7 +234,7 @@ func main() { go func() { // Pass TLS config to be able to handle "STARTTLS" command. srv := ftpx.New( - ":21", + "127.0.0.1:7721", ftpx.ListenerWrapper(server.SMTPListenerWrapper(1<<20, time.Second*5)), ftpx.Messages(ftpx.Msg{Greet: fmt.Sprintf("%s Server ready", cfg.Domain)}), ftpx.OnClose(func(e *ftpx.Event) { diff --git a/config.toml b/config.toml new file mode 100644 index 0000000..dba337d --- /dev/null +++ b/config.toml @@ -0,0 +1,8 @@ +[context] +server = 'test' + +[servers] +[servers.test] +token = '04a752d6c759f59978755f554bffa08c' +url = 'https://sonar.test:31337' +insecure = true diff --git a/go.mod b/go.mod index f7c4d83..76d3767 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/russtone/sonar +module github.com/nt0xa/sonar go 1.21 diff --git a/internal/actions/actions.go b/internal/actions/actions.go index 07625c4..b360aac 100644 --- a/internal/actions/actions.go +++ b/internal/actions/actions.go @@ -4,7 +4,7 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/errors" ) func init() { diff --git a/internal/actions/dns_records.go b/internal/actions/dns_records.go index cd57768..b16b671 100644 --- a/internal/actions/dns_records.go +++ b/internal/actions/dns_records.go @@ -9,9 +9,9 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" - "github.com/russtone/sonar/internal/utils/valid" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/valid" ) const ( diff --git a/internal/actions/events.go b/internal/actions/events.go index 355d2d9..82773c2 100644 --- a/internal/actions/events.go +++ b/internal/actions/events.go @@ -8,7 +8,7 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/errors" ) const ( diff --git a/internal/actions/http_routes.go b/internal/actions/http_routes.go index 2503324..dba7a49 100644 --- a/internal/actions/http_routes.go +++ b/internal/actions/http_routes.go @@ -13,9 +13,9 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" - "github.com/russtone/sonar/internal/utils/valid" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/valid" ) const ( diff --git a/internal/actions/mock/Actions.go b/internal/actions/mock/Actions.go index 85d865d..34e911c 100644 --- a/internal/actions/mock/Actions.go +++ b/internal/actions/mock/Actions.go @@ -5,9 +5,9 @@ package actions_mock import ( context "context" - actions "github.com/russtone/sonar/internal/actions" + actions "github.com/nt0xa/sonar/internal/actions" - errors "github.com/russtone/sonar/internal/utils/errors" + errors "github.com/nt0xa/sonar/internal/utils/errors" mock "github.com/stretchr/testify/mock" ) diff --git a/internal/actions/payloads.go b/internal/actions/payloads.go index 0e68a69..3726bf6 100644 --- a/internal/actions/payloads.go +++ b/internal/actions/payloads.go @@ -7,9 +7,9 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" - "github.com/russtone/sonar/internal/utils/valid" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/valid" ) const ( diff --git a/internal/actions/user.go b/internal/actions/user.go index e8e685e..b25b975 100644 --- a/internal/actions/user.go +++ b/internal/actions/user.go @@ -5,7 +5,7 @@ import ( "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/errors" ) const ( diff --git a/internal/actions/users.go b/internal/actions/users.go index 2e6d769..c52f2eb 100644 --- a/internal/actions/users.go +++ b/internal/actions/users.go @@ -7,8 +7,8 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) const ( diff --git a/internal/actions/utils.go b/internal/actions/utils.go index 1ece8dd..d066c07 100644 --- a/internal/actions/utils.go +++ b/internal/actions/utils.go @@ -6,7 +6,7 @@ import ( "github.com/mitchellh/mapstructure" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/errors" ) func oneArg(name string) cobra.PositionalArgs { diff --git a/internal/actionsdb/actions.go b/internal/actionsdb/actions.go index 9f63998..7a61c4c 100644 --- a/internal/actionsdb/actions.go +++ b/internal/actionsdb/actions.go @@ -1,9 +1,9 @@ package actionsdb import ( - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/utils/logger" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/utils/logger" ) type dbactions struct { diff --git a/internal/actionsdb/actions_test.go b/internal/actionsdb/actions_test.go index a69501a..bad783a 100644 --- a/internal/actionsdb/actions_test.go +++ b/internal/actionsdb/actions_test.go @@ -9,9 +9,9 @@ import ( "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/database" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/database" ) var ( diff --git a/internal/actionsdb/context.go b/internal/actionsdb/context.go index 89ef9c1..42facbd 100644 --- a/internal/actionsdb/context.go +++ b/internal/actionsdb/context.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) type contextKey string diff --git a/internal/actionsdb/dns_records.go b/internal/actionsdb/dns_records.go index 69d75da..554cf5e 100644 --- a/internal/actionsdb/dns_records.go +++ b/internal/actionsdb/dns_records.go @@ -5,9 +5,9 @@ import ( "database/sql" "strings" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) func DNSRecord(m models.DNSRecord, payloadSubdomain string) actions.DNSRecord { diff --git a/internal/actionsdb/dns_records_test.go b/internal/actionsdb/dns_records_test.go index e15d64f..0a31fc1 100644 --- a/internal/actionsdb/dns_records_test.go +++ b/internal/actionsdb/dns_records_test.go @@ -8,10 +8,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) func TestDNSRecordsCreate_Success(t *testing.T) { diff --git a/internal/actionsdb/events.go b/internal/actionsdb/events.go index 00c5d96..a71c6f2 100644 --- a/internal/actionsdb/events.go +++ b/internal/actionsdb/events.go @@ -5,10 +5,10 @@ import ( "database/sql" "encoding/base64" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) func Event(m models.Event) actions.Event { diff --git a/internal/actionsdb/events_test.go b/internal/actionsdb/events_test.go index 3d87fde..eeaa039 100644 --- a/internal/actionsdb/events_test.go +++ b/internal/actionsdb/events_test.go @@ -7,9 +7,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/utils/errors" ) func TestEventsList_Success(t *testing.T) { diff --git a/internal/actionsdb/http_routes.go b/internal/actionsdb/http_routes.go index 60ef6e0..0cc3fdc 100644 --- a/internal/actionsdb/http_routes.go +++ b/internal/actionsdb/http_routes.go @@ -6,9 +6,9 @@ import ( "encoding/base64" "strings" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) func HTTPRoute(m models.HTTPRoute, payloadSubdomain string) actions.HTTPRoute { diff --git a/internal/actionsdb/http_routes_test.go b/internal/actionsdb/http_routes_test.go index c567515..d908025 100644 --- a/internal/actionsdb/http_routes_test.go +++ b/internal/actionsdb/http_routes_test.go @@ -8,10 +8,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) func TestHTTPRoutesCreate_Success(t *testing.T) { diff --git a/internal/actionsdb/payloads.go b/internal/actionsdb/payloads.go index 8930fa2..c8efc6c 100644 --- a/internal/actionsdb/payloads.go +++ b/internal/actionsdb/payloads.go @@ -4,11 +4,11 @@ import ( "context" "database/sql" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils" - "github.com/russtone/sonar/internal/utils/errors" - "github.com/russtone/sonar/internal/utils/slice" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils" + "github.com/nt0xa/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/slice" ) func Payload(m models.Payload) actions.Payload { diff --git a/internal/actionsdb/payloads_test.go b/internal/actionsdb/payloads_test.go index 6add745..968ff28 100644 --- a/internal/actionsdb/payloads_test.go +++ b/internal/actionsdb/payloads_test.go @@ -7,11 +7,11 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" - "github.com/russtone/sonar/internal/utils/pointer" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/pointer" ) func TestCreatePayload_Success(t *testing.T) { diff --git a/internal/actionsdb/user.go b/internal/actionsdb/user.go index a251cd0..89560bc 100644 --- a/internal/actionsdb/user.go +++ b/internal/actionsdb/user.go @@ -3,8 +3,8 @@ package actionsdb import ( "context" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/utils/errors" ) func (act *dbactions) ProfileGet(ctx context.Context) (*actions.ProfileGetResult, errors.Error) { diff --git a/internal/actionsdb/user_test.go b/internal/actionsdb/user_test.go index 059422b..5e2b62b 100644 --- a/internal/actionsdb/user_test.go +++ b/internal/actionsdb/user_test.go @@ -7,8 +7,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/utils/errors" ) func TestUserCurrent_Success(t *testing.T) { diff --git a/internal/actionsdb/users.go b/internal/actionsdb/users.go index fa6ab4f..32f93cb 100644 --- a/internal/actionsdb/users.go +++ b/internal/actionsdb/users.go @@ -4,9 +4,9 @@ import ( "context" "database/sql" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) func User(m models.User) actions.User { diff --git a/internal/actionsdb/users_test.go b/internal/actionsdb/users_test.go index 5d0cccc..1b144fe 100644 --- a/internal/actionsdb/users_test.go +++ b/internal/actionsdb/users_test.go @@ -7,10 +7,10 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) func TestUsersCreate_Success(t *testing.T) { diff --git a/internal/cache/cache.go b/internal/cache/cache.go index f0a43ef..d762239 100644 --- a/internal/cache/cache.go +++ b/internal/cache/cache.go @@ -3,8 +3,8 @@ package cache import ( "sync" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" ) type Cache interface { diff --git a/internal/cmd/auth.go b/internal/cmd/auth.go index e891212..de735f3 100644 --- a/internal/cmd/auth.go +++ b/internal/cmd/auth.go @@ -3,7 +3,7 @@ package cmd import ( "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/errors" ) func (c *Command) withAuthCheck(cmd *cobra.Command) *cobra.Command { diff --git a/internal/cmd/cmd.go b/internal/cmd/cmd.go index 3a59961..3f93ed1 100644 --- a/internal/cmd/cmd.go +++ b/internal/cmd/cmd.go @@ -10,7 +10,7 @@ import ( "github.com/google/shlex" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" ) //go:generate go run ./internal/codegen/*.go -type cmd diff --git a/internal/cmd/cmd_test.go b/internal/cmd/cmd_test.go index e990d23..0b53994 100644 --- a/internal/cmd/cmd_test.go +++ b/internal/cmd/cmd_test.go @@ -9,11 +9,11 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - actions_mock "github.com/russtone/sonar/internal/actions/mock" - "github.com/russtone/sonar/internal/cmd" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/pointer" + "github.com/nt0xa/sonar/internal/actions" + actions_mock "github.com/nt0xa/sonar/internal/actions/mock" + "github.com/nt0xa/sonar/internal/cmd" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/pointer" ) var ( diff --git a/internal/cmd/generated.go b/internal/cmd/generated.go index aef1c00..c217b19 100644 --- a/internal/cmd/generated.go +++ b/internal/cmd/generated.go @@ -3,7 +3,7 @@ package cmd import ( "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" ) func (c *Command) DNSRecordsClear(onResult func(actions.Result) error) *cobra.Command { diff --git a/internal/cmd/options.go b/internal/cmd/options.go index 39b93a9..b4a991c 100644 --- a/internal/cmd/options.go +++ b/internal/cmd/options.go @@ -1,7 +1,7 @@ package cmd import ( - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" "github.com/spf13/cobra" ) diff --git a/internal/cmd/server/config.go b/internal/cmd/server/config.go index 0cdf063..b409ada 100644 --- a/internal/cmd/server/config.go +++ b/internal/cmd/server/config.go @@ -3,7 +3,7 @@ package server import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/go-ozzo/ozzo-validation/v4/is" - "github.com/russtone/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database" ) type Config struct { diff --git a/internal/cmd/server/dns.go b/internal/cmd/server/dns.go index 6c330c4..9b7b651 100644 --- a/internal/cmd/server/dns.go +++ b/internal/cmd/server/dns.go @@ -9,11 +9,11 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/miekg/dns" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/dnsdb" - "github.com/russtone/sonar/internal/utils/tpl" - "github.com/russtone/sonar/pkg/dnsx" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/dnsdb" + "github.com/nt0xa/sonar/internal/utils/tpl" + "github.com/nt0xa/sonar/pkg/dnsx" ) var dnsTemplate = tpl.MustParse(` diff --git a/internal/cmd/server/events.go b/internal/cmd/server/events.go index 6cac869..3ee3f69 100644 --- a/internal/cmd/server/events.go +++ b/internal/cmd/server/events.go @@ -7,10 +7,10 @@ import ( "strings" "sync" - "github.com/russtone/sonar/internal/cache" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/modules" + "github.com/nt0xa/sonar/internal/cache" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/modules" ) type NotifyFunc func(net.Addr, []byte, map[string]interface{}) diff --git a/internal/cmd/server/ftp.go b/internal/cmd/server/ftp.go index 19744b9..2d548d2 100644 --- a/internal/cmd/server/ftp.go +++ b/internal/cmd/server/ftp.go @@ -5,9 +5,9 @@ import ( "time" "github.com/fatih/structs" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/pkg/ftpx" - "github.com/russtone/sonar/pkg/netx" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/pkg/ftpx" + "github.com/nt0xa/sonar/pkg/netx" ) func FTPListenerWrapper(maxBytes int64, idleTimeout time.Duration) func(net.Listener) net.Listener { diff --git a/internal/cmd/server/http.go b/internal/cmd/server/http.go index 272856b..e779222 100644 --- a/internal/cmd/server/http.go +++ b/internal/cmd/server/http.go @@ -9,11 +9,11 @@ import ( "github.com/fatih/structs" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/httpdb" - "github.com/russtone/sonar/internal/utils" - "github.com/russtone/sonar/pkg/httpx" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/httpdb" + "github.com/nt0xa/sonar/internal/utils" + "github.com/nt0xa/sonar/pkg/httpx" ) // TODO: as parameters diff --git a/internal/cmd/server/modules.go b/internal/cmd/server/modules.go index 22375f6..d094e35 100644 --- a/internal/cmd/server/modules.go +++ b/internal/cmd/server/modules.go @@ -7,12 +7,12 @@ import ( validation "github.com/go-ozzo/ozzo-validation/v4" "github.com/sirupsen/logrus" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/modules" - "github.com/russtone/sonar/internal/modules/api" - "github.com/russtone/sonar/internal/modules/lark" - "github.com/russtone/sonar/internal/modules/telegram" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/modules" + "github.com/nt0xa/sonar/internal/modules/api" + "github.com/nt0xa/sonar/internal/modules/lark" + "github.com/nt0xa/sonar/internal/modules/telegram" ) type Controller interface { diff --git a/internal/cmd/server/smtp.go b/internal/cmd/server/smtp.go index e315974..8c6f0c2 100644 --- a/internal/cmd/server/smtp.go +++ b/internal/cmd/server/smtp.go @@ -6,9 +6,9 @@ import ( "github.com/fatih/structs" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/pkg/netx" - "github.com/russtone/sonar/pkg/smtpx" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/smtpx" ) func SMTPListenerWrapper(maxBytes int64, idleTimeout time.Duration) func(net.Listener) net.Listener { diff --git a/internal/cmd/server/tls.go b/internal/cmd/server/tls.go index fc72c13..1bae657 100644 --- a/internal/cmd/server/tls.go +++ b/internal/cmd/server/tls.go @@ -7,9 +7,9 @@ import ( "github.com/go-acme/lego/v3/challenge" validation "github.com/go-ozzo/ozzo-validation/v4" - "github.com/russtone/sonar/internal/utils/logger" - "github.com/russtone/sonar/internal/utils/valid" - "github.com/russtone/sonar/pkg/certmgr" + "github.com/nt0xa/sonar/internal/utils/logger" + "github.com/nt0xa/sonar/internal/utils/valid" + "github.com/nt0xa/sonar/pkg/certmgr" ) type TLSConfig struct { diff --git a/internal/codegen/code.go b/internal/codegen/code.go index 95aa5ee..6551ea2 100644 --- a/internal/codegen/code.go +++ b/internal/codegen/code.go @@ -5,7 +5,7 @@ var cmdCode = `package cmd import ( "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" ) {{ range . }} @@ -50,7 +50,7 @@ var apiCode = `package api import ( "net/http" - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" ) {{ range . }} @@ -83,8 +83,8 @@ package apiclient import ( "context" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/utils/errors" ) {{ range . }} diff --git a/internal/codegen/main.go b/internal/codegen/main.go index 83ab6a1..0561e37 100644 --- a/internal/codegen/main.go +++ b/internal/codegen/main.go @@ -9,7 +9,7 @@ import ( "text/template" "github.com/Masterminds/sprig/v3" - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" ) type Options struct { diff --git a/internal/database/db.go b/internal/database/db.go index 78648d9..820ee0f 100644 --- a/internal/database/db.go +++ b/internal/database/db.go @@ -10,7 +10,7 @@ import ( "github.com/golang-migrate/migrate/v4/database/postgres" "github.com/jmoiron/sqlx" - "github.com/russtone/sonar/internal/utils/logger" + "github.com/nt0xa/sonar/internal/utils/logger" ) type DB struct { diff --git a/internal/database/db_helper.go b/internal/database/db_helper.go index 1201138..8acf1ee 100644 --- a/internal/database/db_helper.go +++ b/internal/database/db_helper.go @@ -4,7 +4,7 @@ import ( "database/sql" "github.com/jmoiron/sqlx" - "github.com/russtone/sonar/internal/utils/logger" + "github.com/nt0xa/sonar/internal/utils/logger" ) func (db *DB) NamedQueryRowx(query string, arg interface{}) *row { diff --git a/internal/database/db_test.go b/internal/database/db_test.go index cde6eac..9faa365 100644 --- a/internal/database/db_test.go +++ b/internal/database/db_test.go @@ -9,7 +9,7 @@ import ( "github.com/sirupsen/logrus" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database" ) var ( diff --git a/internal/database/dns_records.go b/internal/database/dns_records.go index 95969f8..de0c564 100644 --- a/internal/database/dns_records.go +++ b/internal/database/dns_records.go @@ -1,7 +1,7 @@ package database import ( - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func (db *DB) DNSRecordsCreate(o *models.DNSRecord) error { diff --git a/internal/database/dns_records_test.go b/internal/database/dns_records_test.go index fc5d917..8692ba5 100644 --- a/internal/database/dns_records_test.go +++ b/internal/database/dns_records_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func TestDNSRecordsCreate_Success(t *testing.T) { diff --git a/internal/database/events.go b/internal/database/events.go index b61a4da..16d7419 100644 --- a/internal/database/events.go +++ b/internal/database/events.go @@ -1,7 +1,7 @@ package database import ( - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func (db *DB) EventsCreate(o *models.Event) error { diff --git a/internal/database/events_test.go b/internal/database/events_test.go index 32a4d76..23354c7 100644 --- a/internal/database/events_test.go +++ b/internal/database/events_test.go @@ -9,8 +9,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" ) func TestEventsCreate_Success(t *testing.T) { diff --git a/internal/database/http_routes.go b/internal/database/http_routes.go index 5f314c7..dbb0712 100644 --- a/internal/database/http_routes.go +++ b/internal/database/http_routes.go @@ -1,7 +1,7 @@ package database import ( - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func (db *DB) HTTPRoutesCreate(o *models.HTTPRoute) error { diff --git a/internal/database/http_routes_test.go b/internal/database/http_routes_test.go index 509df2e..a8db7b7 100644 --- a/internal/database/http_routes_test.go +++ b/internal/database/http_routes_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func TestHTTPRoutesCreate_Success(t *testing.T) { diff --git a/internal/database/models/dns_record_test.go b/internal/database/models/dns_record_test.go index 85afc68..1311995 100644 --- a/internal/database/models/dns_record_test.go +++ b/internal/database/models/dns_record_test.go @@ -6,7 +6,7 @@ import ( "github.com/miekg/dns" "github.com/stretchr/testify/assert" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func TestDNSRecordsQtype(t *testing.T) { diff --git a/internal/database/models/user_test.go b/internal/database/models/user_test.go index 85de677..5a53925 100644 --- a/internal/database/models/user_test.go +++ b/internal/database/models/user_test.go @@ -6,7 +6,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func TestUserParams(t *testing.T) { diff --git a/internal/database/observer.go b/internal/database/observer.go index 48063cc..188852f 100644 --- a/internal/database/observer.go +++ b/internal/database/observer.go @@ -1,6 +1,6 @@ package database -import "github.com/russtone/sonar/internal/database/models" +import "github.com/nt0xa/sonar/internal/database/models" type Observer interface { PayloadCreated(p models.Payload) diff --git a/internal/database/payloads.go b/internal/database/payloads.go index eedabd8..5501c1b 100644 --- a/internal/database/payloads.go +++ b/internal/database/payloads.go @@ -3,7 +3,7 @@ package database import ( "fmt" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func (db *DB) PayloadsCreate(o *models.Payload) error { diff --git a/internal/database/payloads_test.go b/internal/database/payloads_test.go index 9fde1fa..9c55d94 100644 --- a/internal/database/payloads_test.go +++ b/internal/database/payloads_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func TestPayloadsCreate_Success(t *testing.T) { diff --git a/internal/database/users.go b/internal/database/users.go index 99583f8..39e7c97 100644 --- a/internal/database/users.go +++ b/internal/database/users.go @@ -5,8 +5,8 @@ import ( "github.com/fatih/structs" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils" ) var usersInnerQuery = "" + diff --git a/internal/database/users_test.go b/internal/database/users_test.go index c9a2e92..9c04cbf 100644 --- a/internal/database/users_test.go +++ b/internal/database/users_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database/models" ) func TestUsersCreate_Success(t *testing.T) { diff --git a/internal/dnsdb/dnsdb.go b/internal/dnsdb/dnsdb.go index 46a5351..8f60243 100644 --- a/internal/dnsdb/dnsdb.go +++ b/internal/dnsdb/dnsdb.go @@ -7,11 +7,11 @@ import ( "github.com/miekg/dns" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/pointer" - "github.com/russtone/sonar/internal/utils/slice" - "github.com/russtone/sonar/pkg/dnsx" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/pointer" + "github.com/nt0xa/sonar/internal/utils/slice" + "github.com/nt0xa/sonar/pkg/dnsx" ) // Records searches for DNS records in the database. diff --git a/internal/dnsdb/dnsdb_test.go b/internal/dnsdb/dnsdb_test.go index 77f214f..814a03c 100644 --- a/internal/dnsdb/dnsdb_test.go +++ b/internal/dnsdb/dnsdb_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/dnsdb" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/dnsdb" ) var ( diff --git a/internal/httpdb/httpdb.go b/internal/httpdb/httpdb.go index d98cbde..3888c75 100644 --- a/internal/httpdb/httpdb.go +++ b/internal/httpdb/httpdb.go @@ -9,8 +9,8 @@ import ( "github.com/go-chi/chi/v5" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" ) type Routes struct { diff --git a/internal/httpdb/httpdb_test.go b/internal/httpdb/httpdb_test.go index ae329fc..b8e5f0f 100644 --- a/internal/httpdb/httpdb_test.go +++ b/internal/httpdb/httpdb_test.go @@ -18,8 +18,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/httpdb" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/httpdb" ) var ( diff --git a/internal/modules/api/api.go b/internal/modules/api/api.go index 76c097a..6a55af4 100644 --- a/internal/modules/api/api.go +++ b/internal/modules/api/api.go @@ -7,9 +7,9 @@ import ( "github.com/go-chi/chi/v5" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/utils/logger" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/utils/logger" ) type API struct { @@ -34,7 +34,7 @@ func New(cfg *Config, db *database.DB, log logger.StdLogger, func (api *API) Start() error { srv := http.Server{ - Addr: fmt.Sprintf(":%d", api.cfg.Port), + Addr: fmt.Sprintf("127.0.0.1:%d", api.cfg.Port), Handler: api.Router(), TLSConfig: api.tls, } diff --git a/internal/modules/api/api_test.go b/internal/modules/api/api_test.go index 61b2b1c..3756653 100644 --- a/internal/modules/api/api_test.go +++ b/internal/modules/api/api_test.go @@ -18,12 +18,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/modules/api" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/modules/api" + "github.com/nt0xa/sonar/internal/utils/errors" ) // Flags diff --git a/internal/modules/api/apiclient/client.go b/internal/modules/api/apiclient/client.go index 36c7d8e..7f40369 100644 --- a/internal/modules/api/apiclient/client.go +++ b/internal/modules/api/apiclient/client.go @@ -6,7 +6,7 @@ import ( "github.com/go-resty/resty/v2" - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" ) type Client struct { diff --git a/internal/modules/api/apiclient/client_test.go b/internal/modules/api/apiclient/client_test.go index 028f93d..cff4720 100644 --- a/internal/modules/api/apiclient/client_test.go +++ b/internal/modules/api/apiclient/client_test.go @@ -18,13 +18,13 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/modules/api" - "github.com/russtone/sonar/internal/modules/api/apiclient" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/modules/api" + "github.com/nt0xa/sonar/internal/modules/api/apiclient" + "github.com/nt0xa/sonar/internal/utils/errors" ) // Flags diff --git a/internal/modules/api/apiclient/error_test.go b/internal/modules/api/apiclient/error_test.go index 306535d..3a1ac2d 100644 --- a/internal/modules/api/apiclient/error_test.go +++ b/internal/modules/api/apiclient/error_test.go @@ -3,7 +3,7 @@ package apiclient_test import ( "testing" - "github.com/russtone/sonar/internal/modules/api/apiclient" + "github.com/nt0xa/sonar/internal/modules/api/apiclient" "github.com/stretchr/testify/assert" ) diff --git a/internal/modules/api/apiclient/generated.go b/internal/modules/api/apiclient/generated.go index b7f6ed4..58a81f3 100644 --- a/internal/modules/api/apiclient/generated.go +++ b/internal/modules/api/apiclient/generated.go @@ -3,8 +3,8 @@ package apiclient import ( "context" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/utils/errors" ) func (c *Client) DNSRecordsClear(ctx context.Context, params actions.DNSRecordsClearParams) (actions.DNSRecordsClearResult, errors.Error) { diff --git a/internal/modules/api/apiclient/utils.go b/internal/modules/api/apiclient/utils.go index 2affc4f..2721ff1 100644 --- a/internal/modules/api/apiclient/utils.go +++ b/internal/modules/api/apiclient/utils.go @@ -8,7 +8,7 @@ import ( "github.com/fatih/structs" "github.com/go-resty/resty/v2" "github.com/gorilla/schema" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/errors" ) var encoder = schema.NewEncoder() diff --git a/internal/modules/api/config_test.go b/internal/modules/api/config_test.go index d192b3c..bb72130 100644 --- a/internal/modules/api/config_test.go +++ b/internal/modules/api/config_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/assert" - "github.com/russtone/sonar/internal/modules/api" + "github.com/nt0xa/sonar/internal/modules/api" ) func TestConfig_Success(t *testing.T) { diff --git a/internal/modules/api/error.go b/internal/modules/api/error.go index 5bb5654..32ac81f 100644 --- a/internal/modules/api/error.go +++ b/internal/modules/api/error.go @@ -4,7 +4,7 @@ import ( "encoding/json" "net/http" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/errors" ) func (api *API) handleError(w http.ResponseWriter, r *http.Request, err error) { diff --git a/internal/modules/api/generated.go b/internal/modules/api/generated.go index 2ce2e4a..f118c6c 100644 --- a/internal/modules/api/generated.go +++ b/internal/modules/api/generated.go @@ -3,7 +3,7 @@ package api import ( "net/http" - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" ) func (api *API) DNSRecordsClear(w http.ResponseWriter, r *http.Request) { diff --git a/internal/modules/api/middleware.go b/internal/modules/api/middleware.go index 1f10a6d..6b964ee 100644 --- a/internal/modules/api/middleware.go +++ b/internal/modules/api/middleware.go @@ -4,9 +4,9 @@ import ( "net/http" "strings" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/utils/errors" ) func (api *API) checkAuth() func(http.Handler) http.Handler { diff --git a/internal/modules/api/utils.go b/internal/modules/api/utils.go index 30ab3ed..1cfbe8e 100644 --- a/internal/modules/api/utils.go +++ b/internal/modules/api/utils.go @@ -8,8 +8,8 @@ import ( "github.com/gorilla/schema" "github.com/mitchellh/mapstructure" - "github.com/russtone/sonar/internal/utils/errors" - "github.com/russtone/sonar/internal/utils/parse" + "github.com/nt0xa/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/parse" ) var decoder = schema.NewDecoder() diff --git a/internal/modules/lark/context.go b/internal/modules/lark/context.go index 5feb505..dd96638 100644 --- a/internal/modules/lark/context.go +++ b/internal/modules/lark/context.go @@ -3,7 +3,7 @@ package lark import ( "context" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/utils/errors" ) type contextKey string diff --git a/internal/modules/lark/lark.go b/internal/modules/lark/lark.go index 7bd105b..56165b5 100644 --- a/internal/modules/lark/lark.go +++ b/internal/modules/lark/lark.go @@ -22,12 +22,12 @@ import ( "github.com/larksuite/oapi-sdk-go/v3/event/dispatcher" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/cmd" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/templates" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/cmd" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/templates" ) type Lark struct { diff --git a/internal/modules/lark/notifier.go b/internal/modules/lark/notifier.go index 0597d6c..a049cf7 100644 --- a/internal/modules/lark/notifier.go +++ b/internal/modules/lark/notifier.go @@ -7,8 +7,8 @@ import ( "unicode/utf8" larkcard "github.com/larksuite/oapi-sdk-go/v3/card" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/modules" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/modules" ) // https://open.larksuite.com/document/uAjLw4CM/ukTMukTMukTM/reference/im-v1/message/create#:~:text=The%20maximum%20size%20of%20the,request%20body%20is%20150%20KB. diff --git a/internal/modules/notifier.go b/internal/modules/notifier.go index 93ccc7b..b4a9a77 100644 --- a/internal/modules/notifier.go +++ b/internal/modules/notifier.go @@ -1,6 +1,6 @@ package modules -import "github.com/russtone/sonar/internal/database/models" +import "github.com/nt0xa/sonar/internal/database/models" type Notification struct { User *models.User diff --git a/internal/modules/telegram/notifier.go b/internal/modules/telegram/notifier.go index df6ec2e..7a0ebc2 100644 --- a/internal/modules/telegram/notifier.go +++ b/internal/modules/telegram/notifier.go @@ -4,8 +4,8 @@ import ( "fmt" "unicode/utf8" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/modules" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/modules" ) const maxMessageSize = 4096 diff --git a/internal/modules/telegram/telegram.go b/internal/modules/telegram/telegram.go index 953f219..ed7b937 100644 --- a/internal/modules/telegram/telegram.go +++ b/internal/modules/telegram/telegram.go @@ -9,13 +9,13 @@ import ( tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5" "github.com/spf13/cobra" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/actionsdb" - "github.com/russtone/sonar/internal/cmd" - "github.com/russtone/sonar/internal/database" - "github.com/russtone/sonar/internal/database/models" - "github.com/russtone/sonar/internal/templates" - "github.com/russtone/sonar/internal/utils/errors" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actionsdb" + "github.com/nt0xa/sonar/internal/cmd" + "github.com/nt0xa/sonar/internal/database" + "github.com/nt0xa/sonar/internal/database/models" + "github.com/nt0xa/sonar/internal/templates" + "github.com/nt0xa/sonar/internal/utils/errors" ) type Telegram struct { diff --git a/internal/templates/content.go b/internal/templates/content.go index 5b62c23..485d7bf 100644 --- a/internal/templates/content.go +++ b/internal/templates/content.go @@ -3,7 +3,7 @@ package templates import ( "fmt" - "github.com/russtone/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/actions" ) var templatesMap = map[string]string{ @@ -129,6 +129,23 @@ const ( ) var notificationHeader = `[{{ .Payload.Name }}] {{ .Event.Protocol.String | upper }} from {{ .Event.RemoteAddr }} {{ .Event.ReceivedAt.Format "on 02 Jan 2006 at 15:04:05 MST" }}` -var notificationBody = `
+var notificationBody = `
+{{- if eq .Event.Protocol.String "http" -}}
+Request:
+

+{{ printf "%s" .Event.R }}
+
+ +Response: +

+{{ printf "%s" .Event.W }}
+
+{{- else if eq .Event.Protocol.String "dns" -}} +

 {{ printf "%s" .Event.RW }}
-
` +
+{{- else -}} +

+{{ printf "%s" .Event.RW }}
+
+{{- end -}}` diff --git a/internal/templates/templates.go b/internal/templates/templates.go index 835f16b..49b4922 100644 --- a/internal/templates/templates.go +++ b/internal/templates/templates.go @@ -11,8 +11,8 @@ import ( "github.com/Masterminds/sprig/v3" - "github.com/russtone/sonar/internal/actions" - "github.com/russtone/sonar/internal/modules" + "github.com/nt0xa/sonar/internal/actions" + "github.com/nt0xa/sonar/internal/modules" ) type Templates struct { diff --git a/pkg/certmgr/certmgr.go b/pkg/certmgr/certmgr.go index 6130eb0..5f7679f 100644 --- a/pkg/certmgr/certmgr.go +++ b/pkg/certmgr/certmgr.go @@ -13,7 +13,7 @@ import ( "github.com/go-acme/lego/v3/log" "github.com/go-acme/lego/v3/registration" - "github.com/russtone/sonar/pkg/certstorage" + "github.com/nt0xa/sonar/pkg/certstorage" ) type CertMgr struct { diff --git a/pkg/certmgr/certmgr_test.go b/pkg/certmgr/certmgr_test.go index e2e528b..3e72722 100644 --- a/pkg/certmgr/certmgr_test.go +++ b/pkg/certmgr/certmgr_test.go @@ -11,8 +11,8 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/pkg/certmgr" - "github.com/russtone/sonar/pkg/certstorage" + "github.com/nt0xa/sonar/pkg/certmgr" + "github.com/nt0xa/sonar/pkg/certstorage" ) var ( diff --git a/pkg/certmgr/utils.go b/pkg/certmgr/utils.go index d429119..0ca5edf 100644 --- a/pkg/certmgr/utils.go +++ b/pkg/certmgr/utils.go @@ -9,7 +9,7 @@ import ( "github.com/go-acme/lego/v3/lego" "github.com/go-acme/lego/v3/registration" - "github.com/russtone/sonar/pkg/certstorage" + "github.com/nt0xa/sonar/pkg/certstorage" ) func newAccount(email string, keyType certcrypto.KeyType) (*certstorage.Account, error) { diff --git a/pkg/certstorage/account_test.go b/pkg/certstorage/account_test.go index 2d879c2..e16cf55 100644 --- a/pkg/certstorage/account_test.go +++ b/pkg/certstorage/account_test.go @@ -8,7 +8,7 @@ import ( "github.com/go-acme/lego/v3/registration" "github.com/stretchr/testify/assert" - "github.com/russtone/sonar/pkg/certstorage" + "github.com/nt0xa/sonar/pkg/certstorage" ) func Test_Account(t *testing.T) { diff --git a/pkg/certstorage/storage_test.go b/pkg/certstorage/storage_test.go index e2e876a..0f68ba5 100644 --- a/pkg/certstorage/storage_test.go +++ b/pkg/certstorage/storage_test.go @@ -20,7 +20,7 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/pkg/certstorage" + "github.com/nt0xa/sonar/pkg/certstorage" ) func setup(t *testing.T) { diff --git a/pkg/dnsx/dnsx_test.go b/pkg/dnsx/dnsx_test.go index 0e36c76..f44926a 100644 --- a/pkg/dnsx/dnsx_test.go +++ b/pkg/dnsx/dnsx_test.go @@ -14,7 +14,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/pkg/dnsx" + "github.com/nt0xa/sonar/pkg/dnsx" ) var ( diff --git a/pkg/dnsx/utils_test.go b/pkg/dnsx/utils_test.go index af855ab..08832bc 100644 --- a/pkg/dnsx/utils_test.go +++ b/pkg/dnsx/utils_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/miekg/dns" - "github.com/russtone/sonar/pkg/dnsx" + "github.com/nt0xa/sonar/pkg/dnsx" "github.com/stretchr/testify/assert" ) diff --git a/pkg/ftpx/ftpx.go b/pkg/ftpx/ftpx.go index 9a6353d..65f0bb5 100644 --- a/pkg/ftpx/ftpx.go +++ b/pkg/ftpx/ftpx.go @@ -4,7 +4,7 @@ import ( "context" "net" - "github.com/russtone/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/netx" ) type Server struct { diff --git a/pkg/ftpx/ftpx_test.go b/pkg/ftpx/ftpx_test.go index fa620b4..f7453ce 100644 --- a/pkg/ftpx/ftpx_test.go +++ b/pkg/ftpx/ftpx_test.go @@ -10,8 +10,8 @@ import ( "testing" "time" - "github.com/russtone/sonar/pkg/ftpx" - "github.com/russtone/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/ftpx" + "github.com/nt0xa/sonar/pkg/netx" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" ) diff --git a/pkg/ftpx/session.go b/pkg/ftpx/session.go index f536656..5315b7a 100644 --- a/pkg/ftpx/session.go +++ b/pkg/ftpx/session.go @@ -10,7 +10,7 @@ import ( "strings" "time" - "github.com/russtone/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/netx" ) var ( diff --git a/pkg/httpx/handlers.go b/pkg/httpx/handlers.go index 009953f..3ecec8a 100644 --- a/pkg/httpx/handlers.go +++ b/pkg/httpx/handlers.go @@ -10,7 +10,7 @@ import ( "net/http/httptest" "time" - "github.com/russtone/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/netx" ) // Response represents simplified version of HTTP response. diff --git a/pkg/httpx/httpx.go b/pkg/httpx/httpx.go index 028aa4b..504dc30 100644 --- a/pkg/httpx/httpx.go +++ b/pkg/httpx/httpx.go @@ -7,7 +7,7 @@ import ( "net/http" "time" - "github.com/russtone/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/netx" ) type Server interface { diff --git a/pkg/httpx/httpx_test.go b/pkg/httpx/httpx_test.go index 0c9c487..f87b54f 100644 --- a/pkg/httpx/httpx_test.go +++ b/pkg/httpx/httpx_test.go @@ -22,7 +22,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/pkg/httpx" + "github.com/nt0xa/sonar/pkg/httpx" ) var ( diff --git a/pkg/smtpx/session.go b/pkg/smtpx/session.go index 3389a82..d210ff8 100644 --- a/pkg/smtpx/session.go +++ b/pkg/smtpx/session.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "github.com/russtone/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/netx" ) // SMTP session states. diff --git a/pkg/smtpx/smtpx.go b/pkg/smtpx/smtpx.go index f2bdd77..a35a489 100644 --- a/pkg/smtpx/smtpx.go +++ b/pkg/smtpx/smtpx.go @@ -5,7 +5,7 @@ import ( "crypto/tls" "net" - "github.com/russtone/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/netx" ) type Server struct { diff --git a/pkg/smtpx/smtpx_test.go b/pkg/smtpx/smtpx_test.go index d67bb6a..36a941d 100644 --- a/pkg/smtpx/smtpx_test.go +++ b/pkg/smtpx/smtpx_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/russtone/sonar/pkg/netx" - "github.com/russtone/sonar/pkg/smtpx" + "github.com/nt0xa/sonar/pkg/netx" + "github.com/nt0xa/sonar/pkg/smtpx" ) var ( diff --git a/server.toml b/server.toml new file mode 100644 index 0000000..21c1bc1 --- /dev/null +++ b/server.toml @@ -0,0 +1,6 @@ +ip = "127.0.0.1" +domain = "sonar.test" + +[db] +dsn = "postgres://db:db@localhost:5432/db_test?sslmode=disable" +migrations = "internal/database/migrations"