ssh

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

File: sftp_unix.go

Index

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

func CreateLocalDirAndFile(dir, filePath string) error

CreateLocalDirAndFile creates directory structure and file locally

func CreateLocalFile added in v1.0.16

func CreateLocalFile(path string) error

CreateLocalFile creates a new empty file locally

func DeleteLocalFile added in v1.0.16

func DeleteLocalFile(path string, isDir bool) error

DeleteLocalFile deletes a local file or directory

func RenameLocalFile added in v1.0.16

func RenameLocalFile(oldPath, newPath string) error

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

func (*BubbleTeaSession) Write added in v1.0.4

func (s *BubbleTeaSession) Write(data []byte) (int, error)

Write sends data to the SSH session stdin

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents an SSH client connection

func NewClient

func NewClient(connConfig config.SSHConnection) (*Client, error)

NewClient creates a new SSH client from a connection configuration

func (*Client) Close

func (c *Client) Close() error

Close closes the SSH client connection

func (*Client) NewSession

func (c *Client) NewSession() (*ssh.Session, error)

NewSession creates a new SSH session

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

func ListLocalFiles(path string) ([]FileInfo, error)

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

Jump to

Keyboard shortcuts

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