ssh

package
v1.32.1 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2021 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrKeyGeneration     = errors.New("Unable to generate key")
	ErrPrivateKey        = errors.New("Unable to marshal private key")
	ErrPublicKey         = errors.New("Unable to convert public key")
	ErrUnableToWriteFile = errors.New("Unable to write file")
)

Functions

func GenerateSSHKey added in v1.20.0

func GenerateSSHKey(path string) error

GenerateSSHKey generates SSH keypair based on path of the private key The public key would be generated to the same path with ".pub" added

Types

type Client added in v1.20.0

type Client interface {
	Run(command string) ([]byte, []byte, error)
	Close()
}

func NewClient added in v1.20.0

func NewClient(user string, host string, port int, keys ...string) (Client, error)

type KeyPair added in v1.20.0

type KeyPair struct {
	PrivateKey []byte
	PublicKey  []byte
}

func NewKeyPair added in v1.20.0

func NewKeyPair() (keyPair *KeyPair, err error)

NewKeyPair generates a new SSH keypair This will return a private & public key encoded as DER.

func (*KeyPair) WriteToFile added in v1.20.0

func (kp *KeyPair) WriteToFile(privateKeyPath string, publicKeyPath string) error

WriteToFile writes keypair to files

type NativeClient added in v1.20.0

type NativeClient struct {
	User     string
	Hostname string
	Port     int
	Keys     []string
	// contains filtered or unexported fields
}

func (*NativeClient) Close added in v1.20.0

func (client *NativeClient) Close()

func (*NativeClient) Run added in v1.20.0

func (client *NativeClient) Run(command string) ([]byte, []byte, error)

type Runner added in v1.14.0

type Runner struct {
	// contains filtered or unexported fields
}

func CreateRunner

func CreateRunner(ip string, port int, privateKeys ...string) (*Runner, error)

func (*Runner) Close added in v1.20.0

func (runner *Runner) Close()

func (*Runner) CopyData added in v1.14.0

func (runner *Runner) CopyData(data []byte, destFilename string, mode os.FileMode) error

func (*Runner) CopyFile added in v1.15.0

func (runner *Runner) CopyFile(srcFilename string, destFilename string, mode os.FileMode) error

func (*Runner) Run added in v1.14.0

func (runner *Runner) Run(cmd string, args ...string) (string, string, error)

func (*Runner) RunPrivate added in v1.14.0

func (runner *Runner) RunPrivate(cmd string, args ...string) (string, string, error)

func (*Runner) RunPrivileged added in v1.20.0

func (runner *Runner) RunPrivileged(reason string, cmdAndArgs ...string) (string, string, error)

func (*Runner) WaitForConnectivity added in v1.29.0

func (runner *Runner) WaitForConnectivity(ctx context.Context, timeout time.Duration) error

Jump to

Keyboard shortcuts

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