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

@@ -39,7 +39,7 @@ func NewReverseProxyRoute(base *Route) (*ReveseProxyRoute, gperr.Error) {
proxyURL := base.ProxyURL
var trans *http.Transport
a := base.Agent()
a := base.GetAgent()
if a != nil {
trans = a.Transport()
proxyURL = nettypes.NewURL(agent.HTTPProxyURL)

View File

@@ -351,7 +351,7 @@ func (r *Route) Type() route.RouteType {
panic(fmt.Errorf("unexpected scheme %s for alias %s", r.Scheme, r.Alias))
}
func (r *Route) Agent() *agent.AgentConfig {
func (r *Route) GetAgent() *agent.AgentConfig {
if r.Container == nil {
return nil
}
@@ -359,7 +359,7 @@ func (r *Route) Agent() *agent.AgentConfig {
}
func (r *Route) IsAgent() bool {
return r.Container != nil && r.Container.Agent != nil
return r.GetAgent() != nil
}
func (r *Route) HealthMonitor() health.HealthMonitor {

View File

@@ -38,7 +38,7 @@ type (
HomepageItem() *homepage.Item
ContainerInfo() *docker.Container
Agent() *agent.AgentConfig
GetAgent() *agent.AgentConfig
IsDocker() bool
IsAgent() bool