watcher/server/proxy_svc.go

29 lines
505 B
Go
Raw Normal View History

2024-04-12 15:29:43 +08:00
package server
import (
"github.com/gofiber/fiber/v3"
pool "haitao_watcher/pkg/pools"
)
type ProxySvc struct {
pool *pool.ProxyPool
}
func NewProxySvc(pool *pool.ProxyPool) *ProxySvc {
return &ProxySvc{
pool: pool,
}
}
func (s *ProxySvc) RegistryRouter(r fiber.Router) {
r.Get("proxies/status", s.GetStatusInfo)
}
func (s *ProxySvc) GetStatusInfo(ctx fiber.Ctx) error {
list, updated := s.pool.Status()
return ctx.JSON(map[string]interface{}{
"list": list,
"updated": updated,
})
}