mirror of
https://github.com/yusing/godoxy.git
synced 2025-05-20 20:52:33 +02:00
20 lines
509 B
Go
20 lines
509 B
Go
package v1
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
U "github.com/yusing/go-proxy/internal/api/v1/utils"
|
|
"github.com/yusing/go-proxy/internal/config"
|
|
"github.com/yusing/go-proxy/internal/server"
|
|
"github.com/yusing/go-proxy/internal/utils"
|
|
)
|
|
|
|
func Stats(cfg *config.Config, w http.ResponseWriter, r *http.Request) {
|
|
stats := map[string]any{
|
|
"proxies": cfg.Statistics(),
|
|
"uptime": utils.FormatDuration(server.GetProxyServer().Uptime()),
|
|
}
|
|
if err := U.RespondJson(w, stats); err != nil {
|
|
U.HandleErr(w, r, err)
|
|
}
|
|
}
|