From dc1102905b9d836995866c9434b5a32c55b4f961 Mon Sep 17 00:00:00 2001 From: yusing Date: Mon, 14 Apr 2025 06:40:10 +0800 Subject: [PATCH] chore: cont fa16f415 --- agent/pkg/agent/config.go | 2 +- cmd/main.go | 4 ++++ internal/api/v1/version.go | 2 +- internal/watcher/health/monitor/http.go | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) diff --git a/agent/pkg/agent/config.go b/agent/pkg/agent/config.go index 5a28545..0b4912b 100644 --- a/agent/pkg/agent/config.go +++ b/agent/pkg/agent/config.go @@ -125,7 +125,7 @@ func (cfg *AgentConfig) InitWithCerts(ctx context.Context, ca, crt, key []byte) versionStr := string(version) // skip version check for dev versions - if strings.HasPrefix(versionStr, "v") && !checkVersion(versionStr, pkg.GetVersion()) { + if strings.HasPrefix(versionStr, "v") && !checkVersion(versionStr, pkg.GetVersion().String()) { return gperr.Errorf("agent version mismatch: server: %s, agent: %s", pkg.GetVersion(), versionStr) } diff --git a/cmd/main.go b/cmd/main.go index af82af9..51f9d4a 100755 --- a/cmd/main.go +++ b/cmd/main.go @@ -20,6 +20,7 @@ import ( "github.com/yusing/go-proxy/internal/net/gphttp/middleware" "github.com/yusing/go-proxy/internal/route/routes/routequery" "github.com/yusing/go-proxy/internal/task" + "github.com/yusing/go-proxy/migrations" "github.com/yusing/go-proxy/pkg" ) @@ -39,6 +40,9 @@ func parallel(fns ...func()) { func main() { initProfiling() + if err := migrations.RunMigrations(); err != nil { + gperr.LogFatal("migration error", err) + } args := pkg.GetArgs(common.MainServerCommandValidator{}) switch args.Command { diff --git a/internal/api/v1/version.go b/internal/api/v1/version.go index f43a9d6..5cf574f 100644 --- a/internal/api/v1/version.go +++ b/internal/api/v1/version.go @@ -8,5 +8,5 @@ import ( ) func GetVersion(w http.ResponseWriter, r *http.Request) { - gphttp.WriteBody(w, []byte(pkg.GetVersion())) + gphttp.WriteBody(w, []byte(pkg.GetVersion().String())) } diff --git a/internal/watcher/health/monitor/http.go b/internal/watcher/health/monitor/http.go index ce95b23..1aa060f 100644 --- a/internal/watcher/health/monitor/http.go +++ b/internal/watcher/health/monitor/http.go @@ -53,7 +53,7 @@ func (mon *HTTPHealthMonitor) CheckHealth() (result *health.HealthCheckResult, e } req.Close = true req.Header.Set("Connection", "close") - req.Header.Set("User-Agent", "GoDoxy/"+pkg.GetVersion()) + req.Header.Set("User-Agent", "GoDoxy/"+pkg.GetVersion().String()) start := time.Now() resp, respErr := pinger.Do(req)