mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-20 00:25:02 +01:00
refactor: move version.go to goutils
This commit is contained in:
@@ -4,7 +4,7 @@ import (
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
"github.com/yusing/godoxy/pkg"
|
||||
"github.com/yusing/goutils/version"
|
||||
)
|
||||
|
||||
// @x-id "version"
|
||||
@@ -17,5 +17,5 @@ import (
|
||||
// @Success 200 {string} string "version"
|
||||
// @Router /version [get]
|
||||
func Version(c *gin.Context) {
|
||||
c.JSON(http.StatusOK, pkg.GetVersion().String())
|
||||
c.JSON(http.StatusOK, version.Get().String())
|
||||
}
|
||||
|
||||
@@ -15,10 +15,10 @@ import (
|
||||
"github.com/yusing/godoxy/internal/route/routes"
|
||||
"github.com/yusing/godoxy/internal/types"
|
||||
"github.com/yusing/godoxy/internal/watcher/health/monitor"
|
||||
"github.com/yusing/godoxy/pkg"
|
||||
gperr "github.com/yusing/goutils/errs"
|
||||
"github.com/yusing/goutils/http/reverseproxy"
|
||||
"github.com/yusing/goutils/task"
|
||||
"github.com/yusing/goutils/version"
|
||||
)
|
||||
|
||||
type ReveseProxyRoute struct {
|
||||
@@ -74,7 +74,7 @@ func NewReverseProxyRoute(base *Route) (*ReveseProxyRoute, gperr.Error) {
|
||||
HTTPConfig: httpConfig,
|
||||
}
|
||||
setHeaderFunc := cfg.SetAgentProxyConfigHeaders
|
||||
if !a.Version.IsOlderThan(pkg.Ver(0, 18, 6)) {
|
||||
if !a.Version.IsOlderThan(version.New(0, 18, 6)) {
|
||||
setHeaderFunc = cfg.SetAgentProxyConfigHeadersLegacy
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/yusing/godoxy/internal/types"
|
||||
"github.com/yusing/godoxy/pkg"
|
||||
"github.com/yusing/goutils/version"
|
||||
)
|
||||
|
||||
type HTTPHealthMonitor struct {
|
||||
@@ -52,7 +52,7 @@ func (mon *HTTPHealthMonitor) CheckHealth() (types.HealthCheckResult, error) {
|
||||
}
|
||||
req.Close = true
|
||||
req.Header.Set("Connection", "close")
|
||||
req.Header.Set("User-Agent", "GoDoxy/"+pkg.GetVersion().String())
|
||||
req.Header.Set("User-Agent", "GoDoxy/"+version.Get().String())
|
||||
|
||||
start := time.Now()
|
||||
resp, respErr := pinger.Do(req)
|
||||
|
||||
Reference in New Issue
Block a user