29 lines
505 B
Go
29 lines
505 B
Go
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,
|
|
})
|
|
}
|