mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-25 01:38:30 +02:00
refactor(stats): change uptime type from string to int64
This commit is contained in:
@@ -9,12 +9,11 @@ import (
|
|||||||
"github.com/yusing/go-proxy/internal/net/gphttp/httpheaders"
|
"github.com/yusing/go-proxy/internal/net/gphttp/httpheaders"
|
||||||
"github.com/yusing/go-proxy/internal/net/gphttp/websocket"
|
"github.com/yusing/go-proxy/internal/net/gphttp/websocket"
|
||||||
"github.com/yusing/go-proxy/internal/types"
|
"github.com/yusing/go-proxy/internal/types"
|
||||||
"github.com/yusing/go-proxy/internal/utils/strutils"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type StatsResponse struct {
|
type StatsResponse struct {
|
||||||
Proxies ProxyStats `json:"proxies"`
|
Proxies ProxyStats `json:"proxies"`
|
||||||
Uptime string `json:"uptime"`
|
Uptime int64 `json:"uptime"`
|
||||||
} // @name StatsResponse
|
} // @name StatsResponse
|
||||||
|
|
||||||
type ProxyStats struct {
|
type ProxyStats struct {
|
||||||
@@ -40,7 +39,7 @@ func Stats(c *gin.Context) {
|
|||||||
getStats := func() (any, error) {
|
getStats := func() (any, error) {
|
||||||
return map[string]any{
|
return map[string]any{
|
||||||
"proxies": cfg.Statistics(),
|
"proxies": cfg.Statistics(),
|
||||||
"uptime": strutils.FormatDuration(time.Since(startTime)),
|
"uptime": int64(time.Since(startTime).Round(time.Second).Seconds()),
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user