Documentation
¶
Index ¶
Constants ¶
const DefaultConnectTimeout = 20 * time.Second
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is a custom SSH client with extra utility methods.
func (*Client) NewSession ¶
NewSession creates a new Session. A session is used to run a command.
type Dialer ¶
type Dialer struct {
// contains filtered or unexported fields
}
Dialer is responsible for creating new ssh connections with a given set of ssh options.
func NewDialer ¶
func NewDialer(sshOptions SSHOptions) (*Dialer, error)
NewDialer creates a new ssh dialer which will create ssh clients and tunnels based on the provided options.
func (*Dialer) DefaultCommand ¶
DefaultCommand returns a SSH command with default flags set.
func (*Dialer) DialWithSystemSSH ¶
DialWithSystemSSH connects to destination and return a Client. Affected by ssh_config(5).
It uses the ssh command on the system, which understands user SSH configuration (~/.ssh/config) to make the initial connection. A tunnel: a UNIX domain socket is then set to forward traffic to port 22 on the destination system. Then the Client is created, by connecting to the UNIX domain socket. The benefit of doing so is to avoid the need of parsing ssh configuration, while still having a programmatic API, instead of having to deal with ssh child processes.
func (*Dialer) SSHOptions ¶
func (d *Dialer) SSHOptions() SSHOptions
type KeyChain ¶
type KeyChain struct {
// contains filtered or unexported fields
}
func NewKeyChain ¶
NewKeyChain creates a KeyChain holding bundled SSH keys.
KeyChain.Delete() must be called to clean up resources.
func (*KeyChain) SSHAuthMethod ¶
func (kc *KeyChain) SSHAuthMethod() ssh.AuthMethod
SSHAuthMethod returns a ssh.AuthMethod using the keys in the KeyChain.
func (*KeyChain) SSHCommandOptions ¶
SSHCommandOptions returns ssh command line options that uses the keys.
type SSHOptions ¶
SSHOptions is the set of all supported ssh options.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel is a UNIX domain socket forwarded to a remote by the system's SSH command. Tunnel is used to allow x/crypto/ssh to connect to SSH servers with complex configs.
func (*Tunnel) SSHServerSocket ¶
SSHServerSocket returns the path of the UNIX domain socket that forwards to the remote host's TCP port 22.