Documentation
¶
Overview ¶
Package ssh implements the ussycode SSH gateway server. Users SSH into this server and interact with a custom shell, not a system shell. The gateway identifies users by their SSH public key fingerprint and routes them to registration or the main shell accordingly.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CalculateELO ¶
CalculateELO computes new ELO ratings for two players after a match. result: 1.0 = player A wins, 0.0 = player B wins, 0.5 = draw. Returns (newRatingA, newRatingB).
func RegisterCommand ¶
func RegisterCommand(name string, fn CommandFunc)
RegisterCommand adds a command to the commands map at runtime. Used by packages that would cause init cycles if registered statically.
Types ¶
type APIExecutor ¶
type APIExecutor struct {
// contains filtered or unexported fields
}
APIExecutor executes the SSH command surface programmatically for the HTTPS API. It reuses the same command handlers as the interactive SSH shell so the SSH and HTTP surfaces stay aligned.
func NewAPIExecutor ¶
func NewAPIExecutor(gw *Gateway) *APIExecutor
NewAPIExecutor creates a programmatic executor backed by the SSH command map.
type ArenaScenario ¶
type ArenaScenario struct {
Name string `json:"name"`
Description string `json:"description"`
DurationMinutes int `json:"duration_minutes"`
MaxAgents int `json:"max_agents"`
Ports []int `json:"ports,omitempty"`
}
ArenaScenario represents a scenario definition loaded from templates/arena/.
type CommandFunc ¶
CommandFunc is a handler for a shell command.
type Gateway ¶
type Gateway struct {
DB *db.DB
VM *vm.Manager
Metadata *gateway.Server
Proxy *proxy.Manager
LLMGateway gateway.LLMGateway
// RoutussyURL is the base URL of the Routussy proxy for SSH key validation
// and API key lookup. If empty, all SSH keys are accepted (legacy behavior).
RoutussyURL string
// RoutussyInternalKey is the shared secret for authenticating to Routussy
// internal API endpoints. Sent as Bearer token.
RoutussyInternalKey string
// contains filtered or unexported fields
}
Gateway is the SSH gateway server.
func New ¶
func New(database *db.DB, vmManager *vm.Manager, metaSrv *gateway.Server, proxyMgr *proxy.Manager, hostKeyPath, addr, domain string) (*Gateway, error)
New creates a new SSH gateway. If the host key file doesn't exist, it generates a new ed25519 key.
func (*Gateway) ListenAndServe ¶
ListenAndServe starts the SSH server.
func (*Gateway) LookupRoutussyUser ¶
LookupRoutussyUser queries routussy for a user by SSH fingerprint and returns their metadata. Used to inject API keys into VM environments.
type Lesson ¶
type Lesson struct {
Number int
Title string
Explanation string
Command string // the expected command the user should type
Hint string // shown if the user gets stuck
Simulate bool // if true, lesson is informational-only (no command validation)
}
Lesson represents a single tutorial lesson with explanation and validation.