Documentation ¶
Index ¶
- Constants
- func MustCreateDefaultKeyBasedAuth() []ssh.AuthMethod
- func MustCreateKeyBasedAuth(keyFile string) []ssh.AuthMethod
- func MustCreateNewPwdBasedAuth(pwd string) []ssh.AuthMethod
- func NewKeyBasedAuth(keyFile string) ([]ssh.AuthMethod, error)
- func NewPwdBasedAuth(pwd string) ([]ssh.AuthMethod, error)
- type ConsoleLogger
- type LocalNode
- type Logger
- type Node
- type SSHConfig
- type SSHNode
- type Tunnel
- func (w *Tunnel) CD(dir string)
- func (w *Tunnel) CDRaw(dir string) error
- func (w *Tunnel) LastDir() string
- func (w *Tunnel) Logger() Logger
- func (w *Tunnel) Node() Node
- func (w *Tunnel) Run(name string, arg ...string)
- func (w *Tunnel) RunRaw(name string, arg ...string) error
- func (w *Tunnel) RunSync(cmd string) []byte
- func (w *Tunnel) RunSyncRaw(cmd string) ([]byte, error)
Constants ¶
const ( LogLevelError = iota LogLevelWarning = iota LogLevelInfo = iota LogLevelVerbose = iota )
Variables ¶
This section is empty.
Functions ¶
func MustCreateDefaultKeyBasedAuth ¶
func MustCreateDefaultKeyBasedAuth() []ssh.AuthMethod
Creates a new ssh.AuthMethod with the default key file("~/.ssh/id_rsa").
func MustCreateKeyBasedAuth ¶
func MustCreateKeyBasedAuth(keyFile string) []ssh.AuthMethod
Creates a new ssh.AuthMethod with the given key file, panics if there is an error.
func MustCreateNewPwdBasedAuth ¶
func MustCreateNewPwdBasedAuth(pwd string) []ssh.AuthMethod
Creates a new ssh.AuthMethod with the given password, panics if there is an error.
func NewKeyBasedAuth ¶
func NewKeyBasedAuth(keyFile string) ([]ssh.AuthMethod, error)
Creates a new ssh.AuthMethod with the given key file.
func NewPwdBasedAuth ¶
func NewPwdBasedAuth(pwd string) ([]ssh.AuthMethod, error)
Creates a new ssh.AuthMethod with the given password.
Types ¶
type ConsoleLogger ¶
type ConsoleLogger struct { }
func NewConsoleLogger ¶
func NewConsoleLogger() *ConsoleLogger
func (*ConsoleLogger) Log ¶
func (c *ConsoleLogger) Log(level int, message string)
type LocalNode ¶
type LocalNode struct { }
LocalNode is used for running commands locally.
func NewLocalNode ¶
func NewLocalNode() *LocalNode
type Node ¶
type Node interface { // RunCmd runs the given command, returns an error if the command fails. RunCmd(wd string, name string, arg ...string) error // RunCmdSync runs the given command, returns the output and an error if the command fails. RunCmdSync(wd string, cmd string) ([]byte, error) }
Node is an interface for running commands in a specific environment.
type SSHConfig ¶
type SSHConfig struct { Host string User string Port int Auth []ssh.AuthMethod }
SSHConfig is the configuration for SSHNode.
type SSHNode ¶
type SSHNode struct { Logger Logger // contains filtered or unexported fields }
SSHNode is a node that runs commands on a remote SSH server.
func MustCreateSSHNode ¶
Creates a new SSH node with the given configuration, panics if there is an error.
func NewSSHNode ¶
Creates a new SSH node with the given configuration.
type Tunnel ¶
type Tunnel struct {
// contains filtered or unexported fields
}
Tunnel is a wrapper for a node that provides a logger.