ssh

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AUTHKEY_PASSWORD = "password"
	AUTHKEY_AGENT    = "agent"
	AUTHKEY_KEY      = "key"
	AUTHKEY_CERT     = "cert"
	AUTHKEY_PKCS11   = "pkcs11"
)
View Source
const SSH_AUTH_SOCK = "SSH_AUTH_SOCK"

Variables

This section is empty.

Functions

func StartParallelForwards added in v0.8.0

func StartParallelForwards(connect *sshlib.Connect, config conf.ServerConfig) error

StartParallelForwards starts only the reverse-side forwards that can be applied independently per connection in parallel workflows.

Types

type AuthKey

type AuthKey struct {
	// auth type:
	//   - password
	//   - agent
	//   - key
	//   - cert
	//   - pkcs11
	Type string

	// auth type value:
	//   - key(path)
	//     ex.) ~/.ssh/id_rsa
	//   - cert(path)
	//     ex.) ~/.ssh/id_rsa.crt
	//   - pkcs11(libpath)
	//     ex.) /usr/local/lib/opensc-pkcs11.so
	Value string
}

AuthKey Auth map key struct.

type PathSet

type PathSet struct {
	Base      string
	PathSlice []string
}

use scp,sftp

type Run

type Run struct {
	ServerList []string
	Conf       conf.Config

	// ControlMasterOverride temporarily overrides the config setting for
	// this run. nil means use the config value as-is.
	ControlMasterOverride *bool

	// Mode value in
	//     - shell
	//     - cmd
	Mode string

	// tty use (-t option)
	IsTerm bool

	// parallel connect (-p option)
	IsParallel bool

	// not run (-N option)
	IsNone bool

	// x11 forwarding (-X option)
	X11 bool

	// Trusted X11 flag (-Y option)
	X11Trusted bool

	// use or not-use local bashrc.
	// IsNotBashrc takes precedence.
	IsBashrc    bool
	IsNotBashrc bool

	// local/remote Port Forwarding
	PortForward []*conf.PortForward

	// TODO(blacknon): Delete old keys
	// L or R
	PortForwardMode string

	// local port num (ex. 11080).
	PortForwardLocal string

	// remote host and port (ex. localhost:11080).
	PortForwardRemote string

	// Dynamic Port Forwarding
	// set localhost port num (ex. 11080).
	DynamicPortForward string

	// HTTP Dynamic Port Forwarding
	// set localhost port num (ex. 11080).
	HTTPDynamicPortForward string

	// Reverse Dynamic Port Forwarding
	// set remotehost port num (ex. 11080).
	ReverseDynamicPortForward string

	// HTTP Reverse Dynamic Port Forwarding
	// set remotehost port num (ex. 11080).
	HTTPReverseDynamicPortForward string

	// NFS Dynamic Forward
	// set localhost port num (ex. 12049).
	NFSDynamicForwardPort string

	// NFS Dynamic Forward Path
	// set remotehost path (ex. /path/to/remote).
	NFSDynamicForwardPath string

	// NFS Reverse Dynamic Forward
	// set remotehost port num (ex. 12049).
	NFSReverseDynamicForwardPort string

	// NFS Reverse Dynamic Forward Path
	// set localhost path (ex. /path/to/local).
	NFSReverseDynamicForwardPath string

	// SMB Dynamic Forward
	// set localhost port num (ex. 12445).
	SMBDynamicForwardPort string

	// SMB Dynamic Forward Path
	// set remotehost path (ex. /path/to/remote).
	SMBDynamicForwardPath string

	// SMB Reverse Dynamic Forward
	// set remotehost port num (ex. 12445).
	SMBReverseDynamicForwardPort string

	// SMB Reverse Dynamic Forward Path
	// set localhost path (ex. /path/to/local).
	SMBReverseDynamicForwardPath string

	// Tunnel device (-w equivalent). Enable and units.
	TunnelEnabled bool
	TunnelLocal   int
	TunnelRemote  int

	// Exec command
	ExecCmd []string

	// enable/disable print header in command mode
	EnableHeader  bool
	DisableHeader bool

	// Enable/Disable stdoutMutex
	EnableStdoutMutex bool

	// StdinData from pipe flag
	IsStdinPipe bool

	// ShareConnect reuses the monitor SSH connection for interactive terminals.
	ShareConnect bool

	// ActiveTunnel holds the active tunnel created for this Run (if any)
	ActiveTunnel *sshlib.Tunnel
	// contains filtered or unexported fields
}

Run

func (*Run) CreateAuthMethodMap

func (r *Run) CreateAuthMethodMap()

CreateAuthMethodMap Create ssh.AuthMethod, into r.AuthMethodMap.

func (*Run) CreateSshConnect

func (r *Run) CreateSshConnect(server string) (connect *sshlib.Connect, err error)

CreateSshConnect return *sshlib.Connect this vaule in ssh.Client with proxy.

func (*Run) CreateSshConnectDirect

func (r *Run) CreateSshConnectDirect(server string) (connect *sshlib.Connect, err error)

CreateSshConnectDirect returns *sshlib.Connect with ControlMaster/ControlPersist disabled. This is used by features that require a concrete *ssh.Client (e.g. SFTP clients).

func (*Run) ParallelIgnoredFeatures added in v0.8.0

func (r *Run) ParallelIgnoredFeatures(server string) []string

ParallelIgnoredFeatures lists forwarding settings that are intentionally skipped for per-host parallel sessions because they require local listeners.

func (*Run) PrepareParallelForwardConfig added in v0.8.0

func (r *Run) PrepareParallelForwardConfig(server string) (c conf.ServerConfig)

PrepareParallelForwardConfig returns only the forwarding settings that are safe to apply independently to each parallel connection.

func (*Run) PrintConnectInfo

func (r *Run) PrintConnectInfo(server string, connect *sshlib.Connect, cfg conf.ServerConfig)

PrintConnectInfo centralizes informational output related to a created connection (ControlMaster state, local rc usage, etc.). Call this after CreateSshConnect returns a valid *sshlib.Connect.

func (*Run) PrintSelectServer

func (r *Run) PrintSelectServer()

PrintSelectServer is printout select server. use ssh login header.

func (*Run) SetupSshAgent

func (r *Run) SetupSshAgent()

func (*Run) Start

func (r *Run) Start()

Start ssh connect

Jump to

Keyboard shortcuts

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