This commit is contained in:
yusing 2025-04-14 06:40:10 +08:00
parent eb7495b02a
commit dc1102905b
4 changed files with 7 additions and 3 deletions

View file

@ -125,7 +125,7 @@ func (cfg *AgentConfig) InitWithCerts(ctx context.Context, ca, crt, key []byte)
versionStr := string(version) versionStr := string(version)
// skip version check for dev versions // 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) return gperr.Errorf("agent version mismatch: server: %s, agent: %s", pkg.GetVersion(), versionStr)
} }

View file

@ -20,6 +20,7 @@ import (
"github.com/yusing/go-proxy/internal/net/gphttp/middleware" "github.com/yusing/go-proxy/internal/net/gphttp/middleware"
"github.com/yusing/go-proxy/internal/route/routes/routequery" "github.com/yusing/go-proxy/internal/route/routes/routequery"
"github.com/yusing/go-proxy/internal/task" "github.com/yusing/go-proxy/internal/task"
"github.com/yusing/go-proxy/migrations"
"github.com/yusing/go-proxy/pkg" "github.com/yusing/go-proxy/pkg"
) )
@ -39,6 +40,9 @@ func parallel(fns ...func()) {
func main() { func main() {
initProfiling() initProfiling()
if err := migrations.RunMigrations(); err != nil {
gperr.LogFatal("migration error", err)
}
args := pkg.GetArgs(common.MainServerCommandValidator{}) args := pkg.GetArgs(common.MainServerCommandValidator{})
switch args.Command { switch args.Command {

View file

@ -8,5 +8,5 @@ import (
) )
func GetVersion(w http.ResponseWriter, r *http.Request) { func GetVersion(w http.ResponseWriter, r *http.Request) {
gphttp.WriteBody(w, []byte(pkg.GetVersion())) gphttp.WriteBody(w, []byte(pkg.GetVersion().String()))
} }

View file

@ -53,7 +53,7 @@ func (mon *HTTPHealthMonitor) CheckHealth() (result *health.HealthCheckResult, e
} }
req.Close = true req.Close = true
req.Header.Set("Connection", "close") 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() start := time.Now()
resp, respErr := pinger.Do(req) resp, respErr := pinger.Do(req)