Files
godoxy-yusing/internal/route/provider/agent.go
yusing 35a3e3fef6 refactor(api): restructured API for type safety, maintainability and docs generation
- These changes makes the API incombatible with previous versions
- Added new types for error handling, success responses, and health checks.
- Updated health check logic to utilize the new types for better clarity and structure.
- Refactored existing handlers to improve response consistency and error handling.
- Updated Makefile to include a new target for generating API types from Swagger.
- Updated "new agent" API to respond an encrypted cert pair
2025-08-16 13:04:05 +08:00

35 lines
745 B
Go

package provider
import (
"github.com/rs/zerolog"
"github.com/yusing/go-proxy/agent/pkg/agent"
"github.com/yusing/go-proxy/internal/gperr"
"github.com/yusing/go-proxy/internal/route"
"github.com/yusing/go-proxy/internal/watcher"
)
type AgentProvider struct {
*agent.AgentConfig
docker ProviderImpl
}
func (p *AgentProvider) ShortName() string {
return p.AgentConfig.Name
}
func (p *AgentProvider) NewWatcher() watcher.Watcher {
return p.docker.NewWatcher()
}
func (p *AgentProvider) IsExplicitOnly() bool {
return p.docker.IsExplicitOnly()
}
func (p *AgentProvider) loadRoutesImpl() (route.Routes, gperr.Error) {
return p.docker.loadRoutesImpl()
}
func (p *AgentProvider) Logger() *zerolog.Logger {
return p.docker.Logger()
}