transfer

package
v1.2.1-0...-93d4433 Latest Latest
Warning

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

Go to latest
Published: May 14, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package transfer copies files between local and remote filesystems over an existing ssh.Client, using SFTP. It replaces 1.x's shell-out to /usr/bin/scp + sshpass, so passwords never reach argv and no external binaries need to be on PATH.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute

func Execute(ctx context.Context, conn *xssh.Client, spec Spec, progress io.Writer) error

Execute opens an SFTP client over conn and performs the transfer described by spec. Progress is written to progress (may be nil).

Types

type Direction

type Direction int

Direction encodes which way the bytes are moving.

const (
	Upload   Direction = iota // local -> remote
	Download                  // remote -> local
)

type Spec

type Spec struct {
	TunnelID  string
	Local     string
	Remote    string
	Direction Direction
}

Spec is a parsed source/destination pair.

func ParseSpec

func ParseSpec(source, destination, explicitTunnelID string) (Spec, error)

ParseSpec interprets a pair of scp-style arguments. A bare local path stays local; `id:path` is remote-on-the-node-named-id. explicitTunnelID, if set, overrides any prefix found in the args — this lets two bare local paths turn into an upload when the user has told us which tunnel to target via --tunnel-id.

Jump to

Keyboard shortcuts

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