Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSSHClient ¶
NewSSHClient creates a new SSH client for the given host, username, and identity file.
The host can be in the format of "example.com", "[email protected]:22", or any valid combination of username, hostname, and port. If the port is not specified, it defaults to 22.
If a username is provided, the client will use password authentication. If the username is provided in both the host string and the argument, it will return an error.
If no username is provided, it will try to use an identity file for authentication.
If the identity file is provided, it will be used. Any identity file outside of ~/.ssh will not be accepted for security reasons. Otherwise, the default identity files in the .ssh directory will be tried, e.g., id_ed25519, id_rsa, and id_ecdsa.
In either case, the client will check the host key against the known_hosts file in the ~/.ssh directory.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}