feat: funciones SSH para infra — conn, check, exec, download, upload, tunnel

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>
This commit is contained in:
2026-04-02 22:03:41 +02:00
parent 2b123e0c87
commit 560cbf280e
19 changed files with 729 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
package infra
import (
"fmt"
"os"
"syscall"
)
// SSHTunnelClose cierra un tunel SSH enviando SIGTERM al proceso por PID.
func SSHTunnelClose(pid int) error {
proc, err := os.FindProcess(pid)
if err != nil {
return fmt.Errorf("ssh tunnel close: process %d not found: %w", pid, err)
}
err = proc.Signal(syscall.SIGTERM)
if err != nil {
return fmt.Errorf("ssh tunnel close: cannot signal PID %d: %w", pid, err)
}
return nil
}