Documentation
¶
Index ¶
- Constants
- func GetLinuxInfo(c SshClient) (*platform.SystemInfo, error)
- func GetOsInfo(c SshClient) (_ string, err error)
- func GetWindowsInfo(c SshClient) (*platform.SystemInfo, error)
- func NewRemoteSession(c transport.Transport, fs file.FileSystem) *remoteSession
- type Address
- type Auth
- type HostKey
- type KnownHosts
- type KnownHostsUpdater
- type OpDownload
- type OpDownloadDir
- type OpExecute
- type OpGetWorkRoot
- type OpMkdirAll
- type OpUpload
- type Options
- type PassphraseRef
- type Prober
- type SftpClient
- type SimProber
- type SimRemoteSession
- func (s *SimRemoteSession) Close() error
- func (s *SimRemoteSession) Download(ctx context.Context, remote, local string, perm *os.FileMode) error
- func (s *SimRemoteSession) DownloadDir(ctx context.Context, remote, local string, recursive bool) error
- func (s *SimRemoteSession) Execute(ctx context.Context, exec transport.RemoteExecution) error
- func (s *SimRemoteSession) GetWorkRoot(ctx context.Context) (string, error)
- func (s *SimRemoteSession) MkdirAll(ctx context.Context, path string) error
- func (s *SimRemoteSession) Upload(ctx context.Context, local, remote string, perm *os.FileMode) error
- type SshClient
- type SshOperator
- func (o *SshOperator) IsDryRun() bool
- func (o *SshOperator) NewProber(t transport.Transport) (transport.Prober, error)
- func (o *SshOperator) NewRemoteSession(ctx context.Context, t transport.Transport) (transport.RemoteSession, error)
- func (o *SshOperator) NewUpdater(operation string) (transport.Updater, error)
- func (o *SshOperator) WithDryRunMode(mode string) transport.Operator
- func (o *SshOperator) WithFileSystem(fs file.FileSystem) transport.Operator
- type SshSession
- type Transport
- func (t *Transport) Add(path []string, value any) error
- func (t *Transport) Clone() transport.Transport
- func (t *Transport) GetType() string
- func (t *Transport) Merge(o transport.Transport) (transport.Transport, error)
- func (t *Transport) Remove(path []string) error
- func (t *Transport) Resolve(render func(string) (string, error)) error
- func (t *Transport) SetDefaults()
- func (t *Transport) Update(o patch.Patchable) error
- func (t *Transport) Validate() error
- type Walker
Constants ¶
View Source
const ( AuthMethodPrivateKey = "privateKey" AuthMethodDefault = AuthMethodPrivateKey )
View Source
const ( HostKeyMethodKnownHostsFile = "knownHostsFile" HostKeyMethodDefault = HostKeyMethodKnownHostsFile )
View Source
const (
TypeName = "ssh"
)
Variables ¶
This section is empty.
Functions ¶
func GetLinuxInfo ¶
func GetLinuxInfo(c SshClient) (*platform.SystemInfo, error)
func GetWindowsInfo ¶
func GetWindowsInfo(c SshClient) (*platform.SystemInfo, error)
func NewRemoteSession ¶
func NewRemoteSession(c transport.Transport, fs file.FileSystem) *remoteSession
Types ¶
type Address ¶
type Address struct {
Host string `json:"host" yaml:"host"`
Port int `json:"port" yaml:"port"`
User string `json:"user" yaml:"user"`
}
func (*Address) SetDefaults ¶
func (a *Address) SetDefaults()
type Auth ¶
type Auth struct {
Method string `json:"method,omitempty" yaml:"method,omitempty"` // privateKey
PrivateKeyPath string `json:"privateKeyPath,omitempty" yaml:"privateKeyPath,omitempty"`
Passphrase *PassphraseRef `json:"passphraseRef,omitempty" yaml:"passphraseRef,omitempty"`
}
func (*Auth) SetDefaults ¶
func (a *Auth) SetDefaults()
type HostKey ¶
type HostKey struct {
Method string `json:"method,omitempty" yaml:"method,omitempty"` // knownHostsFile
KnownHostsPath string `json:"knownHostsPath,omitempty" yaml:"knownHostsPath,omitempty"`
}
func (*HostKey) SetDefaults ¶
func (hk *HostKey) SetDefaults()
type KnownHosts ¶
type KnownHosts struct {
Entries []string
FS file.FileSystem
}
func NewKnownHosts ¶
func NewKnownHosts(fs file.FileSystem) *KnownHosts
func NewKnownHostsFromFile ¶
func NewKnownHostsFromFile(fs file.FileSystem, path string) (*KnownHosts, error)
func (*KnownHosts) CopyHostEntry ¶
func (k *KnownHosts) CopyHostEntry(c *Transport) error
func (*KnownHosts) LoadHostEntries ¶
func (k *KnownHosts) LoadHostEntries(knownHostsPath string) error
func (*KnownHosts) RemoveHostEntry ¶
func (k *KnownHosts) RemoveHostEntry(t *Transport) error
func (*KnownHosts) SaveToFile ¶
func (k *KnownHosts) SaveToFile(path string, createSafeDir bool) (err error)
type KnownHostsUpdater ¶
type KnownHostsUpdater struct {
// contains filtered or unexported fields
}
func NewKnownHostsUpdater ¶
func NewKnownHostsUpdater(operation string, fs file.FileSystem) *KnownHostsUpdater
func (*KnownHostsUpdater) Update ¶
func (u *KnownHostsUpdater) Update(t transport.Transport, ws *workspace.RunWorkspace) ([]transport.Patch, error)
type OpDownload ¶
type OpDownloadDir ¶
type OpGetWorkRoot ¶
type OpGetWorkRoot struct {
Type string `yaml:"type"`
}
type OpMkdirAll ¶
type Options ¶
type Options struct {
ConnectTimeoutSec int `json:"connectTimeoutSec,omitempty" yaml:"connectTimeoutSec,omitempty"`
HandshakeTimeoutSec int `json:"handshakeTimeoutSec,omitempty" yaml:"handshakeTimeoutSec,omitempty"`
RetryMaxCount int `json:"retryMaxCount,omitempty" yaml:"retryMaxCount,omitempty"`
RetryIntervalSec int `json:"retryIntervalSec,omitempty" yaml:"retryIntervalSec,omitempty"`
}
func (*Options) ConnectTimeout ¶
func (*Options) HandshakeTimeout ¶
func (*Options) RetryInterval ¶
func (*Options) SetDefaults ¶
func (o *Options) SetDefaults()
type PassphraseRef ¶
type PassphraseRef struct {
FromEnv string `json:"fromEnv,omitempty" yaml:"fromEnv,omitempty"`
FromFile string `json:"fromFile,omitempty" yaml:"fromFile,omitempty"`
}
func (*PassphraseRef) Clone ¶
func (r *PassphraseRef) Clone() *PassphraseRef
func (*PassphraseRef) GetPassphrase ¶
func (p *PassphraseRef) GetPassphrase(fs file.Opener) (string, error)
func (*PassphraseRef) Merge ¶
func (r *PassphraseRef) Merge(other *PassphraseRef) *PassphraseRef
type Prober ¶
type Prober struct {
// contains filtered or unexported fields
}
func (*Prober) GetSystemInfo ¶
type SftpClient ¶
type SftpClient interface {
MkdirAll(path string) error
Create(path string) (io.WriteCloser, error)
Open(path string) (io.ReadCloser, error)
Chmod(path string, perm os.FileMode) error
Walk(root string) Walker
Stat(path string) (os.FileInfo, error)
Close() error
}
func NewSftpClient ¶
func NewSftpClient(client *ssh.Client) (SftpClient, error)
type SimProber ¶
type SimProber struct {
// contains filtered or unexported fields
}
func NewSimProber ¶
func (*SimProber) GetSystemInfo ¶
type SimRemoteSession ¶
type SimRemoteSession struct {
Operations []any `yaml:"operations"`
}
func NewSimRemoteSession ¶
func NewSimRemoteSession(mode string) *SimRemoteSession
func (*SimRemoteSession) Close ¶
func (s *SimRemoteSession) Close() error
func (*SimRemoteSession) DownloadDir ¶
func (*SimRemoteSession) Execute ¶
func (s *SimRemoteSession) Execute(ctx context.Context, exec transport.RemoteExecution) error
func (*SimRemoteSession) GetWorkRoot ¶
func (s *SimRemoteSession) GetWorkRoot(ctx context.Context) (string, error)
type SshClient ¶
type SshClient interface {
transport.Client
NewSession() (SshSession, error)
NewSftpClient() (SftpClient, error)
}
func NewSshClient ¶
type SshOperator ¶
type SshOperator struct {
// contains filtered or unexported fields
}
func (*SshOperator) IsDryRun ¶
func (o *SshOperator) IsDryRun() bool
func (*SshOperator) NewRemoteSession ¶
func (o *SshOperator) NewRemoteSession(ctx context.Context, t transport.Transport) (transport.RemoteSession, error)
func (*SshOperator) NewUpdater ¶
func (o *SshOperator) NewUpdater(operation string) (transport.Updater, error)
func (*SshOperator) WithDryRunMode ¶
func (o *SshOperator) WithDryRunMode(mode string) transport.Operator
func (*SshOperator) WithFileSystem ¶
func (o *SshOperator) WithFileSystem(fs file.FileSystem) transport.Operator
type SshSession ¶
type Transport ¶
type Transport struct {
Address *Address `json:"address,omitempty" yaml:"address,omitempty"`
Auth *Auth `json:"auth,omitempty" yaml:"auth,omitempty"`
HostKey *HostKey `json:"hostKey,omitempty" yaml:"hostKey,omitempty"`
Options *Options `json:"-" yaml:"-"`
}
func (*Transport) SetDefaults ¶
func (t *Transport) SetDefaults()
Click to show internal directories.
Click to hide internal directories.