From 10e1ffda9e96450dbb3a00b19a1d15ed7d5a05e2 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 21 Sep 2026 15:20:57 +0000 Subject: [PATCH 1/3] deps: upgrade httpcache-kit v4, logger-kit v3, metrics-kit v3 These three move together because httpcache-kit's API takes logger-kit and metrics-kit types directly, and the module path is part of a type's identity: SetLogger/HandlerOptions.Logger want a *logger.Logger and the cache metrics constructor a *metrics.Registry, so a v2 value cannot satisfy a v3/v4 parameter. Splitting the bump across commits would not compile. - github.com/soulteary/httpcache-kit/v2 v2.5.0 -> /v4 v4.0.0 - github.com/soulteary/logger-kit/v2 v2.3.0 -> /v3 v3.0.0 - github.com/soulteary/metrics-kit/v2 v2.2.0 -> /v3 v3.0.0 Code migrations beyond the import paths: - httpcache v4 moved the Prometheus recorder into the prometheusmetrics subpackage so the root package stops linking client_golang, so httpcache.NewCacheMetrics(reg) becomes prometheusmetrics.New(reg). New still installs itself as httpcache's default recorder, so the return value stays discarded and the apt_proxy_cache_* series are unchanged. - httpcache.GetDefaultMetrics() now returns the Metrics interface and never nil (unset is NopMetrics), so the nil guard in the cache stats API would have been a nil-interface panic waiting to happen. Call UpdateCacheStats(stats) unconditionally. - logger-kit v3 dropped the fiber.Ctx-typed hooks from the root MiddlewareConfig, which is what kept Fiber out of the root package. MiddlewareConfig.CustomFieldsFiber becomes CustomFields on fiberadapter.Config, which embeds the root config; the closure itself is unchanged, so the access log keeps its cache and size fields. Logger, SkipPaths and the Debug-only IncludeHeaders/IncludeBody still come from logger.DefaultMiddlewareConfig(). - metrics-kit v3 keeps NewRegistry and HandlerFor in the root package, so /metrics only needed the import path. go build ./..., go vet ./... (also with -tags=integration) and go test ./... all pass. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01S41m6kbkBFMd6tGe7eAxC5 --- go.mod | 10 +++--- go.sum | 16 ++++----- internal/api/auth.go | 2 +- internal/api/cache.go | 10 +++--- internal/api/cache_test.go | 4 +-- internal/api/mirrors.go | 2 +- internal/api/mirrors_test.go | 2 +- internal/api/ratelimit.go | 2 +- internal/api/ratelimit_test.go | 2 +- internal/benchmarks/benchmark.go | 2 +- internal/cli/daemon.go | 42 +++++++++++++---------- internal/cli/daemon_internal_test.go | 2 +- internal/config/loader.go | 2 +- internal/proxy/cachekey_test.go | 4 +-- internal/proxy/custom_distro_test.go | 2 +- internal/proxy/custom_distro_yaml_test.go | 2 +- internal/proxy/edges_test.go | 2 +- internal/proxy/handler.go | 2 +- internal/proxy/handler_test.go | 2 +- internal/proxy/host_routing_test.go | 2 +- internal/proxy/hostprefix_test.go | 2 +- internal/proxy/passthrough_test.go | 2 +- internal/proxy/rewriter.go | 2 +- internal/proxy/routing_refresh_test.go | 2 +- internal/proxy/tls_marker_test.go | 2 +- internal/state/app.go | 2 +- tests/integration/helpers.go | 4 +-- tests/integration/s3_storage_test.go | 2 +- 28 files changed, 69 insertions(+), 63 deletions(-) diff --git a/go.mod b/go.mod index d70bf777..eeedc519 100644 --- a/go.mod +++ b/go.mod @@ -9,14 +9,15 @@ require ( github.com/soulteary/cli-kit v1.9.0 github.com/soulteary/health-kit/v2 v2.3.0 github.com/soulteary/http-kit v1.5.0 - github.com/soulteary/httpcache-kit/v2 v2.5.0 - github.com/soulteary/logger-kit/v2 v2.3.0 - github.com/soulteary/metrics-kit/v2 v2.2.0 + github.com/soulteary/httpcache-kit/v4 v4.0.0 + github.com/soulteary/logger-kit/v3 v3.0.0 + github.com/soulteary/metrics-kit/v3 v3.0.0 github.com/soulteary/middleware-kit/v2 v2.2.0 github.com/soulteary/tracing-kit v1.5.0 github.com/soulteary/version-kit/v2 v2.2.0 github.com/soulteary/vfs-kit v1.4.2 go.opentelemetry.io/otel v1.46.0 + go.opentelemetry.io/otel/trace v1.46.0 golang.org/x/sync v0.23.0 golang.org/x/sys v0.48.0 gopkg.in/yaml.v3 v3.0.1 @@ -41,7 +42,7 @@ require ( github.com/mattn/go-isatty v0.0.24 // indirect github.com/minio/crc64nvme v1.1.1 // indirect github.com/minio/md5-simd v1.1.2 // indirect - github.com/molecule-man/go-brrr v1.1.0 // indirect + github.com/molecule-man/go-brrr v1.1.1 // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/philhofer/fwd v1.2.0 // indirect github.com/prometheus/client_golang v1.24.1 // indirect @@ -61,7 +62,6 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.46.0 // indirect go.opentelemetry.io/otel/metric v1.46.0 // indirect go.opentelemetry.io/otel/sdk v1.46.0 // indirect - go.opentelemetry.io/otel/trace v1.46.0 // indirect go.opentelemetry.io/proto/otlp v1.11.0 // indirect go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v3 v3.0.5 // indirect diff --git a/go.sum b/go.sum index b3f84d3b..aa13014c 100644 --- a/go.sum +++ b/go.sum @@ -61,8 +61,8 @@ github.com/minio/md5-simd v1.1.2 h1:Gdi1DZK69+ZVMoNHRXJyNcxrMA4dSxoYHZSQbirFg34= github.com/minio/md5-simd v1.1.2/go.mod h1:MzdKDxYpY2BT9XQFocsiZf/NKVtR7nkE4RoEpN+20RM= github.com/minio/minio-go/v7 v7.3.0 h1:HM4pFCSQq/TK+j0/zmorSh5ddh81iDgRgU0BG0Vz/YU= github.com/minio/minio-go/v7 v7.3.0/go.mod h1:KUPWdecEO1LWyUz+sTGXAuf2jZHrPh5fCsRH86QbPfk= -github.com/molecule-man/go-brrr v1.1.0 h1:rLBGSXA393y+5ttCBLkW34CHESop5tahrOFxVv/XDEU= -github.com/molecule-man/go-brrr v1.1.0/go.mod h1:7ybW6/7gA3oKY45jOfVNjSJDtrr6ea4tzbsTkjmQDC4= +github.com/molecule-man/go-brrr v1.1.1 h1:KYwusQhjtV3smALnhmafZf4OBrh7vP4p8O47DyUmmuY= +github.com/molecule-man/go-brrr v1.1.1/go.mod h1:7ybW6/7gA3oKY45jOfVNjSJDtrr6ea4tzbsTkjmQDC4= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/ncruces/go-strftime v1.0.0 h1:HMFp8mLCTPp341M/ZnA4qaf7ZlsbTc+miZjCLOFAw7w= @@ -96,12 +96,12 @@ github.com/soulteary/health-kit/v2 v2.3.0 h1:T+r27bDGfae4jvp7cIZfeRDuL9zJ/ggcpBt github.com/soulteary/health-kit/v2 v2.3.0/go.mod h1:D5V1lHUxA4ITVUpfH3/KFhWzonfdA3pu7329FmaUSdk= github.com/soulteary/http-kit v1.5.0 h1:VCvsCjsLEgcg0x/cfbhQyo+KdzCL28+3PqVCrR8h+so= github.com/soulteary/http-kit v1.5.0/go.mod h1:WoOxPjfMZrj0IYEn/Lagb3vGt9eFlsPXutwRufckOpA= -github.com/soulteary/httpcache-kit/v2 v2.5.0 h1:WQDHdBEf1IV70SLmVaerzEgSEGB6s+Ky/wK6JJHiT8E= -github.com/soulteary/httpcache-kit/v2 v2.5.0/go.mod h1:Sx1yAa8xBcqUx/zlxwaOTyJqIZpyX9IBhZVbPekF1yI= -github.com/soulteary/logger-kit/v2 v2.3.0 h1:+IkF+nhWairMvml85z/j1ZUzXwnmSIar/+v6HEc3oR0= -github.com/soulteary/logger-kit/v2 v2.3.0/go.mod h1:VuJlc2dVwYO/S2srwi6h+Sa4xFJAqYRDlFTdz4aba1Q= -github.com/soulteary/metrics-kit/v2 v2.2.0 h1:8f5piQINovf+oS9qOx7JU0kpJStMXhFIDUCTuVSTr5E= -github.com/soulteary/metrics-kit/v2 v2.2.0/go.mod h1:PCRkE0kCzAWcn+97meP8AhK6ckA8xqt09X3ifPARuaI= +github.com/soulteary/httpcache-kit/v4 v4.0.0 h1:dxBKDkkQnymd9H5eefiYx27zh3WdSWtlCJqyMNbbvXk= +github.com/soulteary/httpcache-kit/v4 v4.0.0/go.mod h1:Afhk8y8nkcM6PbtMJrmlzrUBt4ff6UDxXpj/Z2/2wjo= +github.com/soulteary/logger-kit/v3 v3.0.0 h1:oCsNss5cRgMJD5Ub5mjWjgFmtvExlqilSPuz/cIu8AE= +github.com/soulteary/logger-kit/v3 v3.0.0/go.mod h1:zAV0BXZ42KFp5yXL6MMFtXg6O0xzxENx5VEW3/BKwEQ= +github.com/soulteary/metrics-kit/v3 v3.0.0 h1:1KBslddLh5Qv9+pi06Py/SoM59Cbm2FiRDDsioGOJU8= +github.com/soulteary/metrics-kit/v3 v3.0.0/go.mod h1:hugXfHjLJUSqNTjF6UUueEdO7KZEz7rzQOMHUvNd3hM= github.com/soulteary/middleware-kit/v2 v2.2.0 h1:kE1ov3bFE/sT34f2z5OMkXhk5mZlfNtlwzm6pqy4eZo= github.com/soulteary/middleware-kit/v2 v2.2.0/go.mod h1:+4Z+6aCRCPWCFdSjodxOA6ISnuqBkT5/vE1birjVCOE= github.com/soulteary/tracing-kit v1.5.0 h1:p01bQ0n0SJjIsT2LWk62b9w4feZ8kF87GTC3LhBti8M= diff --git a/internal/api/auth.go b/internal/api/auth.go index 324a9439..ef73ccea 100644 --- a/internal/api/auth.go +++ b/internal/api/auth.go @@ -21,7 +21,7 @@ import ( "net/http" "strings" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" apperrors "github.com/soulteary/apt-proxy/internal/errors" ) diff --git a/internal/api/cache.go b/internal/api/cache.go index 4d6638fa..820804a4 100644 --- a/internal/api/cache.go +++ b/internal/api/cache.go @@ -17,10 +17,10 @@ package api import ( "net/http" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" apperrors "github.com/soulteary/apt-proxy/internal/errors" - httpcache "github.com/soulteary/httpcache-kit/v2" + httpcache "github.com/soulteary/httpcache-kit/v4" ) // CacheHandler handles cache-related API endpoints @@ -46,9 +46,9 @@ func (h *CacheHandler) HandleCacheStats(w http.ResponseWriter, r *http.Request) stats := h.cache.Stats() - if metrics := httpcache.GetDefaultMetrics(); metrics != nil { - metrics.UpdateCacheStats(stats) - } + // httpcache v4 always returns a recorder (NopMetrics when unset), so the + // old nil guard would now be a nil-interface panic waiting to happen. + httpcache.GetDefaultMetrics().UpdateCacheStats(stats) resp := CacheStatsResponse{ TotalSizeBytes: stats.TotalSize, diff --git a/internal/api/cache_test.go b/internal/api/cache_test.go index a6669bd1..a5990408 100644 --- a/internal/api/cache_test.go +++ b/internal/api/cache_test.go @@ -22,8 +22,8 @@ import ( "testing" "time" - httpcache "github.com/soulteary/httpcache-kit/v2" - logger "github.com/soulteary/logger-kit/v2" + httpcache "github.com/soulteary/httpcache-kit/v4" + logger "github.com/soulteary/logger-kit/v3" ) // fakeCache is a lightweight in-memory ExtendedCache stub. It implements only diff --git a/internal/api/mirrors.go b/internal/api/mirrors.go index e248b046..e3100e85 100644 --- a/internal/api/mirrors.go +++ b/internal/api/mirrors.go @@ -18,7 +18,7 @@ import ( "net/http" "time" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" apperrors "github.com/soulteary/apt-proxy/internal/errors" ) diff --git a/internal/api/mirrors_test.go b/internal/api/mirrors_test.go index 3a7f74d2..b04018cf 100644 --- a/internal/api/mirrors_test.go +++ b/internal/api/mirrors_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" ) func newTestMirrorsHandler(reload func()) *MirrorsHandler { diff --git a/internal/api/ratelimit.go b/internal/api/ratelimit.go index 20e4d5dd..9c9f9a4a 100644 --- a/internal/api/ratelimit.go +++ b/internal/api/ratelimit.go @@ -22,7 +22,7 @@ import ( "sync" "time" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" apperrors "github.com/soulteary/apt-proxy/internal/errors" ) diff --git a/internal/api/ratelimit_test.go b/internal/api/ratelimit_test.go index 091f7d69..136e98e8 100644 --- a/internal/api/ratelimit_test.go +++ b/internal/api/ratelimit_test.go @@ -20,7 +20,7 @@ import ( "net/http/httptest" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" ) func newTestLogger() *logger.Logger { diff --git a/internal/benchmarks/benchmark.go b/internal/benchmarks/benchmark.go index 6f9cad8a..ab73acc3 100644 --- a/internal/benchmarks/benchmark.go +++ b/internal/benchmarks/benchmark.go @@ -24,7 +24,7 @@ import ( "sync" "time" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "golang.org/x/sync/singleflight" ) diff --git a/internal/cli/daemon.go b/internal/cli/daemon.go index 20786c9f..94a3f3f3 100644 --- a/internal/cli/daemon.go +++ b/internal/cli/daemon.go @@ -30,8 +30,9 @@ import ( "github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3/middleware/adaptor" health "github.com/soulteary/health-kit/v2" - logger "github.com/soulteary/logger-kit/v2" - metrics "github.com/soulteary/metrics-kit/v2" + logger "github.com/soulteary/logger-kit/v3" + loggerfiber "github.com/soulteary/logger-kit/v3/fiberadapter" + metrics "github.com/soulteary/metrics-kit/v3" middleware "github.com/soulteary/middleware-kit/v2" tracing "github.com/soulteary/tracing-kit" version "github.com/soulteary/version-kit/v2" @@ -44,7 +45,8 @@ import ( "github.com/soulteary/apt-proxy/internal/proxy" "github.com/soulteary/apt-proxy/internal/state" "github.com/soulteary/apt-proxy/internal/storage/s3vfs" - httpcache "github.com/soulteary/httpcache-kit/v2" + httpcache "github.com/soulteary/httpcache-kit/v4" + prometheusmetrics "github.com/soulteary/httpcache-kit/v4/prometheusmetrics" vfs "github.com/soulteary/vfs-kit" ) @@ -190,7 +192,7 @@ func (s *Server) initialize() error { s.metricsRegistry = metrics.NewRegistry("apt_proxy") // Initialize cache metrics - httpcache.NewCacheMetrics(s.metricsRegistry) + prometheusmetrics.New(s.metricsRegistry) // Initialize health check aggregator s.initHealthChecks() @@ -424,7 +426,9 @@ func (s *Server) createFiberApp() *fiber.App { // Security headers app.Use(middleware.SecurityHeaders(middleware.DefaultSecurityHeadersConfig())) - // Request logging: logger-kit FiberMiddleware, unified with request_id and cache/size for proxy + // Request logging: logger-kit fiberadapter middleware, unified with request_id and cache/size for proxy. + // The fiber.Ctx-typed hooks live on loggerfiber.Config since logger-kit v3 + // dropped them from the root MiddlewareConfig. logCfg := logger.DefaultMiddlewareConfig() logCfg.Logger = s.log logCfg.SkipPaths = []string{"/healthz", "/livez", "/readyz"} // skip health noise @@ -432,19 +436,21 @@ func (s *Server) createFiberApp() *fiber.App { logCfg.IncludeHeaders = true logCfg.IncludeBody = true } - logCfg.CustomFieldsFiber = func(c fiber.Ctx) map[string]interface{} { - // Use Content-Length header when available so we don't pull the - // (potentially streamed) body into memory just to record its size. - size := c.Response().Header.ContentLength() - if size <= 0 { - size = len(c.Response().Body()) - } - return map[string]interface{}{ - "cache": cacheLabelFromHeader(string(c.Response().Header.Peek("X-Cache"))), - "size": size, - } - } - app.Use(logger.FiberMiddleware(logCfg)) + app.Use(loggerfiber.Middleware(loggerfiber.Config{ + MiddlewareConfig: logCfg, + CustomFields: func(c fiber.Ctx) map[string]interface{} { + // Use Content-Length header when available so we don't pull the + // (potentially streamed) body into memory just to record its size. + size := c.Response().Header.ContentLength() + if size <= 0 { + size = len(c.Response().Body()) + } + return map[string]interface{}{ + "cache": cacheLabelFromHeader(string(c.Response().Header.Peek("X-Cache"))), + "size": size, + } + }, + })) // Health check endpoints (Fiber native) // We deliberately use a local handler instead of health.FiberHandler / diff --git a/internal/cli/daemon_internal_test.go b/internal/cli/daemon_internal_test.go index 7618eac3..307d57a6 100644 --- a/internal/cli/daemon_internal_test.go +++ b/internal/cli/daemon_internal_test.go @@ -17,7 +17,7 @@ package cli import ( "testing" - httpcache "github.com/soulteary/httpcache-kit/v2" + httpcache "github.com/soulteary/httpcache-kit/v4" "github.com/soulteary/apt-proxy/internal/config" ) diff --git a/internal/config/loader.go b/internal/config/loader.go index a29d1ae3..a4a31f9e 100644 --- a/internal/config/loader.go +++ b/internal/config/loader.go @@ -26,7 +26,7 @@ import ( "github.com/soulteary/apt-proxy/internal/distro" "github.com/soulteary/apt-proxy/internal/mirrors" "github.com/soulteary/cli-kit/configutil" - httpcache "github.com/soulteary/httpcache-kit/v2" + httpcache "github.com/soulteary/httpcache-kit/v4" ) // ParseFlags parses command-line flags and returns a Config struct with all diff --git a/internal/proxy/cachekey_test.go b/internal/proxy/cachekey_test.go index 685fd435..406c7730 100644 --- a/internal/proxy/cachekey_test.go +++ b/internal/proxy/cachekey_test.go @@ -22,8 +22,8 @@ import ( "testing" "time" - httpcache "github.com/soulteary/httpcache-kit/v2" - logger "github.com/soulteary/logger-kit/v2" + httpcache "github.com/soulteary/httpcache-kit/v4" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" ) diff --git a/internal/proxy/custom_distro_test.go b/internal/proxy/custom_distro_test.go index d6f6b5e3..783230a9 100644 --- a/internal/proxy/custom_distro_test.go +++ b/internal/proxy/custom_distro_test.go @@ -21,7 +21,7 @@ import ( "strings" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" ) diff --git a/internal/proxy/custom_distro_yaml_test.go b/internal/proxy/custom_distro_yaml_test.go index e7a65285..31765b75 100644 --- a/internal/proxy/custom_distro_yaml_test.go +++ b/internal/proxy/custom_distro_yaml_test.go @@ -22,7 +22,7 @@ import ( "path/filepath" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" ) diff --git a/internal/proxy/edges_test.go b/internal/proxy/edges_test.go index 706012d3..daa2da12 100644 --- a/internal/proxy/edges_test.go +++ b/internal/proxy/edges_test.go @@ -26,7 +26,7 @@ import ( "strings" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" ) diff --git a/internal/proxy/handler.go b/internal/proxy/handler.go index 6aca9959..ed3416c6 100644 --- a/internal/proxy/handler.go +++ b/internal/proxy/handler.go @@ -28,7 +28,7 @@ import ( "sync/atomic" "time" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" tracing "github.com/soulteary/tracing-kit" "github.com/soulteary/apt-proxy/internal/benchmarks" diff --git a/internal/proxy/handler_test.go b/internal/proxy/handler_test.go index db25add7..baa9bbe9 100644 --- a/internal/proxy/handler_test.go +++ b/internal/proxy/handler_test.go @@ -20,7 +20,7 @@ import ( "os" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" "github.com/soulteary/apt-proxy/internal/state" diff --git a/internal/proxy/host_routing_test.go b/internal/proxy/host_routing_test.go index f1d75d7d..c22d85da 100644 --- a/internal/proxy/host_routing_test.go +++ b/internal/proxy/host_routing_test.go @@ -20,7 +20,7 @@ import ( "net/url" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" ) diff --git a/internal/proxy/hostprefix_test.go b/internal/proxy/hostprefix_test.go index ad6a09f1..1830fb10 100644 --- a/internal/proxy/hostprefix_test.go +++ b/internal/proxy/hostprefix_test.go @@ -20,7 +20,7 @@ import ( "net/url" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" ) diff --git a/internal/proxy/passthrough_test.go b/internal/proxy/passthrough_test.go index faa2a16e..aad67579 100644 --- a/internal/proxy/passthrough_test.go +++ b/internal/proxy/passthrough_test.go @@ -22,7 +22,7 @@ import ( "strings" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" "github.com/soulteary/apt-proxy/internal/passthrough" diff --git a/internal/proxy/rewriter.go b/internal/proxy/rewriter.go index 2d23604b..579fdb67 100644 --- a/internal/proxy/rewriter.go +++ b/internal/proxy/rewriter.go @@ -24,7 +24,7 @@ import ( "strings" "sync" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/benchmarks" "github.com/soulteary/apt-proxy/internal/distro" diff --git a/internal/proxy/routing_refresh_test.go b/internal/proxy/routing_refresh_test.go index fa76a357..509084a9 100644 --- a/internal/proxy/routing_refresh_test.go +++ b/internal/proxy/routing_refresh_test.go @@ -20,7 +20,7 @@ import ( "sync" "testing" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" ) diff --git a/internal/proxy/tls_marker_test.go b/internal/proxy/tls_marker_test.go index 08463947..0ead7a95 100644 --- a/internal/proxy/tls_marker_test.go +++ b/internal/proxy/tls_marker_test.go @@ -22,7 +22,7 @@ import ( "github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3/middleware/adaptor" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" ) diff --git a/internal/state/app.go b/internal/state/app.go index 009faf52..a0f3f423 100644 --- a/internal/state/app.go +++ b/internal/state/app.go @@ -25,7 +25,7 @@ import ( "net/url" "sync/atomic" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/distro" mirrors "github.com/soulteary/apt-proxy/internal/mirrors" diff --git a/tests/integration/helpers.go b/tests/integration/helpers.go index b2a4d5d6..dd768807 100644 --- a/tests/integration/helpers.go +++ b/tests/integration/helpers.go @@ -26,13 +26,13 @@ import ( "testing" "time" - logger "github.com/soulteary/logger-kit/v2" + logger "github.com/soulteary/logger-kit/v3" "github.com/soulteary/apt-proxy/internal/api" "github.com/soulteary/apt-proxy/internal/distro" "github.com/soulteary/apt-proxy/internal/proxy" "github.com/soulteary/apt-proxy/internal/state" - httpcache "github.com/soulteary/httpcache-kit/v2" + httpcache "github.com/soulteary/httpcache-kit/v4" ) // sharedTestLogger reuses one logger across newTestServer calls. diff --git a/tests/integration/s3_storage_test.go b/tests/integration/s3_storage_test.go index 179bc624..be9b4d9e 100644 --- a/tests/integration/s3_storage_test.go +++ b/tests/integration/s3_storage_test.go @@ -41,7 +41,7 @@ import ( "github.com/minio/minio-go/v7/pkg/credentials" "github.com/soulteary/apt-proxy/internal/storage/s3vfs" - httpcache "github.com/soulteary/httpcache-kit/v2" + httpcache "github.com/soulteary/httpcache-kit/v4" ) // s3TestEnv collects the S3-compatible service connection details. We check From 9c621b4683f100ee72876741fe911049e032c611 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 21 Sep 2026 15:24:27 +0000 Subject: [PATCH 2/3] deps: upgrade health-kit v4, middleware-kit v3, version-kit v4 - github.com/soulteary/health-kit/v2 v2.3.0 -> /v4 v4.0.0 - github.com/soulteary/middleware-kit/v2 v2.2.0 -> /v3 v3.0.0 - github.com/soulteary/version-kit/v2 v2.2.0 -> /v4 v4.0.0 All three moved their Fiber support into a fiberadapter subpackage so their root packages stop linking Fiber and fasthttp. The configuration types stayed in the root packages, so only the handler and middleware constructors move: - health.FiberLivenessHandler("apt-proxy") -> healthfiber.LivenessHandler. /healthz and /readyz keep the local fiberHealthHandler; the race with fasthttp's graceful shutdown that it exists to avoid is unchanged, so the kit's own aggregator handlers are still not what we want. The comments naming them are updated to the new symbol names. - middleware.SecurityHeaders -> mwfiber.SecurityHeaders, with middleware.DefaultSecurityHeadersConfig() still coming from the root package. The response headers are the same four. - version.FiberMiddleware -> versionfiber.Middleware and version.FiberHandler -> versionfiber.Handler, both still reading version.HandlerConfig / version.Info from the root package. The -X ldflags in the Makefile inject main.version / main.commit / main.date, not version-kit package variables, so the silent-"dev" trap in version-kit's upgrade notes does not apply here. Two documented behaviour changes on /version, both from version-kit's Fiber adapter and both confirmed against a pre-upgrade build: - Pretty now works. fiber.Ctx.JSON always wrote compact JSON, so the Pretty: true this endpoint has always been configured with was silently ignored; the body is now indented ({"version":"dev"} -> 22 bytes over 3 lines). - Content-Type is application/json instead of application/json; charset=utf-8, matching the net/http handler (RFC 8259 defines no charset parameter). The X- version headers, /livez, /healthz, /readyz and the security headers are byte-identical to the pre-upgrade build. health-kit v4 also moved its Redis probe to a redisprobe subpackage; apt-proxy does not use it. go build ./..., go vet ./... (also with -tags=integration) and go test ./... all pass. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01S41m6kbkBFMd6tGe7eAxC5 --- go.mod | 11 +++++------ go.sum | 36 ++++++++++++------------------------ internal/cli/daemon.go | 21 ++++++++++++--------- internal/cli/health.go | 4 ++-- internal/cli/health_test.go | 2 +- 5 files changed, 32 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index eeedc519..0af13bfe 100644 --- a/go.mod +++ b/go.mod @@ -7,14 +7,14 @@ require ( github.com/hashicorp/golang-lru/v2 v2.0.7 github.com/minio/minio-go/v7 v7.3.0 github.com/soulteary/cli-kit v1.9.0 - github.com/soulteary/health-kit/v2 v2.3.0 + github.com/soulteary/health-kit/v4 v4.0.0 github.com/soulteary/http-kit v1.5.0 github.com/soulteary/httpcache-kit/v4 v4.0.0 github.com/soulteary/logger-kit/v3 v3.0.0 github.com/soulteary/metrics-kit/v3 v3.0.0 - github.com/soulteary/middleware-kit/v2 v2.2.0 + github.com/soulteary/middleware-kit/v3 v3.0.0 github.com/soulteary/tracing-kit v1.5.0 - github.com/soulteary/version-kit/v2 v2.2.0 + github.com/soulteary/version-kit/v4 v4.0.0 github.com/soulteary/vfs-kit v1.4.2 go.opentelemetry.io/otel v1.46.0 go.opentelemetry.io/otel/trace v1.46.0 @@ -27,7 +27,7 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect - github.com/dustin/go-humanize v1.0.1 // indirect + github.com/dustin/go-humanize v1.1.0 // indirect github.com/go-logr/logr v1.4.4 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/gofiber/schema v1.8.7 // indirect @@ -49,7 +49,6 @@ require ( github.com/prometheus/client_model v0.6.3 // indirect github.com/prometheus/common v0.71.0 // indirect github.com/prometheus/procfs v0.22.0 // indirect - github.com/redis/go-redis/v9 v9.22.0 // indirect github.com/rs/xid v1.6.0 // indirect github.com/rs/zerolog v1.35.1 // indirect github.com/spf13/pflag v1.0.10 // indirect @@ -63,11 +62,11 @@ require ( go.opentelemetry.io/otel/metric v1.46.0 // indirect go.opentelemetry.io/otel/sdk v1.46.0 // indirect go.opentelemetry.io/proto/otlp v1.11.0 // indirect - go.uber.org/atomic v1.11.0 // indirect go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/crypto v0.57.0 // indirect golang.org/x/net v0.59.0 // indirect golang.org/x/text v0.42.0 // indirect + golang.org/x/tools v0.50.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260911204522-f61a6ca850bd // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260911204522-f61a6ca850bd // indirect google.golang.org/grpc v1.83.2 // indirect diff --git a/go.sum b/go.sum index aa13014c..08ac8170 100644 --- a/go.sum +++ b/go.sum @@ -1,11 +1,5 @@ -github.com/alicebob/miniredis/v2 v2.39.0 h1:M7WbmV5BmV56L8KTG0rw6vEQ+woTOghpDgin2xv4A0g= -github.com/alicebob/miniredis/v2 v2.39.0/go.mod h1:TcL7YfarKPGDAthEtl5NBeHZfeUQj6OXMm/+iu5cLMM= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= -github.com/bsm/ginkgo/v2 v2.12.0 h1:Ny8MWAHyOepLGlLKYmXG4IEkioBysk6GpaRTLC8zwWs= -github.com/bsm/ginkgo/v2 v2.12.0/go.mod h1:SwYbGRRDovPVboqFv0tPTcG1sN61LM1Z4ARdbAV9g4c= -github.com/bsm/gomega v1.27.10 h1:yeMWxP2pV2fG3FgAODIY8EiRE3dy0aeFYt4l7wh6yKA= -github.com/bsm/gomega v1.27.10/go.mod h1:JyEr/xRbxbtgWNi8tIEVPUYZ5Dzef52k01W3YH0H+O0= github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= @@ -13,8 +7,8 @@ github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= -github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto= +github.com/dustin/go-humanize v1.1.0 h1:dbKTrvD0klcbBV/h4AWJdMuZogJACoMlvWIWZ5b2xWg= +github.com/dustin/go-humanize v1.1.0/go.mod h1:hc1CvRkJMsgxqjmjMQF3QNRAZBwY8AXBAzKYoSX9sFI= github.com/fxamacker/cbor/v2 v2.9.3 h1:oQBnFATpNdY8gJHTndDDv5Xl4QqNaz51G5LLEPhng3Q= github.com/fxamacker/cbor/v2 v2.9.3/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= @@ -78,8 +72,6 @@ github.com/prometheus/common v0.71.0 h1:9KDAKb7Mj3HEVKyFCK6Dc/HIwlBzZIN2l7/lrHl3 github.com/prometheus/common v0.71.0/go.mod h1:CLJ5H8TEsGX8bl31BdMkfhIZ+QmZ9tBPPotUxUbfcmk= github.com/prometheus/procfs v0.22.0 h1:6q9+/JL9IKAPbCmBrv9n5O5Ty3NKnciV5X7YGw0oics= github.com/prometheus/procfs v0.22.0/go.mod h1:CvmFr/GVhIjIvWJZW3tgkODBQMRIf0EyWMQLHCHab58= -github.com/redis/go-redis/v9 v9.22.0 h1:laDvpYXTJtZLloinw1fA5Kqd6HAEH2XKxOkG/PDq2F0= -github.com/redis/go-redis/v9 v9.22.0/go.mod h1:y2g0Wj8rQvuK0ELM+oxSudcLtC09JScs98I/X9gRWY4= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE= github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= @@ -92,8 +84,8 @@ github.com/shamaton/msgpack/v3 v3.2.3 h1:0r0aZtrXDFOPpwWJTEOpFq+Ih/JmMLm0pqLN5mS github.com/shamaton/msgpack/v3 v3.2.3/go.mod h1:sgBYvEiyz8JR1NC3yGRoPVME9xXovpnh3l/plW1nfRo= github.com/soulteary/cli-kit v1.9.0 h1:MqI51qtK+pspPDoF0WA0RctRrDXB/lkQ0Wl7qWO2eeQ= github.com/soulteary/cli-kit v1.9.0/go.mod h1:xwDFEGpNaL5Tgqsv2FW0PRPuCE80Um+LXDUUIzcQxgQ= -github.com/soulteary/health-kit/v2 v2.3.0 h1:T+r27bDGfae4jvp7cIZfeRDuL9zJ/ggcpBtopiztvnk= -github.com/soulteary/health-kit/v2 v2.3.0/go.mod h1:D5V1lHUxA4ITVUpfH3/KFhWzonfdA3pu7329FmaUSdk= +github.com/soulteary/health-kit/v4 v4.0.0 h1:z9naNR+5ratOOk7Rhv0x7qf2lhwkqA1BKmZXX3BYpLc= +github.com/soulteary/health-kit/v4 v4.0.0/go.mod h1:FICSTbB1ZaKpRsn+16u1b2w6TaCxV3E2H2KAYHlQxKQ= github.com/soulteary/http-kit v1.5.0 h1:VCvsCjsLEgcg0x/cfbhQyo+KdzCL28+3PqVCrR8h+so= github.com/soulteary/http-kit v1.5.0/go.mod h1:WoOxPjfMZrj0IYEn/Lagb3vGt9eFlsPXutwRufckOpA= github.com/soulteary/httpcache-kit/v4 v4.0.0 h1:dxBKDkkQnymd9H5eefiYx27zh3WdSWtlCJqyMNbbvXk= @@ -102,12 +94,12 @@ github.com/soulteary/logger-kit/v3 v3.0.0 h1:oCsNss5cRgMJD5Ub5mjWjgFmtvExlqilSPu github.com/soulteary/logger-kit/v3 v3.0.0/go.mod h1:zAV0BXZ42KFp5yXL6MMFtXg6O0xzxENx5VEW3/BKwEQ= github.com/soulteary/metrics-kit/v3 v3.0.0 h1:1KBslddLh5Qv9+pi06Py/SoM59Cbm2FiRDDsioGOJU8= github.com/soulteary/metrics-kit/v3 v3.0.0/go.mod h1:hugXfHjLJUSqNTjF6UUueEdO7KZEz7rzQOMHUvNd3hM= -github.com/soulteary/middleware-kit/v2 v2.2.0 h1:kE1ov3bFE/sT34f2z5OMkXhk5mZlfNtlwzm6pqy4eZo= -github.com/soulteary/middleware-kit/v2 v2.2.0/go.mod h1:+4Z+6aCRCPWCFdSjodxOA6ISnuqBkT5/vE1birjVCOE= +github.com/soulteary/middleware-kit/v3 v3.0.0 h1:8CHQPvYB64QJDBTN5j2zHv1+nB5MtTInHP+MMZn5GG4= +github.com/soulteary/middleware-kit/v3 v3.0.0/go.mod h1:x5gzREwqRUxusCPAJhtC8op8Sizv+5A+CjLHVm56kwk= github.com/soulteary/tracing-kit v1.5.0 h1:p01bQ0n0SJjIsT2LWk62b9w4feZ8kF87GTC3LhBti8M= github.com/soulteary/tracing-kit v1.5.0/go.mod h1:miM/OzzVyeYqevNbI5DzlNFgIPr/K0KHO99JK8bMLeg= -github.com/soulteary/version-kit/v2 v2.2.0 h1:m0oIXopaA2wco5hvf4ZRvSD2A45EyCEE8JeMNrwrfFE= -github.com/soulteary/version-kit/v2 v2.2.0/go.mod h1:ZFiDSqWHrpeRtuhs2sEj8VNfCa8Xcm65DZjctG3Q0Lk= +github.com/soulteary/version-kit/v4 v4.0.0 h1:4gEes54h/iymUhPdY/LhKG1mSuMMpNmzd3fx4glcreU= +github.com/soulteary/version-kit/v4 v4.0.0/go.mod h1:TUA+9E+g5kjaT2ilfaIszoYtqgnCV0XiUzhT4RDrL9Q= github.com/soulteary/vfs-kit v1.4.2 h1:rhIFf136wcyYFD/9LI82rso642/PhCKskLZro5O5GdY= github.com/soulteary/vfs-kit v1.4.2/go.mod h1:CsBAdoLdbruiQtTH73e/cTJs5AsZg/PisR4c9Ah22Es= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= @@ -130,8 +122,6 @@ github.com/valyala/fasthttp v1.74.0 h1:wMS9fnO2QTALozYx5pId2Vi7ZwU/epUkY8i/KPWCH github.com/valyala/fasthttp v1.74.0/go.mod h1:3ARmLamUcw7ElxVtC8PXaGzQ6VEuvnetlkrwIklQBSE= github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= -github.com/yuin/gopher-lua v1.1.2 h1:yF/FjE3hD65tBbt0VXLE13HWS9h34fdzJmrWRXwobGA= -github.com/yuin/gopher-lua v1.1.2/go.mod h1:7aRmXIWl37SqRf0koeyylBEzJ+aPt8A+mmkQ4f1ntR8= github.com/zeebo/assert v1.3.0 h1:g7C04CbJuIDKNPFHmsk4hwZDO5O+kntRxzaUoNXj+IQ= github.com/zeebo/assert v1.3.0/go.mod h1:Pq9JiuJQpG8JLJdtkwrJESF0Foym2/D9XMU5ciN/wJ0= github.com/zeebo/xxh3 v1.1.0 h1:s7DLGDK45Dyfg7++yxI0khrfwq9661w9EN78eP/UZVs= @@ -154,8 +144,6 @@ go.opentelemetry.io/otel/trace v1.46.0 h1:OULy7ccdJnZtJ0UDYFOIGaCmiWzJ8Vi2G/Rsu6 go.opentelemetry.io/otel/trace v1.46.0/go.mod h1:J7GAXweO77XSFkB/rmAqk9D6ihszhFjLU+d9WuUxDLI= go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= -go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.yaml.in/yaml/v2 v2.4.4 h1:tuyd0P+2Ont/d6e2rl3be67goVK4R6deVxCUX5vyPaQ= @@ -192,11 +180,11 @@ gopkg.in/ini.v1 v1.67.3/go.mod h1:x/cyOwCgZqOkJoDIJ3c1KNHMo10+nLGAhh+kn3Zizss= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -modernc.org/libc v1.75.7 h1:o3DTP9/0p9pKmY2WCKQaySW6wIiZhNM7wc2lUoyhfew= -modernc.org/libc v1.75.7/go.mod h1:bO5o2ztHxBb2rjz0PgdHN0sSMw57CgxGFLZ3Qd/QpVQ= +modernc.org/libc v1.77.0 h1:wV+faa9ixRoUNlakU0fHLi/1kV2YLG8D8Ksk3c2mPtY= +modernc.org/libc v1.77.0/go.mod h1:BmXDCJcMkRMRbX2EI8+Zhh4fKWlHNbCCZEy0tiZevP4= modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU= modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg= modernc.org/memory v1.12.1 h1:nFMiWrpStgZczNl6XI9GnIk/rWhYIyHGUaR04pGbp9g= modernc.org/memory v1.12.1/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw= -modernc.org/sqlite v1.58.0 h1:38u40/bwkfM7f0Myhosl+SEMltSDxnGdQf8o6Kjmys0= -modernc.org/sqlite v1.58.0/go.mod h1:rsD2CckafgObKC4DhBlGBf+RiHxkc3hINGt1Xw32tVY= +modernc.org/sqlite v1.59.0 h1:X1es1GpqBlS/5T+vbM4HLUdaa8OtQx468DF2vrx+38A= +modernc.org/sqlite v1.59.0/go.mod h1:+paeT2A3iPRHkQDwG7oA6Tk0zQd5woMEI8q7orfry8k= diff --git a/internal/cli/daemon.go b/internal/cli/daemon.go index 94a3f3f3..aaa0edb9 100644 --- a/internal/cli/daemon.go +++ b/internal/cli/daemon.go @@ -29,13 +29,16 @@ import ( "github.com/gofiber/fiber/v3" "github.com/gofiber/fiber/v3/middleware/adaptor" - health "github.com/soulteary/health-kit/v2" + health "github.com/soulteary/health-kit/v4" + healthfiber "github.com/soulteary/health-kit/v4/fiberadapter" logger "github.com/soulteary/logger-kit/v3" loggerfiber "github.com/soulteary/logger-kit/v3/fiberadapter" metrics "github.com/soulteary/metrics-kit/v3" - middleware "github.com/soulteary/middleware-kit/v2" + middleware "github.com/soulteary/middleware-kit/v3" + mwfiber "github.com/soulteary/middleware-kit/v3/fiberadapter" tracing "github.com/soulteary/tracing-kit" - version "github.com/soulteary/version-kit/v2" + version "github.com/soulteary/version-kit/v4" + versionfiber "github.com/soulteary/version-kit/v4/fiberadapter" "github.com/soulteary/apt-proxy/internal/api" "github.com/soulteary/apt-proxy/internal/config" @@ -422,9 +425,9 @@ func (s *Server) createFiberApp() *fiber.App { }) // Version headers for all responses - app.Use(version.FiberMiddleware(s.versionInfo, "X-")) + app.Use(versionfiber.Middleware(s.versionInfo, "X-")) // Security headers - app.Use(middleware.SecurityHeaders(middleware.DefaultSecurityHeadersConfig())) + app.Use(mwfiber.SecurityHeaders(middleware.DefaultSecurityHeadersConfig())) // Request logging: logger-kit fiberadapter middleware, unified with request_id and cache/size for proxy. // The fiber.Ctx-typed hooks live on loggerfiber.Config since logger-kit v3 @@ -453,18 +456,18 @@ func (s *Server) createFiberApp() *fiber.App { })) // Health check endpoints (Fiber native) - // We deliberately use a local handler instead of health.FiberHandler / - // health.FiberReadinessHandler: the upstream helpers feed the fasthttp + // We deliberately use a local handler instead of healthfiber.Handler / + // healthfiber.ReadinessHandler: the upstream helpers feed the fasthttp // *RequestCtx into context.WithTimeout, which spawns a propagateCancel // goroutine that races with fiber/fasthttp's ShutdownWithContext during // graceful shutdown (see internal/cli/health.go). Liveness has no // aggregator and is safe to use as-is. app.Get("/healthz", fiberHealthHandler(s.healthAggregator)) - app.Get("/livez", health.FiberLivenessHandler("apt-proxy")) + app.Get("/livez", healthfiber.LivenessHandler("apt-proxy")) app.Get("/readyz", fiberHealthHandler(s.healthAggregator)) // Version endpoint (Fiber native) - app.Get("/version", version.FiberHandler(version.HandlerConfig{ + app.Get("/version", versionfiber.Handler(version.HandlerConfig{ Info: s.versionInfo, Pretty: true, })) diff --git a/internal/cli/health.go b/internal/cli/health.go index 78fd0ebb..158b6eb2 100644 --- a/internal/cli/health.go +++ b/internal/cli/health.go @@ -18,10 +18,10 @@ import ( "context" "github.com/gofiber/fiber/v3" - health "github.com/soulteary/health-kit/v2" + health "github.com/soulteary/health-kit/v4" ) -// fiberHealthHandler is a Fiber-native replacement for health.FiberHandler that +// fiberHealthHandler is a Fiber-native replacement for healthfiber.Handler that // avoids passing the fasthttp *RequestCtx down into health-kit. The upstream // helper calls aggregator.Check(c.Context()), and aggregator.Check then calls // context.WithTimeout(parent, ...) which spawns a goroutine reading diff --git a/internal/cli/health_test.go b/internal/cli/health_test.go index ef5f558e..cecfd5ee 100644 --- a/internal/cli/health_test.go +++ b/internal/cli/health_test.go @@ -22,7 +22,7 @@ import ( "testing" "github.com/gofiber/fiber/v3" - health "github.com/soulteary/health-kit/v2" + health "github.com/soulteary/health-kit/v4" ) // healthCheckerFunc adapts a closure into the health.Checker interface so From 9fe1f102df63b2c5bc5e9bf09d9c3c97f66d9e66 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 21 Sep 2026 15:25:46 +0000 Subject: [PATCH 3/3] deps: upgrade tracing-kit v2 and http-kit v2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - github.com/soulteary/tracing-kit v1.5.0 -> /v2 v2.0.0 - github.com/soulteary/http-kit v1.5.0 -> /v2 v2.0.0 Both moved what pulled a heavy dependency into every consumer out of the root package. tracing-kit v2 moved the OTLP exporter into the otlp subpackage, so tracing.InitTracer becomes otlp.InitTracer. The arguments and the return values are the same, and initTracing keeps treating a failure as non-fatal. Everything the proxy uses from the root package — StartSpan, RecordError, SetSpanStatus, SetSpanAttributes, SetSpanAttributesFromMap and Shutdown — kept its name and signature, so handler.go, passthrough.go and transport.go only needed the import path. http-kit v2 removed Client.InjectTraceContext, which is what made every user of the package link OpenTelemetry. The proxy never called it — it uses only RetryOptions and DefaultRetryOptions, both unchanged — so transport.go and transport_test.go only needed the import path too. With this the old module paths are gone from the tree: neither soulteary/(httpcache|logger|metrics|health|middleware|version)-kit/v2 nor a soulteary/(tracing|http)-kit without /v2 matches any tracked file. go build ./..., go vet ./... (also with -tags=integration) and go test ./... all pass. Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01S41m6kbkBFMd6tGe7eAxC5 --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/cli/daemon.go | 5 +++-- internal/proxy/handler.go | 2 +- internal/proxy/passthrough.go | 2 +- internal/proxy/transport.go | 4 ++-- internal/proxy/transport_test.go | 2 +- 7 files changed, 14 insertions(+), 13 deletions(-) diff --git a/go.mod b/go.mod index 0af13bfe..9fb9b5b1 100644 --- a/go.mod +++ b/go.mod @@ -8,12 +8,12 @@ require ( github.com/minio/minio-go/v7 v7.3.0 github.com/soulteary/cli-kit v1.9.0 github.com/soulteary/health-kit/v4 v4.0.0 - github.com/soulteary/http-kit v1.5.0 + github.com/soulteary/http-kit/v2 v2.0.0 github.com/soulteary/httpcache-kit/v4 v4.0.0 github.com/soulteary/logger-kit/v3 v3.0.0 github.com/soulteary/metrics-kit/v3 v3.0.0 github.com/soulteary/middleware-kit/v3 v3.0.0 - github.com/soulteary/tracing-kit v1.5.0 + github.com/soulteary/tracing-kit/v2 v2.0.0 github.com/soulteary/version-kit/v4 v4.0.0 github.com/soulteary/vfs-kit v1.4.2 go.opentelemetry.io/otel v1.46.0 diff --git a/go.sum b/go.sum index 08ac8170..e2835c9e 100644 --- a/go.sum +++ b/go.sum @@ -86,8 +86,8 @@ github.com/soulteary/cli-kit v1.9.0 h1:MqI51qtK+pspPDoF0WA0RctRrDXB/lkQ0Wl7qWO2e github.com/soulteary/cli-kit v1.9.0/go.mod h1:xwDFEGpNaL5Tgqsv2FW0PRPuCE80Um+LXDUUIzcQxgQ= github.com/soulteary/health-kit/v4 v4.0.0 h1:z9naNR+5ratOOk7Rhv0x7qf2lhwkqA1BKmZXX3BYpLc= github.com/soulteary/health-kit/v4 v4.0.0/go.mod h1:FICSTbB1ZaKpRsn+16u1b2w6TaCxV3E2H2KAYHlQxKQ= -github.com/soulteary/http-kit v1.5.0 h1:VCvsCjsLEgcg0x/cfbhQyo+KdzCL28+3PqVCrR8h+so= -github.com/soulteary/http-kit v1.5.0/go.mod h1:WoOxPjfMZrj0IYEn/Lagb3vGt9eFlsPXutwRufckOpA= +github.com/soulteary/http-kit/v2 v2.0.0 h1:q+maakPCwz0iRDcrfnQ9Z9BRxdiHGcLnH0wUWVmLmxk= +github.com/soulteary/http-kit/v2 v2.0.0/go.mod h1:fZJeAYpTvmfyq0Oq7imWxbQS5MIjQCZ8HQDCWCHOrhg= github.com/soulteary/httpcache-kit/v4 v4.0.0 h1:dxBKDkkQnymd9H5eefiYx27zh3WdSWtlCJqyMNbbvXk= github.com/soulteary/httpcache-kit/v4 v4.0.0/go.mod h1:Afhk8y8nkcM6PbtMJrmlzrUBt4ff6UDxXpj/Z2/2wjo= github.com/soulteary/logger-kit/v3 v3.0.0 h1:oCsNss5cRgMJD5Ub5mjWjgFmtvExlqilSPuz/cIu8AE= @@ -96,8 +96,8 @@ github.com/soulteary/metrics-kit/v3 v3.0.0 h1:1KBslddLh5Qv9+pi06Py/SoM59Cbm2FiRD github.com/soulteary/metrics-kit/v3 v3.0.0/go.mod h1:hugXfHjLJUSqNTjF6UUueEdO7KZEz7rzQOMHUvNd3hM= github.com/soulteary/middleware-kit/v3 v3.0.0 h1:8CHQPvYB64QJDBTN5j2zHv1+nB5MtTInHP+MMZn5GG4= github.com/soulteary/middleware-kit/v3 v3.0.0/go.mod h1:x5gzREwqRUxusCPAJhtC8op8Sizv+5A+CjLHVm56kwk= -github.com/soulteary/tracing-kit v1.5.0 h1:p01bQ0n0SJjIsT2LWk62b9w4feZ8kF87GTC3LhBti8M= -github.com/soulteary/tracing-kit v1.5.0/go.mod h1:miM/OzzVyeYqevNbI5DzlNFgIPr/K0KHO99JK8bMLeg= +github.com/soulteary/tracing-kit/v2 v2.0.0 h1:7xFJrxz5fTFLjXZ8A+B3IK5+NK+eW54mXA3ldjhtxDQ= +github.com/soulteary/tracing-kit/v2 v2.0.0/go.mod h1:GJLsfbcHbC4Dki6/rKrrn9VpVHEZUA+/skpD6D/oAkI= github.com/soulteary/version-kit/v4 v4.0.0 h1:4gEes54h/iymUhPdY/LhKG1mSuMMpNmzd3fx4glcreU= github.com/soulteary/version-kit/v4 v4.0.0/go.mod h1:TUA+9E+g5kjaT2ilfaIszoYtqgnCV0XiUzhT4RDrL9Q= github.com/soulteary/vfs-kit v1.4.2 h1:rhIFf136wcyYFD/9LI82rso642/PhCKskLZro5O5GdY= diff --git a/internal/cli/daemon.go b/internal/cli/daemon.go index aaa0edb9..303d285a 100644 --- a/internal/cli/daemon.go +++ b/internal/cli/daemon.go @@ -36,7 +36,8 @@ import ( metrics "github.com/soulteary/metrics-kit/v3" middleware "github.com/soulteary/middleware-kit/v3" mwfiber "github.com/soulteary/middleware-kit/v3/fiberadapter" - tracing "github.com/soulteary/tracing-kit" + tracing "github.com/soulteary/tracing-kit/v2" + otlp "github.com/soulteary/tracing-kit/v2/otlp" version "github.com/soulteary/version-kit/v4" versionfiber "github.com/soulteary/version-kit/v4/fiberadapter" @@ -146,7 +147,7 @@ func (s *Server) initTracing() { serviceVersion = "unknown" } - tp, err := tracing.InitTracer("apt-proxy", serviceVersion, otlpEndpoint) + tp, err := otlp.InitTracer("apt-proxy", serviceVersion, otlpEndpoint) if err != nil { s.log.Warn().Err(err).Msg("failed to initialize tracing, continuing without tracing") return diff --git a/internal/proxy/handler.go b/internal/proxy/handler.go index ed3416c6..f46baf1b 100644 --- a/internal/proxy/handler.go +++ b/internal/proxy/handler.go @@ -29,7 +29,7 @@ import ( "time" logger "github.com/soulteary/logger-kit/v3" - tracing "github.com/soulteary/tracing-kit" + tracing "github.com/soulteary/tracing-kit/v2" "github.com/soulteary/apt-proxy/internal/benchmarks" "github.com/soulteary/apt-proxy/internal/distro" diff --git a/internal/proxy/passthrough.go b/internal/proxy/passthrough.go index 56154107..49b7f883 100644 --- a/internal/proxy/passthrough.go +++ b/internal/proxy/passthrough.go @@ -23,7 +23,7 @@ import ( "strconv" "strings" - tracing "github.com/soulteary/tracing-kit" + tracing "github.com/soulteary/tracing-kit/v2" "go.opentelemetry.io/otel/trace" "github.com/soulteary/apt-proxy/internal/distro" diff --git a/internal/proxy/transport.go b/internal/proxy/transport.go index 9bb4b018..1222ba99 100644 --- a/internal/proxy/transport.go +++ b/internal/proxy/transport.go @@ -19,12 +19,12 @@ import ( "net/http" "time" - httpkit "github.com/soulteary/http-kit" + httpkit "github.com/soulteary/http-kit/v2" "go.opentelemetry.io/otel" "go.opentelemetry.io/otel/codes" "go.opentelemetry.io/otel/propagation" - tracing "github.com/soulteary/tracing-kit" + tracing "github.com/soulteary/tracing-kit/v2" ) // RetryableTransport wraps an http.RoundTripper with retry logic and tracing support diff --git a/internal/proxy/transport_test.go b/internal/proxy/transport_test.go index c449fb45..d597d1ef 100644 --- a/internal/proxy/transport_test.go +++ b/internal/proxy/transport_test.go @@ -23,7 +23,7 @@ import ( "testing" "time" - httpkit "github.com/soulteary/http-kit" + httpkit "github.com/soulteary/http-kit/v2" ) // TestRetryableTransportRetriesOn5xx ensures the transport retries on a 5xx