-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.go
More file actions
37 lines (28 loc) · 1.15 KB
/
agent.go
File metadata and controls
37 lines (28 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package relay
import (
"slices"
"time"
)
// -----------------------------------------------------------------------------
// Agent Domain Types
// -----------------------------------------------------------------------------
// AgentInfo contains metadata about a connected agent.
// This is used for agent discovery, selection, and monitoring.
type AgentInfo struct {
// ID is the unique identifier for this agent.
ID AgentID `json:"id"`
// Capabilities lists what this agent can do (pty, tunnels, k8s, etc.).
Capabilities []Capability `json:"capabilities"`
// ConnectedAt is when this agent established its connection.
ConnectedAt time.Time `json:"connected_at"`
// LastHeartbeat is the timestamp of the most recent heartbeat.
LastHeartbeat time.Time `json:"last_heartbeat"`
// Version is the agent software version (for compatibility checks).
Version string `json:"version,omitempty"`
// Hostname is the agent's hostname (informational).
Hostname string `json:"hostname,omitempty"`
}
// HasCapability checks if the agent has a specific capability.
func (a *AgentInfo) HasCapability(cap Capability) bool {
return slices.Contains(a.Capabilities, cap)
}