Documentation
¶
Overview ¶
Package ssher allows you to easily create ssh connections in golang.
This package is essentially a wrapper around https://github.com/kevinburke/ssh_config, which attempts to automatically load all values required to create a https://golang.org/x/crypto/ssh ClientConfig from your ~/.ssh/config.
Most people will already have configured their ssh connections once for openssh, so why do it again manually?
Currently supported options:
- Ciphers
- ConnectTimeout
- HostKeyAlgorithms
- Hostname
- IdentityFile
- KexAlgorithms
- MACs
- Port
- User
- UserKnownHostsFile
Currently, only public key auth is attempted, and only the agent and one IdentityFile will be used.
Host key checking is enforced.
Any limitations that apply to https://github.com/kevinburke/ssh_config also apply here (currently no support for +value syntax).
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClientConfig ¶
ClientConfig takes in an ssh config file host alias and a path to an ssh config file, and returns an ssh.ClientConfig and a connection string (for dialing). If passed an empty string for the configFile, it will use the default config file paths: ~/.ssh/config and /etc/ssh/ssh_config
Example (Custom) ¶
sshConfig, hostPort, err := ClientConfig("myhost.mydomain.com", "~/somedir/my_ssh_config") if err != nil { // Handle error here... } _, err = ssh.Dial("tcp", hostPort, sshConfig) if err != nil { // Handle error here... }
Output:
Example (Defaults) ¶
sshConfig, hostPort, err := ClientConfig("myhost.mydomain.com", "") if err != nil { // Handle error here... } _, err = ssh.Dial("tcp", hostPort, sshConfig) if err != nil { // Handle error here... }
Output:
Types ¶
This section is empty.