ab7317b0c0
7 funciones Go del dominio infra para gestion programatica de ~/.ssh/config: ssh_config_parse (parser de bloques Host/Match), ssh_config_read (lectura del archivo), ssh_config_find (busqueda por host), ssh_config_add_entry y ssh_config_remove_entry (CRUD), ssh_config_render (serializacion a texto), ssh_config_write (escritura atomica). Incluye tipo SshConfigEntry (product type) y tests unitarios del parser.
1.3 KiB
1.3 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_config_parse | function | go | infra | 1.0.0 | pure | func SSHConfigParse(content string) []SSHConfigEntry | Parsea el contenido de un archivo ~/.ssh/config y retorna una lista de SSHConfigEntry. |
|
|
false |
|
|
lista de SSHConfigEntry, uno por cada bloque Host (sin wildcards) | true |
|
functions/infra/ssh_config_parse_test.go | functions/infra/ssh_config_parse.go |
Ejemplo
content := `Host myserver
HostName 192.168.1.100
User deploy
Port 2222
IdentityFile ~/.ssh/id_ed25519`
entries := SSHConfigParse(content)
// entries[0].Alias == "myserver"
// entries[0].HostName == "192.168.1.100"
Notas
Ignora bloques Host * y Host 192.168.?.* (wildcards). Soporta directivas con separador espacio o =. Las directivas no reconocidas se almacenan en el map Options.