Documentation
¶
Overview ¶
Package transfer implements SCP (one-shot copy) and SFTP (interactive REPL) over an existing *ssh.Client. Reuses sshc's ConnectAlias chain (proxy_jump, proxy_command, password backends) so transfers go through the same tunnels as interactive shells.
Index ¶
- func DownloadDir(sc *sftp.Client, remote, local, alias string) error
- func DownloadFile(sc *sftp.Client, remote, local, alias string) error
- func HumanBytes(n int64) string
- func SCP(client *ssh.Client, src, dst string, recursive bool) error
- func SFTP(client *ssh.Client, alias string) error
- func UploadDir(sc *sftp.Client, local, remote, alias string) error
- func UploadFile(sc *sftp.Client, local, remote, alias string) error
- type Direction
- type Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DownloadDir ¶
DownloadDir recursively downloads remote directory to local path.
func DownloadFile ¶
DownloadFile copies a single remote file to local path via sc, logging the transfer under alias (which appears in TransferHistory).
func HumanBytes ¶
HumanBytes formats a byte count with KiB/MiB/GiB suffix. Exported so the TUI and CLI can share one implementation.
func SFTP ¶
SFTP starts an interactive SFTP REPL over client. Supported commands:
help / ? ls [path] list remote dir lls [path] list local dir cd <path> change remote dir lcd <path> change local dir pwd print remote cwd lpwd print local cwd get <remote> [local] download file put <local> [remote] upload file rm <path> remove remote file mkdir <path> create remote directory rmdir <path> remove remote (empty) directory exit / quit / bye leave
Types ¶
type Direction ¶
type Direction int
SCP copies a single file (or, with recursive=true, a directory tree) between the local filesystem and a remote host reached through client. Direction is inferred from src/dst — exactly one must be of the form alias:/path; alias here is informational (the actual client is already connected).
Both paths use forward slashes; remote paths are interpreted relative to the SSH user's home if not absolute.