29 lines
526 B
Go
29 lines
526 B
Go
package server
|
|
|
|
import (
|
|
"gitea.timerzz.com/kedaya_haitao/common/pkg/proxy"
|
|
"github.com/gofiber/fiber/v3"
|
|
)
|
|
|
|
type ProxySvc struct {
|
|
pool *proxy.ProxyPool
|
|
}
|
|
|
|
func NewProxySvc(pool *proxy.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,
|
|
})
|
|
}
|