mirror of
https://github.com/yusing/godoxy.git
synced 2026-03-19 07:43:54 +01:00
refactor(agent): extract agent pool and HTTP utilities to dedicated package
Moved non-agent-specific logic from agent/pkg/agent/ to internal/agentpool/: - pool.go: Agent pool management (Get, Add, Remove, List, Iter, etc.) - http_requests.go: HTTP utilities (health checks, forwarding, websockets, reverse proxy) - agent.go: Agent struct with HTTP client management This separates general-purpose pool management from agent-specific configuration, improving code organization and making the agent package focused on agent config only.
This commit is contained in:
@@ -15,6 +15,7 @@ import (
|
||||
"github.com/moby/moby/api/types/container"
|
||||
"github.com/moby/moby/client"
|
||||
"github.com/yusing/godoxy/agent/pkg/agent"
|
||||
"github.com/yusing/godoxy/internal/agentpool"
|
||||
"github.com/yusing/godoxy/internal/serialization"
|
||||
"github.com/yusing/godoxy/internal/types"
|
||||
gperr "github.com/yusing/goutils/errs"
|
||||
@@ -71,7 +72,7 @@ func FromDocker(c *container.Summary, dockerCfg types.DockerProviderConfig) (res
|
||||
|
||||
if agent.IsDockerHostAgent(dockerCfg.URL) {
|
||||
var ok bool
|
||||
res.Agent, ok = agent.GetAgent(dockerCfg.URL)
|
||||
res.Agent, ok = agentpool.Get(dockerCfg.URL)
|
||||
if !ok {
|
||||
addError(res, fmt.Errorf("agent %q not found", dockerCfg.URL))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user