cfdf515228
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
40 lines
1005 B
Markdown
40 lines
1005 B
Markdown
---
|
|
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, pendiente-usar]
|
|
uses_functions: []
|
|
uses_types: []
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt, os, syscall]
|
|
params:
|
|
- name: pid
|
|
desc: "ID del proceso ssh del tunel abierto (obtenido de ssh_tunnel_open)"
|
|
output: "nil si el tunel se cerro exitosamente, error en caso contrario"
|
|
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.
|