Documentation
¶
Index ¶
- func CheckSSHPort(host string, port int, timeout time.Duration) bool
- func DownloadFile(client *ssh.Client, remotePath, localFile string, progress ProgressDisplayer) error
- func ExecCommand(client *ssh.Client, command string) ([]byte, error)
- func ExecuteSSHShell(cfg SSHConfig) error
- func GetDefaultPrivateKeys() []cssh.AuthMethod
- func InitMultiClients(selectedConfigs []SSHConfig) ([]*cssh.Client, error)
- func LoadIdentifyFile(privateKeyPath string) (cssh.Signer, error)
- func LoadSCPHistory(path string) error
- func NormalizeLocalAddr(addr string) string
- func NormalizeRemoteAddr(addr string) string
- func PutExecEntry(host string, entry ExecHistoryEntry)
- func PutSCPDownloadEntry(host string, entry SCPHistoryEntry)
- func PutSCPUploadEntry(host string, entry SCPHistoryEntry)
- func SSHClient(cfg SSHConfig) (*cssh.Client, error)
- func UploadFile(client *ssh.Client, localFile, remotePath string, progress ProgressDisplayer) error
- type ExecHistoryEntry
- type Forward
- type HostHistoryEntry
- type PortForward
- type ProgressDisplayer
- type SCPHistoryEntry
- type SSHConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
func DownloadFile(client *ssh.Client, remotePath, localFile string, progress ProgressDisplayer) error
func ExecCommand ¶ added in v0.3.0
func ExecuteSSHShell ¶
func GetDefaultPrivateKeys ¶ added in v0.2.0
func GetDefaultPrivateKeys() []cssh.AuthMethod
func InitMultiClients ¶ added in v0.3.3
func LoadSCPHistory ¶ added in v0.2.0
func NormalizeLocalAddr ¶ added in v0.6.0
NormalizeLocalAddr turns "8080" into "127.0.0.1:8080" and leaves "host:port" untouched.
func NormalizeRemoteAddr ¶ added in v0.6.0
NormalizeRemoteAddr turns "80" into "localhost:80" and leaves "host:port" untouched.
func PutExecEntry ¶ added in v0.3.0
func PutExecEntry(host string, entry ExecHistoryEntry)
func PutSCPDownloadEntry ¶ added in v0.2.0
func PutSCPDownloadEntry(host string, entry SCPHistoryEntry)
func PutSCPUploadEntry ¶ added in v0.2.0
func PutSCPUploadEntry(host string, entry SCPHistoryEntry)
func UploadFile ¶
func UploadFile(client *ssh.Client, localFile, remotePath string, progress ProgressDisplayer) error
Types ¶
type ExecHistoryEntry ¶ added in v0.3.0
type ExecHistoryEntry struct {
Command string
}
func GetExecEntry ¶ added in v0.3.0
func GetExecEntry(host string) ExecHistoryEntry
type Forward ¶ added in v0.6.0
Forward is a saved local port forward, with both sides normalized.
func NewForward ¶ added in v0.6.0
func ParseLFlag ¶ added in v0.6.0
ParseLFlag parses ssh -L syntax: "[bind:]port:host:hostport", or a lone "port" for the same port on the remote host's localhost.
func ParseLocalForward ¶ added in v0.6.0
ParseLocalForward parses the value of an ssh_config LocalForward line: "[bind_address:]port host:hostport".
func (Forward) ConfigValue ¶ added in v0.6.0
ConfigValue renders f as an ssh_config LocalForward value, omitting the default 127.0.0.1 bind address like OpenSSH users usually write it.
type HostHistoryEntry ¶ added in v0.3.0
type HostHistoryEntry struct {
SCPHistoryEntry
ExecHistoryEntry
}
type PortForward ¶ added in v0.6.0
type PortForward struct {
Host string
Local string // actual listening address
Remote string
Spec Forward // what was asked for, as saved in config
// contains filtered or unexported fields
}
PortForward is a local (-L style) port forward: connections accepted on Local are tunneled through the SSH host and dialed to Remote from there. It stays open until Close is called, reconnecting the SSH client if the connection drops.
func StartPortForward ¶ added in v0.6.0
func StartPortForward(cfg SSHConfig, spec Forward) (*PortForward, error)
func (*PortForward) ActiveConns ¶ added in v0.6.0
func (f *PortForward) ActiveConns() int64
ActiveConns is the number of currently tunneled connections.
func (*PortForward) Close ¶ added in v0.6.0
func (f *PortForward) Close() error
func (*PortForward) String ¶ added in v0.6.0
func (f *PortForward) String() string
type ProgressDisplayer ¶ added in v0.4.1
type SCPHistoryEntry ¶ added in v0.2.0
func GetSCPDownloadEntry ¶ added in v0.2.0
func GetSCPDownloadEntry(host string) SCPHistoryEntry
func GetSCPUploadEntry ¶ added in v0.2.0
func GetSCPUploadEntry(host string) SCPHistoryEntry
type SSHConfig ¶
type SSHConfig struct {
Host string
User string
Port string
HostName string
IdentityFile string
Password string
// Managed hosts exist only in s1h's credentials file (added by older
// versions); they move to ~/.ssh/config when edited.
Managed bool
// CredsEndpoint is set when HostName/User/Port come from the credentials
// file, overriding ~/.ssh/config.
CredsEndpoint bool
// LocalForwards are the saved port forwards (LocalForward lines).
LocalForwards []Forward
}