transfer

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package transfer implements file copy over SSM SSH sessions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Copy

func Copy(ctx context.Context, instanceID string, spec CopySpec) error

Copy transfers files to or from instanceID using SFTP over an SSM SSH session.

func CopyRemoteToRemote

func CopyRemoteToRemote(ctx context.Context, srcInstanceID, srcPath, dstInstanceID, dstPath string, spec CopySpec) error

CopyRemoteToRemote streams files from srcInstanceID:srcPath to dstInstanceID:dstPath by piping tar over two parallel SSH sessions. Data flows through local memory only — no temp files, no direct instance-to-instance network required.

Both instances must have tar available. spec.User and spec.KeyPath are used for both connections; use --user to override if they differ.

Types

type CopySpec

type CopySpec struct {
	LocalPath  string
	RemotePath string
	Direction  Direction
	Recursive  bool
	User       string // remote OS user (e.g. ec2-user, ubuntu)
	KeyPath    string // private key path for SSH auth
	Profile    string // AWS profile, forwarded to --proxy if non-empty
	Region     string // AWS region, forwarded to --proxy
}

CopySpec describes a file copy operation.

type Direction

type Direction int

Direction indicates which end of the copy is remote.

const (
	LocalToRemote Direction = iota // zero value — default when Direction is not set
	RemoteToLocal
)

Direction constants for CopySpec.

Jump to

Keyboard shortcuts

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