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 b220f8c0be
commit 6d0d63cb23
19 changed files with 729 additions and 0 deletions
+35
View File
@@ -0,0 +1,35 @@
---
name: ssh_tunnel_close
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func SSHTunnelClose(pid int) error"
description: "Cierra un tunel SSH enviando SIGTERM al proceso por PID."
tags: [ssh, tunnel, close, remote]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [fmt, os, syscall]
tested: true
tests: ["abre tunel y lo cierra"]
test_file_path: "functions/infra/ssh_tunnel_test.go"
file_path: "functions/infra/ssh_tunnel_close.go"
---
## Ejemplo
```go
// Abrir tunel
pid, _ := SSHTunnelOpen(conn, 5432, "db-server", 5432)
// ... usar el tunel ...
// Cerrar
err := SSHTunnelClose(pid)
```
## Notas
Envia SIGTERM (cierre limpio) al proceso ssh. El PID viene de SSHTunnelOpen. Si el proceso ya termino, retorna error.