Skip to content

Commit c23c328

Browse files
committed
init relay
0 parents  commit c23c328

51 files changed

Lines changed: 11614 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v5
18+
with:
19+
go-version: "1.25"
20+
21+
- name: Download dependencies
22+
run: go mod download
23+
24+
- name: Run tests
25+
run: go test -v ./...

.gitignore

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Binaries
2+
bin/
3+
*.exe
4+
*.exe~
5+
*.dll
6+
*.so
7+
*.dylib
8+
9+
# Test binary, built with `go test -c`
10+
*.test
11+
12+
# Output of the go coverage tool
13+
*.out
14+
15+
# IDE
16+
.idea/
17+
.vscode/
18+
*.swp
19+
*.swo
20+
21+
# OS
22+
.DS_Store
23+
Thumbs.db
24+

README.md

Lines changed: 426 additions & 0 deletions
Large diffs are not rendered by default.

agent.go

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package relay
2+
3+
import (
4+
"slices"
5+
"time"
6+
)
7+
8+
// -----------------------------------------------------------------------------
9+
// Agent Domain Types
10+
// -----------------------------------------------------------------------------
11+
12+
// AgentInfo contains metadata about a connected agent.
13+
// This is used for agent discovery, selection, and monitoring.
14+
type AgentInfo struct {
15+
// ID is the unique identifier for this agent.
16+
ID AgentID `json:"id"`
17+
18+
// Capabilities lists what this agent can do (pty, tunnels, k8s, etc.).
19+
Capabilities []Capability `json:"capabilities"`
20+
21+
// ConnectedAt is when this agent established its connection.
22+
ConnectedAt time.Time `json:"connected_at"`
23+
24+
// LastHeartbeat is the timestamp of the most recent heartbeat.
25+
LastHeartbeat time.Time `json:"last_heartbeat"`
26+
27+
// Version is the agent software version (for compatibility checks).
28+
Version string `json:"version,omitempty"`
29+
30+
// Hostname is the agent's hostname (informational).
31+
Hostname string `json:"hostname,omitempty"`
32+
}
33+
34+
// HasCapability checks if the agent has a specific capability.
35+
func (a *AgentInfo) HasCapability(cap Capability) bool {
36+
return slices.Contains(a.Capabilities, cap)
37+
}

0 commit comments

Comments
 (0)