Kevin Burke 67c39ca6b4 Implement Get and wildcard match
Lots of changes and new API's here.

Fixes #7.
2017-04-23 11:42:22 -07:00
2017-04-23 11:42:22 -07:00
2017-04-17 11:16:04 -07:00
2017-04-23 11:42:22 -07:00
2017-04-23 11:42:22 -07:00
2017-04-23 11:42:22 -07:00
2017-04-23 11:42:22 -07:00
2017-04-17 11:08:10 -07:00
2017-04-23 11:42:22 -07:00
2017-04-23 11:42:22 -07:00

ssh_config

This is a Go parser for ssh_config files. Importantly, this parser attempts to preserve comments in a given file, so you can manipulate a ssh_config file from a program, if your heart desires.

Example usage:

f, _ := os.Open(filepath.Join(os.Getenv("HOME"), ".ssh", "config"))
cfg, _ := ssh_config.Decode(f)
for _, host := range cfg.Hosts {
    fmt.Println("patterns:", host.Patterns)
    for _, node := range host.Nodes {
        fmt.Println(node.String())
    }
}

// Write the cfg back to disk:
fmt.Println(cfg.String())

The ssh_config program will attempt to read values from $HOME/.ssh/config, falling back to /etc/ssh/ssh_config.

port := ssh_config.Get("myhost", "Port")

Donating

Donations free up time to make improvements to the library, and respond to bug reports. You can send donations via Paypal's "Send Money" feature to kev@inburke.com. Donations are not tax deductible in the USA.

Description
Go parser for SSH config files
Readme MIT 196 KiB
Languages
Go 99%
Makefile 1%