Files
proxy/internal/tui/snapshot.go
T

24 lines
536 B
Go

package tui
import (
"proxyctl/internal/app"
"proxyctl/internal/profile"
)
func availableTargets(snapshot app.Snapshot) []app.TargetSnapshot {
result := make([]app.TargetSnapshot, 0, len(snapshot.Targets))
for _, item := range snapshot.Targets {
if item.Available {
result = append(result, item)
}
}
return result
}
func profileAt(snapshot app.Snapshot, index int) (profile.Profile, bool) {
if index < 0 || index >= len(snapshot.Profiles) {
return profile.Profile{}, false
}
return snapshot.Profiles[index], true
}