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>
33 lines
900 B
Markdown
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.
|