ssh

package
v0.0.0-...-d70e375 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Overview

Copyright 2020 Platform9 Systems Inc.

Index

Constants

This section is empty.

Variables

View Source
var (
	SudoPassword string
)

Functions

This section is empty.

Types

type Client

type Client interface {
	// RunCommand executes the remote command returning the stdout, stderr and any error associated with it
	RunCommand(cmd string) ([]byte, []byte, error)
	// Uploadfile uploads the srcFile to remoteDestFilePath and changes the mode to the filemode
	UploadFile(srcFilePath, remoteDstFilePath string, mode os.FileMode, cb func(read int64, total int64)) error
	// Downloadfile downloads the remoteFile to localFile and changes the mode to the filemode
	DownloadFile(remoteFile, localPath string, mode os.FileMode, cb func(read int64, total int64)) error
}

Client interface provides ways to run command and upload files to remote hosts

func NewClient

func NewClient(host string, port int, username string, privateKey []byte, password, proxyURL string) (Client, error)

NewClient creates a new Client that can be used to perform action on a machine

type ProgressCBReader

type ProgressCBReader struct {
	TotalSize  int64
	ReadCount  int64
	ProgressCB func(read int64, total int64)
	OrigReader io.Reader
}

ProgressCBReader implements a reader that can call back a function on regular interval to report progress

func (*ProgressCBReader) Read

func (r *ProgressCBReader) Read(p []byte) (int, error)

Jump to

Keyboard shortcuts

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