Documentation ¶
Index ¶
- Variables
- func AddKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) (err error)
- func AsExport(env []string) string
- func CheckKnownHost(host string, remote net.Addr, key ssh.PublicKey, knownFile string) (found bool, err error)
- func ExecTTY(host string, user string, port uint8, cmd string, envs []string) error
- func InitAuthMethod(globalIdentityFile string, globalPassword string, identities []Identity) (ssh.AuthMethod, error)
- func RunTableCmd(t TaskContext, data dao.TableOutput, dataMutex *sync.RWMutex, ...) error
- func RunTextCmd(t TaskContext, textStyle dao.Text, prefix string, parallel bool, ...) error
- func SSHToServer(host string, user string, port uint8, disableVerifyHost bool, ...) error
- func VerifyHost(knownHostsFile string, mu *sync.Mutex, host string, remote net.Addr, ...) error
- type Client
- type ErrConnect
- type Identity
- type LocalhostClient
- func (c *LocalhostClient) Close() error
- func (c *LocalhostClient) Connect(_ bool, _ string, mu *sync.Mutex) *ErrConnect
- func (c *LocalhostClient) GetHost() string
- func (c *LocalhostClient) Prefix() string
- func (c *LocalhostClient) Run(env []string, cmdStr string) error
- func (c *LocalhostClient) Signal(sig os.Signal) error
- func (c *LocalhostClient) Stderr() io.Reader
- func (c *LocalhostClient) Stdin() io.WriteCloser
- func (c *LocalhostClient) Stdout() io.Reader
- func (c *LocalhostClient) Wait() error
- func (c *LocalhostClient) Write(p []byte) (n int, err error)
- func (c *LocalhostClient) WriteClose() error
- type Run
- func (run *Run) CheckTaskNoColor()
- func (run *Run) CleanupClients()
- func (run *Run) ParseTask(configEnv []string, userArgs []string, runFlags *core.RunFlags, ...) error
- func (run *Run) RunTask(userArgs []string, runFlags *core.RunFlags, setRunFlags *core.SetRunFlags) error
- func (run *Run) SetClients(runFlags *core.RunFlags, numChannels int, clientCh chan Client, ...) ([]ErrConnect, error)
- func (run *Run) Table(dryRun bool) dao.TableOutput
- func (run *Run) TableWork(rIndex int, dryRun bool, data dao.TableOutput, dataMutex *sync.RWMutex) error
- func (run *Run) Text(dryRun bool)
- func (run *Run) TextWork(rIndex int, prefixMaxLen int, dryRun bool) error
- type SSHClient
- func (c *SSHClient) Close() error
- func (c *SSHClient) Connect(disableVerifyHost bool, knownHostsFile string, mu *sync.Mutex) *ErrConnect
- func (c *SSHClient) ConnectWith(dialer SSHDialFunc, disableVerifyHost bool, knownHostsFile string, ...) *ErrConnect
- func (sc *SSHClient) DialThrough(net, addr string, config *ssh.ClientConfig) (*ssh.Client, error)
- func (c *SSHClient) GetHost() string
- func (c *SSHClient) Prefix() string
- func (c *SSHClient) Run(env []string, cmdStr string) error
- func (c *SSHClient) Signal(sig os.Signal) error
- func (c *SSHClient) Stderr() io.Reader
- func (c *SSHClient) Stdin() io.WriteCloser
- func (c *SSHClient) Stdout() io.Reader
- func (c *SSHClient) Wait() error
- func (c *SSHClient) Write(p []byte) (n int, err error)
- func (c *SSHClient) WriteClose() error
- type SSHDialFunc
- type TaskContext
Constants ¶
This section is empty.
Variables ¶
var DefaultTimeout = 20 * time.Second
var ResetColor = "\033[0m"
Functions ¶
func AddKnownHost ¶
func AsExport ¶
Process all ENVs into a string of form Example output: export FOO="bar"; export BAR="baz";
func CheckKnownHost ¶
func InitAuthMethod ¶
func InitAuthMethod(globalIdentityFile string, globalPassword string, identities []Identity) (ssh.AuthMethod, error)
InitAuthMethod initiates SSH authentication method. if identity_file, use that file if identity_file + passphrase, use that file with the passphrase if passphrase, use passphrase connect if nothing, attempt to use SSH Agent
func RunTableCmd ¶
func RunTableCmd(t TaskContext, data dao.TableOutput, dataMutex *sync.RWMutex, wg *sync.WaitGroup) error
func RunTextCmd ¶
func SSHToServer ¶
Types ¶
type ErrConnect ¶
type LocalhostClient ¶
Client is a wrapper over the SSH connection/sessions.
func (*LocalhostClient) Close ¶
func (c *LocalhostClient) Close() error
func (*LocalhostClient) Connect ¶
func (c *LocalhostClient) Connect(_ bool, _ string, mu *sync.Mutex) *ErrConnect
func (*LocalhostClient) GetHost ¶
func (c *LocalhostClient) GetHost() string
func (*LocalhostClient) Prefix ¶
func (c *LocalhostClient) Prefix() string
func (*LocalhostClient) Run ¶
func (c *LocalhostClient) Run(env []string, cmdStr string) error
func (c *LocalhostClient) Run(envs string, cmdStr string) error {
func (*LocalhostClient) Stderr ¶
func (c *LocalhostClient) Stderr() io.Reader
func (*LocalhostClient) Stdin ¶
func (c *LocalhostClient) Stdin() io.WriteCloser
func (*LocalhostClient) Stdout ¶
func (c *LocalhostClient) Stdout() io.Reader
func (*LocalhostClient) Wait ¶
func (c *LocalhostClient) Wait() error
func (*LocalhostClient) WriteClose ¶
func (c *LocalhostClient) WriteClose() error
type Run ¶
type Run struct { LocalClients map[string]Client RemoteClients map[string]Client Servers []dao.Server Task *dao.Task Config dao.Config }
func (*Run) CheckTaskNoColor ¶
func (run *Run) CheckTaskNoColor()
func (*Run) CleanupClients ¶
func (run *Run) CleanupClients()
func (*Run) SetClients ¶
func (run *Run) SetClients( runFlags *core.RunFlags, numChannels int, clientCh chan Client, errCh chan ErrConnect, ) ([]ErrConnect, error)
SetClients establishes connection to server InitAuthMethod if identity_file, use that file if identity_file + passphrase, use that file with the passphrase if passphrase, use passphrase connect if nothing, attempt to use SSH Agent
type SSHClient ¶
type SSHClient struct { Name string User string Host string Port uint8 IdentityFile string Password string AuthMethod ssh.AuthMethod // contains filtered or unexported fields }
Client is a wrapper over the SSH connection/sessions.
func (*SSHClient) Connect ¶
func (c *SSHClient) Connect(disableVerifyHost bool, knownHostsFile string, mu *sync.Mutex) *ErrConnect
Connect creates SSH connection to a specified host. It expects the host of the form "[ssh://]host[:port]".
func (*SSHClient) ConnectWith ¶
func (c *SSHClient) ConnectWith(dialer SSHDialFunc, disableVerifyHost bool, knownHostsFile string, mu *sync.Mutex) *ErrConnect
ConnectWith creates a SSH connection to a specified host. It will use dialer to establish the connection.
func (*SSHClient) DialThrough ¶
DialThrough will create a new connection from the ssh server sc is connected to. DialThrough is an SSHDialer.
func (*SSHClient) Stdin ¶
func (c *SSHClient) Stdin() io.WriteCloser
func (*SSHClient) Wait ¶
Wait waits until the remote command finishes and exits. It closes the SSH session.
func (*SSHClient) WriteClose ¶
type SSHDialFunc ¶
SSHDialFunc can dial an ssh server and return a client
type TaskContext ¶
type TaskContext struct {
// contains filtered or unexported fields
}