Documentation
¶
Overview ¶
File: sftp_unix.go
Index ¶
- func ConnectInteractive(connConfig config.SSHConnection) error
- func CreateLocalDirAndFile(dir, filePath string) error
- func CreateLocalFile(path string) error
- func DeleteLocalFile(path string, isDir bool) error
- func RenameLocalFile(oldPath, newPath string) error
- type BubbleTeaSession
- func (s *BubbleTeaSession) Close() error
- func (s *BubbleTeaSession) IsTerminated() bool
- func (s *BubbleTeaSession) Read(p []byte) (int, error)
- func (s *BubbleTeaSession) ReadStderr(p []byte) (int, error)
- func (s *BubbleTeaSession) Resize(width, height int) error
- func (s *BubbleTeaSession) Start() error
- func (s *BubbleTeaSession) Wait() error
- func (s *BubbleTeaSession) Write(data []byte) (int, error)
- type Client
- type FileInfo
- type PassphraseRequiredError
- type PasswordRequiredError
- type SFTPClient
- func (s *SFTPClient) Close() error
- func (s *SFTPClient) CreateDirAndFile(dir, filePath string) error
- func (s *SFTPClient) CreateFile(path string) error
- func (s *SFTPClient) DeleteFile(path string, isDir bool) error
- func (s *SFTPClient) DownloadDir(remotePath, localPath string) error
- func (s *SFTPClient) DownloadFile(remotePath, localPath string) error
- func (s *SFTPClient) GetWorkingDir() (string, error)
- func (s *SFTPClient) ListFiles(path string) ([]FileInfo, error)
- func (s *SFTPClient) RenameFile(oldPath, newPath string) error
- func (s *SFTPClient) UploadDir(localPath, remotePath string) error
- func (s *SFTPClient) UploadFile(localPath, remotePath string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectInteractive ¶ added in v1.1.8
func ConnectInteractive(connConfig config.SSHConnection) error
ConnectInteractive creates an interactive SSH session using golang SSH client This replaces the need for external tools like passh, plink, or native ssh command
func CreateLocalDirAndFile ¶ added in v1.0.16
CreateLocalDirAndFile creates directory structure and file locally
func CreateLocalFile ¶ added in v1.0.16
CreateLocalFile creates a new empty file locally
func DeleteLocalFile ¶ added in v1.0.16
DeleteLocalFile deletes a local file or directory
func RenameLocalFile ¶ added in v1.0.16
RenameLocalFile renames a local file
Types ¶
type BubbleTeaSession ¶ added in v1.0.4
type BubbleTeaSession struct {
// contains filtered or unexported fields
}
BubbleTeaSession represents an SSH session that works within Bubble Tea
func NewBubbleTeaSession ¶ added in v1.0.4
func NewBubbleTeaSession(connConfig config.SSHConnection, width, height int) (*BubbleTeaSession, error)
NewBubbleTeaSession creates a new SSH session for use within Bubble Tea
func (*BubbleTeaSession) Close ¶ added in v1.0.4
func (s *BubbleTeaSession) Close() error
Close closes the SSH session
func (*BubbleTeaSession) IsTerminated ¶ added in v1.0.4
func (s *BubbleTeaSession) IsTerminated() bool
IsTerminated returns whether the session has been terminated
func (*BubbleTeaSession) Read ¶ added in v1.0.4
func (s *BubbleTeaSession) Read(p []byte) (int, error)
Read reads data from the SSH session stdout
func (*BubbleTeaSession) ReadStderr ¶ added in v1.0.4
func (s *BubbleTeaSession) ReadStderr(p []byte) (int, error)
ReadStderr reads data from the SSH session stderr
func (*BubbleTeaSession) Resize ¶ added in v1.0.4
func (s *BubbleTeaSession) Resize(width, height int) error
Resize sends a window change signal to the SSH session
func (*BubbleTeaSession) Start ¶ added in v1.0.4
func (s *BubbleTeaSession) Start() error
Start starts the SSH shell
func (*BubbleTeaSession) Wait ¶ added in v1.0.4
func (s *BubbleTeaSession) Wait() error
Wait waits for the session to complete
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client represents an SSH client connection
type FileInfo ¶ added in v1.0.16
type FileInfo struct {
Name string
Size int64
IsDir bool
Mode string
ModTime time.Time // Modification time
Perm string // Permission string (e.g. drwxr-xr-x)
Owner string // UID or Owner Name
Group string // GID or Group Name
}
FileInfo represents a file or directory with extended metadata
func ListLocalFiles ¶ added in v1.0.16
ListLocalFiles lists files in a local directory
type PassphraseRequiredError ¶ added in v1.0.18
type PassphraseRequiredError struct {
KeyFile string
}
PassphraseRequiredError indicates that a passphrase is needed to decrypt the SSH key
func (*PassphraseRequiredError) Error ¶ added in v1.0.18
func (e *PassphraseRequiredError) Error() string
type PasswordRequiredError ¶ added in v1.0.24
type PasswordRequiredError struct {
Connection config.SSHConnection
}
PasswordRequiredError indicates that a password is needed for authentication
func (*PasswordRequiredError) Error ¶ added in v1.0.24
func (e *PasswordRequiredError) Error() string
type SFTPClient ¶ added in v1.0.16
type SFTPClient struct {
// contains filtered or unexported fields
}
SFTPClient wraps an SFTP client connection
func NewSFTPClient ¶ added in v1.0.16
func NewSFTPClient(connConfig config.SSHConnection) (*SFTPClient, error)
NewSFTPClient creates a new SFTP client connection
func (*SFTPClient) Close ¶ added in v1.0.16
func (s *SFTPClient) Close() error
Close closes the SFTP and SSH connections
func (*SFTPClient) CreateDirAndFile ¶ added in v1.0.16
func (s *SFTPClient) CreateDirAndFile(dir, filePath string) error
CreateDirAndFile creates directory structure and file remotely
func (*SFTPClient) CreateFile ¶ added in v1.0.16
func (s *SFTPClient) CreateFile(path string) error
CreateFile creates a new empty file
func (*SFTPClient) DeleteFile ¶ added in v1.0.16
func (s *SFTPClient) DeleteFile(path string, isDir bool) error
DeleteFile deletes a remote file or directory
func (*SFTPClient) DownloadDir ¶ added in v1.1.7
func (s *SFTPClient) DownloadDir(remotePath, localPath string) error
DownloadDir recursively downloads a directory from remote to local
func (*SFTPClient) DownloadFile ¶ added in v1.0.16
func (s *SFTPClient) DownloadFile(remotePath, localPath string) error
DownloadFile downloads a file from remote to local
func (*SFTPClient) GetWorkingDir ¶ added in v1.0.18
func (s *SFTPClient) GetWorkingDir() (string, error)
GetWorkingDir returns the current working directory of the SFTP connection
func (*SFTPClient) ListFiles ¶ added in v1.0.16
func (s *SFTPClient) ListFiles(path string) ([]FileInfo, error)
ListFiles lists files in a directory (Remote)
func (*SFTPClient) RenameFile ¶ added in v1.0.16
func (s *SFTPClient) RenameFile(oldPath, newPath string) error
RenameFile renames a file
func (*SFTPClient) UploadDir ¶ added in v1.1.7
func (s *SFTPClient) UploadDir(localPath, remotePath string) error
UploadDir recursively uploads a directory from local to remote
func (*SFTPClient) UploadFile ¶ added in v1.0.16
func (s *SFTPClient) UploadFile(localPath, remotePath string) error
UploadFile uploads a file from local to remote