From 9affd2edf4f68a35a22b16b263ca717214f121a4 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Fri, 25 Jul 2025 10:58:30 -0400 Subject: [PATCH] chore: expose thoth in lib (#911) Imports a patch previously exclusive to Botstopper. Signed-off-by: Xe Iaso --- cmd/anubis/main.go | 2 +- docs/docs/CHANGELOG.md | 2 ++ lib/anubis_test.go | 2 +- lib/config_test.go | 2 +- lib/policy/policy.go | 2 +- lib/policy/policy_test.go | 2 +- {internal => lib}/thoth/asnchecker.go | 0 {internal => lib}/thoth/asnchecker_test.go | 2 +- {internal => lib}/thoth/auth.go | 0 {internal => lib}/thoth/cachediptoasn.go | 0 {internal => lib}/thoth/context.go | 0 {internal => lib}/thoth/geoipchecker.go | 0 {internal => lib}/thoth/geoipchecker_test.go | 2 +- {internal => lib}/thoth/thoth.go | 0 {internal => lib}/thoth/thoth_test.go | 4 ++-- {internal => lib}/thoth/thothmock/iptoasn.go | 0 {internal => lib}/thoth/thothmock/withthothmock.go | 2 +- 17 files changed, 12 insertions(+), 10 deletions(-) rename {internal => lib}/thoth/asnchecker.go (100%) rename {internal => lib}/thoth/asnchecker_test.go (97%) rename {internal => lib}/thoth/auth.go (100%) rename {internal => lib}/thoth/cachediptoasn.go (100%) rename {internal => lib}/thoth/context.go (100%) rename {internal => lib}/thoth/geoipchecker.go (100%) rename {internal => lib}/thoth/geoipchecker_test.go (96%) rename {internal => lib}/thoth/thoth.go (100%) rename {internal => lib}/thoth/thoth_test.go (84%) rename {internal => lib}/thoth/thothmock/iptoasn.go (100%) rename {internal => lib}/thoth/thothmock/withthothmock.go (84%) diff --git a/cmd/anubis/main.go b/cmd/anubis/main.go index 9eb2f54..cc8ebd1 100644 --- a/cmd/anubis/main.go +++ b/cmd/anubis/main.go @@ -30,10 +30,10 @@ import ( "github.com/TecharoHQ/anubis" "github.com/TecharoHQ/anubis/data" "github.com/TecharoHQ/anubis/internal" - "github.com/TecharoHQ/anubis/internal/thoth" libanubis "github.com/TecharoHQ/anubis/lib" botPolicy "github.com/TecharoHQ/anubis/lib/policy" "github.com/TecharoHQ/anubis/lib/policy/config" + "github.com/TecharoHQ/anubis/lib/thoth" "github.com/TecharoHQ/anubis/web" "github.com/facebookgo/flagenv" _ "github.com/joho/godotenv/autoload" diff --git a/docs/docs/CHANGELOG.md b/docs/docs/CHANGELOG.md index 1827fb9..bea36f1 100644 --- a/docs/docs/CHANGELOG.md +++ b/docs/docs/CHANGELOG.md @@ -13,6 +13,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +- The [Thoth client](https://anubis.techaro.lol/docs/admin/thoth) is now public in the repo instead of being an internal package. + ## v1.21.3: Minfilia Warde - Echo 3 ### Fixes diff --git a/lib/anubis_test.go b/lib/anubis_test.go index cc20352..d355fb1 100644 --- a/lib/anubis_test.go +++ b/lib/anubis_test.go @@ -17,9 +17,9 @@ import ( "github.com/TecharoHQ/anubis" "github.com/TecharoHQ/anubis/data" "github.com/TecharoHQ/anubis/internal" - "github.com/TecharoHQ/anubis/internal/thoth/thothmock" "github.com/TecharoHQ/anubis/lib/policy" "github.com/TecharoHQ/anubis/lib/policy/config" + "github.com/TecharoHQ/anubis/lib/thoth/thothmock" ) func init() { diff --git a/lib/config_test.go b/lib/config_test.go index 71cb734..af31ca6 100644 --- a/lib/config_test.go +++ b/lib/config_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/TecharoHQ/anubis" - "github.com/TecharoHQ/anubis/internal/thoth/thothmock" "github.com/TecharoHQ/anubis/lib/policy" + "github.com/TecharoHQ/anubis/lib/thoth/thothmock" ) func TestInvalidChallengeMethod(t *testing.T) { diff --git a/lib/policy/policy.go b/lib/policy/policy.go index 691036b..3dc3157 100644 --- a/lib/policy/policy.go +++ b/lib/policy/policy.go @@ -8,10 +8,10 @@ import ( "log/slog" "sync/atomic" - "github.com/TecharoHQ/anubis/internal/thoth" "github.com/TecharoHQ/anubis/lib/policy/checker" "github.com/TecharoHQ/anubis/lib/policy/config" "github.com/TecharoHQ/anubis/lib/store" + "github.com/TecharoHQ/anubis/lib/thoth" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" diff --git a/lib/policy/policy_test.go b/lib/policy/policy_test.go index 9ada1c9..9d64d5c 100644 --- a/lib/policy/policy_test.go +++ b/lib/policy/policy_test.go @@ -7,7 +7,7 @@ import ( "github.com/TecharoHQ/anubis" "github.com/TecharoHQ/anubis/data" - "github.com/TecharoHQ/anubis/internal/thoth/thothmock" + "github.com/TecharoHQ/anubis/lib/thoth/thothmock" ) func TestDefaultPolicyMustParse(t *testing.T) { diff --git a/internal/thoth/asnchecker.go b/lib/thoth/asnchecker.go similarity index 100% rename from internal/thoth/asnchecker.go rename to lib/thoth/asnchecker.go diff --git a/internal/thoth/asnchecker_test.go b/lib/thoth/asnchecker_test.go similarity index 97% rename from internal/thoth/asnchecker_test.go rename to lib/thoth/asnchecker_test.go index a80e815..787cdb4 100644 --- a/internal/thoth/asnchecker_test.go +++ b/lib/thoth/asnchecker_test.go @@ -5,8 +5,8 @@ import ( "net/http/httptest" "testing" - "github.com/TecharoHQ/anubis/internal/thoth" "github.com/TecharoHQ/anubis/lib/policy/checker" + "github.com/TecharoHQ/anubis/lib/thoth" iptoasnv1 "github.com/TecharoHQ/thoth-proto/gen/techaro/thoth/iptoasn/v1" ) diff --git a/internal/thoth/auth.go b/lib/thoth/auth.go similarity index 100% rename from internal/thoth/auth.go rename to lib/thoth/auth.go diff --git a/internal/thoth/cachediptoasn.go b/lib/thoth/cachediptoasn.go similarity index 100% rename from internal/thoth/cachediptoasn.go rename to lib/thoth/cachediptoasn.go diff --git a/internal/thoth/context.go b/lib/thoth/context.go similarity index 100% rename from internal/thoth/context.go rename to lib/thoth/context.go diff --git a/internal/thoth/geoipchecker.go b/lib/thoth/geoipchecker.go similarity index 100% rename from internal/thoth/geoipchecker.go rename to lib/thoth/geoipchecker.go diff --git a/internal/thoth/geoipchecker_test.go b/lib/thoth/geoipchecker_test.go similarity index 96% rename from internal/thoth/geoipchecker_test.go rename to lib/thoth/geoipchecker_test.go index 25b37b9..9826282 100644 --- a/internal/thoth/geoipchecker_test.go +++ b/lib/thoth/geoipchecker_test.go @@ -5,8 +5,8 @@ import ( "net/http/httptest" "testing" - "github.com/TecharoHQ/anubis/internal/thoth" "github.com/TecharoHQ/anubis/lib/policy/checker" + "github.com/TecharoHQ/anubis/lib/thoth" ) var _ checker.Impl = &thoth.GeoIPChecker{} diff --git a/internal/thoth/thoth.go b/lib/thoth/thoth.go similarity index 100% rename from internal/thoth/thoth.go rename to lib/thoth/thoth.go diff --git a/internal/thoth/thoth_test.go b/lib/thoth/thoth_test.go similarity index 84% rename from internal/thoth/thoth_test.go rename to lib/thoth/thoth_test.go index 437f984..7b2c4c6 100644 --- a/internal/thoth/thoth_test.go +++ b/lib/thoth/thoth_test.go @@ -4,8 +4,8 @@ import ( "os" "testing" - "github.com/TecharoHQ/anubis/internal/thoth" - "github.com/TecharoHQ/anubis/internal/thoth/thothmock" + "github.com/TecharoHQ/anubis/lib/thoth" + "github.com/TecharoHQ/anubis/lib/thoth/thothmock" "github.com/joho/godotenv" ) diff --git a/internal/thoth/thothmock/iptoasn.go b/lib/thoth/thothmock/iptoasn.go similarity index 100% rename from internal/thoth/thothmock/iptoasn.go rename to lib/thoth/thothmock/iptoasn.go diff --git a/internal/thoth/thothmock/withthothmock.go b/lib/thoth/thothmock/withthothmock.go similarity index 84% rename from internal/thoth/thothmock/withthothmock.go rename to lib/thoth/thothmock/withthothmock.go index 9565007..c4d07fd 100644 --- a/internal/thoth/thothmock/withthothmock.go +++ b/lib/thoth/thothmock/withthothmock.go @@ -4,7 +4,7 @@ import ( "context" "testing" - "github.com/TecharoHQ/anubis/internal/thoth" + "github.com/TecharoHQ/anubis/lib/thoth" ) func WithMockThoth(t *testing.T) context.Context {