Files
fn_registry/functions/infra/ssh_upload.md
T
egutierrez 560cbf280e 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>
2026-04-02 22:03:41 +02:00

33 lines
900 B
Markdown

---
name: ssh_upload
kind: function
lang: go
domain: infra
version: "1.0.0"
purity: impure
signature: "func SSHUpload(conn SSHConn, localPath, remotePath string) error"
description: "Sube un archivo local al host remoto via scp."
tags: [ssh, scp, upload, file, transfer, 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: ["upload y download roundtrip"]
test_file_path: "functions/infra/ssh_transfer_test.go"
file_path: "functions/infra/ssh_upload.go"
---
## Ejemplo
```go
conn := SSHConn{Host: "192.168.1.100", User: "deploy", KeyPath: "~/.ssh/id_ed25519"}
err := SSHUpload(conn, "./config.yaml", "/home/deploy/app/config.yaml")
```
## Notas
Usa scp con -P para el puerto (distinto a ssh que usa -p). Para subir directorios, usar SSHExec con tar/rsync como alternativa.