refactor, fix reload error when using agents, and other small improvements

This commit is contained in:
yusing
2025-02-11 12:15:51 +08:00
parent b1f72620dc
commit 429a77de8e
10 changed files with 139 additions and 105 deletions

View File

@@ -7,6 +7,7 @@ import (
"github.com/docker/docker/api/types"
"github.com/yusing/go-proxy/agent/pkg/agent"
config "github.com/yusing/go-proxy/internal/config/types"
"github.com/yusing/go-proxy/internal/logging"
U "github.com/yusing/go-proxy/internal/utils"
"github.com/yusing/go-proxy/internal/utils/strutils"
@@ -82,7 +83,11 @@ func FromDocker(c *types.Container, dockerHost string) (res *Container) {
}
if agent.IsDockerHostAgent(dockerHost) {
res.Agent, _ = agent.GetAgentFromDockerHost(dockerHost)
var ok bool
res.Agent, ok = config.GetInstance().GetAgent(dockerHost)
if !ok {
logging.Error().Msgf("agent %q not found", dockerHost)
}
}
res.setPrivateHostname(helper)