5f4f1f7508
Añade campos params y output al frontmatter YAML de las 506 funciones del registry. Cada parámetro tiene descripción semántica (qué representa, unidades, rango típico) y cada función describe qué produce su output. Permite a agentes razonar sobre cadenas de composición (ej: prices → log_return → sharpe_ratio) sin leer código.
1.6 KiB
1.6 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ssh_tunnel_open | function | go | infra | 1.0.0 | impure | func SSHTunnelOpen(conn SSHConn, localPort int, remoteHost string, remotePort int) (int, error) | Abre un tunel SSH (local port forwarding) en background. Retorna el PID del proceso para cerrarlo despues. |
|
|
false | error_go_core |
|
|
PID del proceso ssh del tunel para cerrarlo despues | true |
|
functions/infra/ssh_tunnel_test.go | functions/infra/ssh_tunnel_open.go |
Ejemplo
conn := SSHConn{Host: "bastion.example.com", User: "deploy"}
// Tunel: localhost:5432 -> db-server:5432 via bastion
pid, err := SSHTunnelOpen(conn, 5432, "db-server", 5432)
if err != nil {
log.Fatal(err)
}
fmt.Println("tunnel PID:", pid)
// Usar localhost:5432 para conectar a la BD remota
// Cerrar con SSHTunnelClose(pid)
Notas
Usa ssh -N -f -L para crear el tunel en background. ExitOnForwardFailure=yes falla inmediatamente si el puerto local esta ocupado. remoteHost vacio se interpreta como "localhost" (el servidor SSH mismo). El PID se obtiene buscando el proceso ssh en la tabla de procesos.