feat(agent): add container runtime support and enhance agent configuration

- Introduced ContainerRuntime field in AgentConfig and AgentEnvConfig.
- Added IterAgents and NumAgents functions for agent pool management.
- Updated agent creation and verification endpoints to handle container runtime.
- Enhanced Docker Compose template to support different container runtimes.
- Added runtime endpoint to retrieve agent runtime information.
This commit is contained in:
yusing
2025-09-13 23:44:03 +08:00
parent 4509622dde
commit 2717dc963a
11 changed files with 158 additions and 28 deletions

View File

@@ -1,6 +1,7 @@
package agent
import (
"iter"
"github.com/puzpuzpuz/xsync/v4"
"github.com/yusing/go-proxy/internal/common"
@@ -52,6 +53,14 @@ func ListAgents() []*AgentConfig {
return agents
}
func IterAgents() iter.Seq2[string, *AgentConfig] {
return agentPool.Range
}
func NumAgents() int {
return agentPool.Size()
}
func getAgentByAddr(addr string) (agent *AgentConfig, ok bool) {
agent, ok = agentPool.Load(addr)
return