560cbf280e
Conjunto completo de funciones SSH para operaciones remotas: conexión, verificación de host, ejecución de comandos, transferencia de archivos (upload/download) y gestión de túneles. Incluye tipo SSHConn y tests. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
35 lines
1008 B
Markdown
35 lines
1008 B
Markdown
---
|
|
name: ssh_check
|
|
kind: function
|
|
lang: go
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func SSHCheck(conn SSHConn) error"
|
|
description: "Verifica conectividad SSH ejecutando un comando noop en el host remoto. Timeout de 5 segundos."
|
|
tags: [ssh, connection, check, remote]
|
|
uses_functions: []
|
|
uses_types: [ssh_conn_go_infra]
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt, os/exec, strings]
|
|
tested: true
|
|
tests: ["conecta a organic-machine", "falla con host inexistente"]
|
|
test_file_path: "functions/infra/ssh_check_test.go"
|
|
file_path: "functions/infra/ssh_check.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
conn := SSHConn{Host: "192.168.1.100", User: "deploy"}
|
|
if err := SSHCheck(conn); err != nil {
|
|
log.Fatal("no se puede conectar:", err)
|
|
}
|
|
```
|
|
|
|
## Notas
|
|
|
|
Usa BatchMode=yes para fallar inmediatamente si requiere input interactivo (password prompt). ConnectTimeout=5 para no bloquear si el host no responde. StrictHostKeyChecking=accept-new acepta hosts nuevos automaticamente.
|