transfer

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package transfer covers SCP, SFTP, and rsync. SFTP is the workhorse for our upload/download paths because it's a real protocol over the SSH channel; SCP is offered for compatibility but SFTP is preferred whenever we control both ends.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Download

func Download(c *sshc.Client, remotePath, localPath string) error

Download fetches a remote file or directory to the local filesystem.

func Rsync

func Rsync(s *store.Server, local, remote string, opts RsyncOptions) error

Rsync shells out to /usr/bin/rsync. Only key-based auth is supported here because we don't currently inject passwords into rsync's child SSH process. Password-auth servers will see rsync prompt and fail.

func SFTPInteractive

func SFTPInteractive(c *sshc.Client) error

SFTPInteractive runs an interactive SFTP session. We don't reimplement the full sftp(1) REPL — we shell out to the system sftp binary instead, since users expect its exact behaviour and tab completion. This is the only transfer path that shells out under normal operation.

(Rsync also shells out, by necessity — there's no Go-native rsync.)

func Upload

func Upload(c *sshc.Client, localPath, remotePath string) error

Upload sends a local file or directory to the remote host via SFTP. Recursive when localPath is a directory.

Types

type RsyncMode

type RsyncMode int

RsyncMode controls direction.

const (
	RsyncPush RsyncMode = iota
	RsyncPull
)

type RsyncOptions

type RsyncOptions struct {
	Mode    RsyncMode
	DryRun  bool
	Delete  bool
	Verbose bool
	Args    []string // extra args appended verbatim
}

RsyncOptions tunes the shelled-out rsync invocation.

Jump to

Keyboard shortcuts

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