Documentation
¶
Overview ¶
Copyright © 2024-2025 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.
Copyright © 2024-2025 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.
Copyright © 2024-2025 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.
Copyright © 2024-2025 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.
Copyright © 2024-2025 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.
Copyright © 2024-2025 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.
Copyright © 2024-2025 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.
Copyright © 2024-2025 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.
Index ¶
- func ResizeWindowHandler(sigs chan os.Signal, stdin *os.File, session *SshCSession)
- type SshCEmitter
- func (e *SshCEmitter) DebugLog(color bool, args ...interface{})
- func (e *SshCEmitter) Emits(eType SshCExecutorEvent, data map[string]interface{})
- func (e *SshCEmitter) ErrorLog(color bool, args ...interface{})
- func (e *SshCEmitter) GetHostWriterStderr() io.WriteCloser
- func (e *SshCEmitter) GetHostWriterStdout() io.WriteCloser
- func (e *SshCEmitter) GetSshWriterStderr() io.WriteCloser
- func (e *SshCEmitter) GetSshWriterStdout() io.WriteCloser
- func (e *SshCEmitter) InfoLog(color bool, args ...interface{})
- func (e *SshCEmitter) SetHostWriterStderr(w io.WriteCloser)
- func (e *SshCEmitter) SetHostWriterStdout(w io.WriteCloser)
- func (e *SshCEmitter) SetSshWriterStderr(w io.WriteCloser)
- func (e *SshCEmitter) SetSshWriterStdout(w io.WriteCloser)
- func (e *SshCEmitter) WarnLog(color bool, args ...interface{})
- type SshCEmitterWriter
- type SshCExecutor
- func (s *SshCExecutor) BuildChain() (*ssh.Client, error)
- func (s *SshCExecutor) Close()
- func (s *SshCExecutor) GetClient() *ssh.Client
- func (s *SshCExecutor) GetConnProtocol() string
- func (e *SshCExecutor) GetEmitter() SshCExecutorEmitter
- func (s *SshCExecutor) GetEndpoint() string
- func (s *SshCExecutor) GetHost() string
- func (s *SshCExecutor) GetPass() string
- func (s *SshCExecutor) GetPort() int
- func (s *SshCExecutor) GetPrivateKey() string
- func (s *SshCExecutor) GetPrivateKeyPass() string
- func (s *SshCExecutor) GetRuntimeCmdsOutput() bool
- func (s *SshCExecutor) GetSession(n string) (*SshCSession, error)
- func (s *SshCExecutor) GetSftpClient() *sftp.Client
- func (s *SshCExecutor) GetShellSession(n, termType string, h, w int, echo bool) (*SshCSession, error)
- func (s *SshCExecutor) GetShellSessionWithTermSetup(n, termType string, stdin *os.File, stdout, stderr io.Writer) (*SshCSession, TermShellRestoreCb, error)
- func (s *SshCExecutor) GetShowCmdsOutput() bool
- func (s *SshCExecutor) GetUser() string
- func (s *SshCExecutor) RecursiveMkdir(dir string, mode *os.FileMode, uid int, gid int, ensurePerms bool) error
- func (s *SshCExecutor) RecursivePullFile(nodeName, sourcePath, targetPath string, localAsTarget, ensurePerms bool) error
- func (s *SshCExecutor) RecursivePushFile(nodeName, source, target string, ensurePerms bool) error
- func (s *SshCExecutor) RemoveSession(n string) error
- func (s *SshCExecutor) ResetSession(n string) (*SshCSession, error)
- func (e *SshCExecutor) RunCommand(nodeName, command string, envs map[string]string, entryPoint []string) (int, error)
- func (e *SshCExecutor) RunCommandWithOutput(nodeName, command string, envs map[string]string, ...) (int, error)
- func (e *SshCExecutor) RunCommandWithOutput4Var(nodeName, command, outVar, errVar string, envs *map[string]string, ...) (int, error)
- func (e *SshCExecutor) RunHostCommand(command string, envs map[string]string, entryPoint []string) (int, error)
- func (e *SshCExecutor) RunHostCommandWithOutput(command string, envs map[string]string, outBuffer, errBuffer io.WriteCloser, ...) (int, error)
- func (e *SshCExecutor) RunHostCommandWithOutput4Var(command, outVar, errVar string, envs *map[string]string, entryPoint []string) (int, error)
- func (e *SshCExecutor) SetEmitter(emitter SshCExecutorEmitter)
- func (s *SshCExecutor) Setup() error
- func (s *SshCExecutor) SetupSftp(opts ...sftp.ClientOption) error
- type SshCExecutorEmitter
- type SshCExecutorEvent
- type SshCSession
- type TermShellRestoreCb
- type TunnelHop
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ResizeWindowHandler ¶ added in v0.7.0
func ResizeWindowHandler(sigs chan os.Signal, stdin *os.File, session *SshCSession)
Types ¶
type SshCEmitter ¶
type SshCEmitter struct { HostWriterStdout io.WriteCloser HostWriterStderr io.WriteCloser SshWriterStdout io.WriteCloser SshWriterStderr io.WriteCloser }
func NewSshCEmitter ¶
func NewSshCEmitter() *SshCEmitter
func (*SshCEmitter) DebugLog ¶
func (e *SshCEmitter) DebugLog(color bool, args ...interface{})
func (*SshCEmitter) Emits ¶
func (e *SshCEmitter) Emits(eType SshCExecutorEvent, data map[string]interface{})
func (*SshCEmitter) ErrorLog ¶
func (e *SshCEmitter) ErrorLog(color bool, args ...interface{})
func (*SshCEmitter) GetHostWriterStderr ¶
func (e *SshCEmitter) GetHostWriterStderr() io.WriteCloser
func (*SshCEmitter) GetHostWriterStdout ¶
func (e *SshCEmitter) GetHostWriterStdout() io.WriteCloser
func (*SshCEmitter) GetSshWriterStderr ¶
func (e *SshCEmitter) GetSshWriterStderr() io.WriteCloser
func (*SshCEmitter) GetSshWriterStdout ¶
func (e *SshCEmitter) GetSshWriterStdout() io.WriteCloser
func (*SshCEmitter) InfoLog ¶
func (e *SshCEmitter) InfoLog(color bool, args ...interface{})
func (*SshCEmitter) SetHostWriterStderr ¶
func (e *SshCEmitter) SetHostWriterStderr(w io.WriteCloser)
func (*SshCEmitter) SetHostWriterStdout ¶
func (e *SshCEmitter) SetHostWriterStdout(w io.WriteCloser)
func (*SshCEmitter) SetSshWriterStderr ¶
func (e *SshCEmitter) SetSshWriterStderr(w io.WriteCloser)
func (*SshCEmitter) SetSshWriterStdout ¶
func (e *SshCEmitter) SetSshWriterStdout(w io.WriteCloser)
func (*SshCEmitter) WarnLog ¶
func (e *SshCEmitter) WarnLog(color bool, args ...interface{})
type SshCEmitterWriter ¶
type SshCEmitterWriter struct {
Type string
}
func NewSshCEmitterWriter ¶
func NewSshCEmitterWriter(t string) *SshCEmitterWriter
func (*SshCEmitterWriter) Close ¶
func (e *SshCEmitterWriter) Close() error
type SshCExecutor ¶
type SshCExecutor struct { Endpoint string Host string // Ssh connection protocol. Valid values: tcp,tcp4,tcp6,unix ConnProtocol string Port int TimeoutSecs *uint ShowCmdsOutput bool RuntimeCmdsOutput bool Entrypoint []string TTYOpISpeed uint32 TTYOpOSpeed uint32 User string Pass string PrivateKey string PrivateKeyPass string Client *ssh.Client SftpClient *sftp.Client Sessions map[string]*SshCSession Emitter SshCExecutorEmitter // ConfigDir of SSHC_CONF ConfigDir string // Context used to manage all SSL sessions Ctx context.Context Cancel context.CancelFunc TunnelChain []*TunnelHop TunnelLocalPort int TunnelLocalAddr string TunnelLocalBind bool LocalListener net.Listener LocalListenerWg sync.WaitGroup }
func NewSshCExecutor ¶
func NewSshCExecutor(endpoint, host string, port int) *SshCExecutor
func NewSshCExecutorFromRemote ¶
func NewSshCExecutorFromRemote(rname string, r *specs.Remote) (*SshCExecutor, error)
func (*SshCExecutor) BuildChain ¶ added in v0.7.0
func (s *SshCExecutor) BuildChain() (*ssh.Client, error)
func (*SshCExecutor) Close ¶
func (s *SshCExecutor) Close()
func (*SshCExecutor) GetClient ¶
func (s *SshCExecutor) GetClient() *ssh.Client
func (*SshCExecutor) GetConnProtocol ¶
func (s *SshCExecutor) GetConnProtocol() string
func (*SshCExecutor) GetEmitter ¶
func (e *SshCExecutor) GetEmitter() SshCExecutorEmitter
func (*SshCExecutor) GetEndpoint ¶
func (s *SshCExecutor) GetEndpoint() string
func (*SshCExecutor) GetHost ¶
func (s *SshCExecutor) GetHost() string
func (*SshCExecutor) GetPass ¶
func (s *SshCExecutor) GetPass() string
func (*SshCExecutor) GetPort ¶
func (s *SshCExecutor) GetPort() int
func (*SshCExecutor) GetPrivateKey ¶
func (s *SshCExecutor) GetPrivateKey() string
func (*SshCExecutor) GetPrivateKeyPass ¶
func (s *SshCExecutor) GetPrivateKeyPass() string
func (*SshCExecutor) GetRuntimeCmdsOutput ¶
func (s *SshCExecutor) GetRuntimeCmdsOutput() bool
func (*SshCExecutor) GetSession ¶
func (s *SshCExecutor) GetSession(n string) (*SshCSession, error)
func (*SshCExecutor) GetSftpClient ¶
func (s *SshCExecutor) GetSftpClient() *sftp.Client
func (*SshCExecutor) GetShellSession ¶
func (s *SshCExecutor) GetShellSession(n, termType string, h, w int, echo bool) (*SshCSession, error)
func (*SshCExecutor) GetShellSessionWithTermSetup ¶
func (s *SshCExecutor) GetShellSessionWithTermSetup(n, termType string, stdin *os.File, stdout, stderr io.Writer) (*SshCSession, TermShellRestoreCb, error)
func (*SshCExecutor) GetShowCmdsOutput ¶
func (s *SshCExecutor) GetShowCmdsOutput() bool
func (*SshCExecutor) GetUser ¶
func (s *SshCExecutor) GetUser() string
func (*SshCExecutor) RecursiveMkdir ¶
func (*SshCExecutor) RecursivePullFile ¶
func (s *SshCExecutor) RecursivePullFile(nodeName, sourcePath, targetPath string, localAsTarget, ensurePerms bool) error
func (*SshCExecutor) RecursivePushFile ¶
func (s *SshCExecutor) RecursivePushFile(nodeName, source, target string, ensurePerms bool) error
func (*SshCExecutor) RemoveSession ¶
func (s *SshCExecutor) RemoveSession(n string) error
func (*SshCExecutor) ResetSession ¶
func (s *SshCExecutor) ResetSession(n string) (*SshCSession, error)
func (*SshCExecutor) RunCommand ¶
func (*SshCExecutor) RunCommandWithOutput ¶
func (e *SshCExecutor) RunCommandWithOutput(nodeName, command string, envs map[string]string, outBuffer, errBuffer io.WriteCloser, entryPoint []string) (int, error)
func (*SshCExecutor) RunCommandWithOutput4Var ¶
func (*SshCExecutor) RunHostCommand ¶
func (*SshCExecutor) RunHostCommandWithOutput ¶
func (e *SshCExecutor) RunHostCommandWithOutput(command string, envs map[string]string, outBuffer, errBuffer io.WriteCloser, entryPoint []string) (int, error)
func (*SshCExecutor) RunHostCommandWithOutput4Var ¶
func (*SshCExecutor) SetEmitter ¶
func (e *SshCExecutor) SetEmitter(emitter SshCExecutorEmitter)
func (*SshCExecutor) Setup ¶
func (s *SshCExecutor) Setup() error
func (*SshCExecutor) SetupSftp ¶
func (s *SshCExecutor) SetupSftp(opts ...sftp.ClientOption) error
type SshCExecutorEmitter ¶
type SshCExecutorEvent ¶
type SshCExecutorEvent string
const ( SshClientSetupDone SshCExecutorEvent = "client-setup" SshContainerConnected SshCExecutorEvent = "endpoint-connected" )
type SshCSession ¶
func NewSshCSession ¶
func NewSshCSession(name string, s *ssh.Session) *SshCSession
func (*SshCSession) GetName ¶
func (s *SshCSession) GetName() string
func (*SshCSession) GetRawSession ¶
func (s *SshCSession) GetRawSession() *ssh.Session
type TermShellRestoreCb ¶
type TermShellRestoreCb func() error