executor

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2026 License: GPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Copyright © 2024-2026 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2024-2026 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2024-2026 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2024-2026 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2024-2026 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Copyright © 2024-2026 Daniele Rondina <geaaru@macaronios.org> See AUTHORS and LICENSE for the license details and contributors.

Index

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 *core.SshCSession)

Types

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

	// Cisco Device options
	CiscoDevice      bool
	CiscoPromptRegex bool
	CiscoPrompt      string
	CiscoEnaPrompt   string
	CiscoEnaPass     string

	TTYOpISpeed uint32
	TTYOpOSpeed uint32

	Options map[string]string

	User           string
	Pass           string
	PrivateKey     string
	PrivateKeyPass string

	Client     *ssh.Client
	SftpClient *sftp.Client

	Sessions map[string]*core.SshCSession

	Emitter core.SshCExecutorEmitter

	// ConfigDir of SSHC_CONF
	ConfigDir string

	// Context used to manage all SSL sessions
	Ctx    context.Context
	Cancel context.CancelFunc

	TunnelChain     []*core.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() core.SshCExecutorEmitter

func (*SshCExecutor) GetEndpoint

func (s *SshCExecutor) GetEndpoint() string

func (*SshCExecutor) GetHost

func (s *SshCExecutor) GetHost() string

func (*SshCExecutor) GetOption added in v0.8.1

func (s *SshCExecutor) GetOption(o string) 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) (*core.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) (*core.SshCSession, error)

func (*SshCExecutor) GetShellSessionWithTermSetup

func (s *SshCExecutor) GetShellSessionWithTermSetup(n, termType string,
	stdin *os.File, stdout, stderr io.Writer) (*core.SshCSession, TermShellRestoreCb, error)

func (*SshCExecutor) GetShowCmdsOutput

func (s *SshCExecutor) GetShowCmdsOutput() bool

func (*SshCExecutor) GetUser

func (s *SshCExecutor) GetUser() string

func (*SshCExecutor) RecursiveMkdir

func (s *SshCExecutor) RecursiveMkdir(dir string, mode *os.FileMode, uid int, gid int, ensurePerms bool) error

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) (*core.SshCSession, error)

func (*SshCExecutor) RunCommand

func (e *SshCExecutor) RunCommand(nodeName, command string, envs map[string]string, entryPoint []string) (int, error)

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 (e *SshCExecutor) RunCommandWithOutput4Var(nodeName, command, outVar, errVar string, envs *map[string]string, entryPoint []string) (int, error)

func (*SshCExecutor) RunCommandWithOutputOnCiscoDevice added in v0.8.0

func (e *SshCExecutor) RunCommandWithOutputOnCiscoDevice(nodeName, command string,
	envs map[string]string, outBuffer, errBuffer io.WriteCloser,
	entryPoint []string) (int, error)

func (*SshCExecutor) RunCommandWithOutputOnCiscoDeviceWithDS added in v0.8.1

func (e *SshCExecutor) RunCommandWithOutputOnCiscoDeviceWithDS(nodeName, command string,
	envs map[string]string, outBuffer, errBuffer io.WriteCloser,
	entryPoint []string, opts *core.CiscoCommandOpts) (int, error)

func (*SshCExecutor) RunHostCommand

func (e *SshCExecutor) RunHostCommand(command string, envs map[string]string, entryPoint []string) (int, error)

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 (e *SshCExecutor) RunHostCommandWithOutput4Var(command, outVar, errVar string, envs *map[string]string, entryPoint []string) (int, error)

func (*SshCExecutor) SetEmitter

func (e *SshCExecutor) SetEmitter(emitter core.SshCExecutorEmitter)

func (*SshCExecutor) Setup

func (s *SshCExecutor) Setup() error

func (*SshCExecutor) SetupSftp

func (s *SshCExecutor) SetupSftp(opts ...sftp.ClientOption) error

type TermShellRestoreCb

type TermShellRestoreCb func() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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