47fac22230
- .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>
43 lines
1.1 KiB
Markdown
43 lines
1.1 KiB
Markdown
---
|
|
name: ssh_config_read
|
|
kind: function
|
|
lang: go
|
|
domain: infra
|
|
version: "1.0.0"
|
|
purity: impure
|
|
signature: "func SSHConfigRead() ([]SSHConfigEntry, error)"
|
|
description: "Lee y parsea ~/.ssh/config. Retorna lista vacia si el archivo no existe."
|
|
tags: [ssh, config, read, remote, pendiente-usar]
|
|
uses_functions: [ssh_config_parse_go_infra]
|
|
uses_types: [ssh_config_entry_go_infra]
|
|
returns: []
|
|
returns_optional: false
|
|
error_type: "error_go_core"
|
|
imports: [fmt, os, path/filepath]
|
|
params: []
|
|
output: "lista de SSHConfigEntry parseados del archivo ~/.ssh/config"
|
|
tested: true
|
|
tests:
|
|
- TestSSHConfigRead_Missing
|
|
- TestSSHConfigRead_ParsesExisting
|
|
- TestSSHConfigRead_PermissionError
|
|
test_file_path: "functions/infra/ssh_config_read_test.go"
|
|
file_path: "functions/infra/ssh_config_read.go"
|
|
---
|
|
|
|
## Ejemplo
|
|
|
|
```go
|
|
entries, err := SSHConfigRead()
|
|
if err != nil {
|
|
log.Fatal(err)
|
|
}
|
|
for _, e := range entries {
|
|
fmt.Printf("%s -> %s@%s\n", e.Alias, e.User, e.HostName)
|
|
}
|
|
```
|
|
|
|
## Notas
|
|
|
|
Si `~/.ssh/config` no existe, retorna lista vacia y nil (no es error — el usuario simplemente no tiene config aun). Usa `SSHConfigParse` internamente.
|