refactor(agent): move agent pool to agent package, rename route.Agent() to route.GetAgent()

This commit is contained in:
yusing
2025-06-14 20:04:39 +08:00
parent cabb840a91
commit 7d17a01de1
13 changed files with 23 additions and 55 deletions

View File

@@ -7,6 +7,7 @@ import (
"time"
"github.com/gorilla/websocket"
"github.com/yusing/go-proxy/agent/pkg/agent"
config "github.com/yusing/go-proxy/internal/config/types"
"github.com/yusing/go-proxy/internal/docker"
"github.com/yusing/go-proxy/internal/gperr"
@@ -43,7 +44,7 @@ func getDockerClients() (DockerClients, gperr.Error) {
dockerClients[name] = dockerClient
}
for _, agent := range cfg.ListAgents() {
for _, agent := range agent.ListAgents() {
dockerClient, err := docker.NewClient(agent.FakeDockerHost())
if err != nil {
connErrs.Add(err)
@@ -65,7 +66,7 @@ func getDockerClient(server string) (*docker.SharedClient, bool, error) {
}
}
if host == "" {
for _, agent := range cfg.ListAgents() {
for _, agent := range agent.ListAgents() {
if agent.Name() == server {
host = agent.FakeDockerHost()
break