mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-26 02:51:07 +01: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/websocket"
|
||||
"github.com/yusing/go-proxy/internal/types"
|
||||
"github.com/yusing/go-proxy/internal/utils/strutils"
|
||||
)
|
||||
|
||||
type StatsResponse struct {
|
||||
Proxies ProxyStats `json:"proxies"`
|
||||
Uptime string `json:"uptime"`
|
||||
Uptime int64 `json:"uptime"`
|
||||
} // @name StatsResponse
|
||||
|
||||
type ProxyStats struct {
|
||||
@@ -40,7 +39,7 @@ func Stats(c *gin.Context) {
|
||||
getStats := func() (any, error) {
|
||||
return map[string]any{
|
||||
"proxies": cfg.Statistics(),
|
||||
"uptime": strutils.FormatDuration(time.Since(startTime)),
|
||||
"uptime": int64(time.Since(startTime).Round(time.Second).Seconds()),
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user