client

package
v0.0.0-...-f386a6d Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2025 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddKnownHost

func AddKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) (err error)

AddKnownHost add a a host to known hosts file.

func CheckKnownHost

func CheckKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) (found bool, err error)

CheckKnownHost checks is host in known hosts file. it returns is the host found in known_hosts file and error, if the host found in known_hosts file and error not nil that means public key mismatch, maybe MAN IN THE MIDDLE ATTACK! you should not handshake.

func DefaultKnownHosts

func DefaultKnownHosts() (ssh.HostKeyCallback, error)

func DefaultKnownHostsPath

func DefaultKnownHostsPath() (string, error)

DefaultKnownHostsPath returns default user knows hosts file.

func KnownHosts

func KnownHosts(file string) (ssh.HostKeyCallback, error)

KnownHosts returns host key callback from a custom known hosts path.

func VerifyHost

func VerifyHost(host string, remote net.Addr, key ssh.PublicKey) error

Types

type SSHClient

type SSHClient struct {
	Config *config.Config
	Cmd    string
	// contains filtered or unexported fields
}

func Init

func Init(c *config.Config) *SSHClient

func (*SSHClient) Download

func (sc *SSHClient) Download(remotePath string, localPath string) (err error)

func (*SSHClient) Exec

func (sc *SSHClient) Exec(flags []string) (int, string)

func (*SSHClient) Upload

func (sc *SSHClient) Upload(localPath string, remotePath string) (err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址