sshcmds

package module
v0.0.0-...-da84755 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2022 License: GPL-3.0 Imports: 5 Imported by: 2

README

sshcmds

Golang run SSH commands with multiple Private Keys

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config holds details of each key config

func NewConfig

func NewConfig() *Config

NewConfig creates a new instance of the Config struct

func (*Config) AddKey

func (c *Config) AddKey(userName, keyFile string) (err error)

AddKey appends an SSH private key to the list of keys

func (*Config) Auth

func (c *Config) Auth(hostname string) (client *ssh.Client, err error)

Auth returns an ssh.Client struct after successfully authenticating with a key.

func (*Config) Cmd

func (c *Config) Cmd(client *ssh.Client, cmd string) (b bytes.Buffer, err error)

Cmd runs a single command against a previously authenticated session and returns the output as a Byte buffer.

Jump to

Keyboard shortcuts

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