ssh

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2025 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckSSHPort

func CheckSSHPort(host string, port int, timeout time.Duration) bool

func DownloadFile

func DownloadFile(client *ssh.Client, remotePath, localFile string) error

func ExecCommand added in v0.3.0

func ExecCommand(client *ssh.Client, command string) ([]byte, error)

func ExecuteSSHShell

func ExecuteSSHShell(cfg SSHConfig) error

func GetDefaultPrivateKeys added in v0.2.0

func GetDefaultPrivateKeys() []cssh.AuthMethod

func InitMultiClients added in v0.3.3

func InitMultiClients(selectedConfigs []SSHConfig) ([]*cssh.Client, error)

func LoadIdentifyFile

func LoadIdentifyFile(privateKeyPath string) (cssh.Signer, error)

func LoadSCPHistory added in v0.2.0

func LoadSCPHistory(path string) error

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 SSHClient

func SSHClient(cfg SSHConfig) (*cssh.Client, error)

func UploadFile

func UploadFile(client *ssh.Client, localFile, remotePath string) 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 HostHistoryEntry added in v0.3.0

type HostHistoryEntry struct {
	SCPHistoryEntry
	ExecHistoryEntry
}

type SCPHistoryEntry added in v0.2.0

type SCPHistoryEntry struct {
	From string
	To   string
}

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
}

func ParseSSHConfig

func ParseSSHConfig(filePath string) ([]SSHConfig, error)

func (SSHConfig) Endpoint

func (c SSHConfig) Endpoint() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳