feat: add proxy and statistics features

This commit is contained in:
2026-05-27 07:41:06 +02:00
parent 35643b2ea9
commit b3c7e67b78
23 changed files with 2139 additions and 147 deletions

View File

@ -22,6 +22,7 @@ type AgentState struct {
Volumes []*agentv1.VolumeInfo
Networks []*agentv1.NetworkInfo
Stats *agentv1.StatsSnapshot
cmdCh chan *agentv1.ServerMessage
pendingFiles map[string]chan *agentv1.FileResult
pendingUpdates map[string]string // commandID → containerID
@ -102,6 +103,15 @@ func (r *Registry) UpdateResources(id string, containers []*agentv1.ContainerInf
}
}
func (r *Registry) UpdateStats(id string, stats *agentv1.StatsSnapshot) {
r.mu.Lock()
defer r.mu.Unlock()
if s, ok := r.agents[id]; ok {
s.Stats = stats
s.LastSeenAt = time.Now()
}
}
// UpdateAlias refreshes the alias for a live agent (called after an admin update).
func (r *Registry) UpdateAlias(id, alias string) {
r.mu.Lock()