Documentation
¶
Overview ¶
Package sshc provides sshc.NewClient() that returns *ssh.Client using ssh_config(5)
Index ¶
- func Dial(dc *DialConfig) (*ssh.Client, error)
- func NewClient(host string, options ...Option) (*ssh.Client, error)
- type Config
- type DialConfig
- type KeyAndPassphrase
- type Option
- func AppendConfigData(b []byte) Option
- func AppendConfigPath(p string) Option
- func AuthMethod(m ssh.AuthMethod) Option
- func ClearConfig() Option
- func ConfigData(b []byte) Option
- func ConfigPath(p string) Option
- func DialTimeoutFunc(fn func(network, addr string, timeout time.Duration) (net.Conn, error)) Option
- func Hostname(h string) Option
- func IdentityFile(f string, hostPatterns ...string) Option
- func IdentityFileWithPassphrase(f string, passphrase []byte, hostPatterns ...string) Option
- func IdentityKey(b []byte, hostPatterns ...string) Option
- func IdentityKeyWithPassphrase(b, passphrase []byte, hostPatterns ...string) Option
- func Knownhosts(files ...string) Option
- func Passphrase(p []byte) Option
- func Password(pass string) Option
- func Port(p int) Option
- func UnshiftConfigData(b []byte) Option
- func UnshiftConfigPath(p string) Option
- func UseAgent(u bool) Option
- func User(u string) Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the type for the SSH Client config. not ssh_config.
type DialConfig ¶
type DialConfig struct { Hostname string User string Port int UseAgent bool Knownhosts []string KeyAndPassphrases []KeyAndPassphrase ProxyCommand string ProxyJump string Password string Timeout time.Duration Wd string Auth []ssh.AuthMethod DialTimeoutFunc func(network, addr string, timeout time.Duration) (net.Conn, error) }
type KeyAndPassphrase ¶
type KeyAndPassphrase struct {
// contains filtered or unexported fields
}
type Option ¶
Option is the type for change Config.
func AppendConfigData ¶
AppendConfigData returns Option that append ssh_config data to Config.configs.
func AppendConfigPath ¶
AppendConfigPath returns Option that append ssh_config path to Config.configs.
func AuthMethod ¶
func AuthMethod(m ssh.AuthMethod) Option
AuthMethod returns Option that append ssh.AuthMethod to Config.auth
func ConfigData ¶
ConfigData returns Option that unshift ssh_config data to Config.configs (alias of UnshiftConfigPath).
func ConfigPath ¶
ConfigPath returns Option that unshift ssh_config path to Config.configs (alias of UnshiftConfigPath).
func DialTimeoutFunc ¶ added in v4.2.0
DialTimeoutFunc returns Option that set Config.dialTimeoutFunc for set SSH client dial func
func IdentityFile ¶
IdentityFile returns Option that append to Config.identityKeys for SSH client identity file.
func IdentityFileWithPassphrase ¶
IdentityFileWithPassphrase returns Option that append to Config.identityKeys for SSH client identity file.
func IdentityKey ¶
IdentityKey returns Option that append to Config.identityKeys for SSH client identity file.
func IdentityKeyWithPassphrase ¶
IdentityKeyWithPassphrase returns Option that append to Config.identityKeys for SSH client identity file.
func Knownhosts ¶
Knownhosts returns Option that override Config.knownhosts.
func Passphrase ¶
Passphrase returns Option that set Config.passphrase for set SSH key passphrase.
func UnshiftConfigData ¶
UnshiftConfigData returns Option that unshift ssh_config data to Config.configs.
func UnshiftConfigPath ¶
UnshiftConfigPath returns Option that unshift ssh_config path to Config.configs.