Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var NewConn = newConn
NewConn create a now connection
var Simulate = func() {
NewConn = newFakeConn
}
Simulate switch connection to output to stdout instead of run on server
Functions ¶
func DefaultSSHKeyPath ¶
func DefaultSSHKeyPath() string
DefaultSSHKeyPath returns default path for ssh key
$HOME/.ssh/id_rsa
Types ¶
type Command ¶
type Command struct { // Interpreter used to run command e.g. sh, bash, ruby Interpreter string // Command lines used to make up a command to be ran Command []string // Additional environment variable to be used in the command Env map[string]string // User to run the command with e.g. root, admin User string }
Command represents a command to be ran on a remote host
type CommandResponse ¶
type CommandResponse struct {
// contains filtered or unexported fields
}
CommandResponse wraps output from stdout and stderr
func (CommandResponse) Stderr ¶
func (commandResposne CommandResponse) Stderr() string
Stderr returns anything written to stderr while running a command
func (CommandResponse) Stdout ¶
func (commandResposne CommandResponse) Stdout() string
Stdout returns anything written to stdout while running a command
type Conn ¶
type Conn interface { ConnectTo(string) error Run(Command) (Response, error) Close() Address() string }
Conn wraps connection, run and close of connection
type LoggerSSHConn ¶
type LoggerSSHConn struct { ConnectedTo string Commands []Command // contains filtered or unexported fields }
LoggerSSHConn log all ssh command to stdout instead of running agains a server
Used for development and simulating configuration runs
func (LoggerSSHConn) Address ¶
func (loggerSSHConn LoggerSSHConn) Address() string
Address of the connection
func (*LoggerSSHConn) Close ¶
func (loggerSSHConn *LoggerSSHConn) Close()
Close mark the connection as closed
func (*LoggerSSHConn) ConnectTo ¶
func (loggerSSHConn *LoggerSSHConn) ConnectTo(hostName string) error
ConnectTo track the host name that would be used to connect to server