remote

package
v0.1.2-alpha Latest Latest
Warning

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

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

Documentation

Overview

Package remote defines the protocol-agnostic interface for remote file operations and provides a factory that returns the right implementation (SFTP or FTP) based on host.Protocol.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Stat(path string) (os.FileInfo, error)
	ReadFile(path string) ([]byte, error)
	WriteFile(path string, data []byte) error
	UploadFile(local, remote string) error
	DownloadFile(remote, local string) error
	WalkFiles(root string, fn func(string) error) error
	DeleteFile(path string) error
	Close() error
}

Client abstracts all remote file operations needed by drift. Both *sftp.Client and *ftp.Client satisfy this interface.

func Connect

func Connect(ctx context.Context, host config.Host) (Client, error)

Connect dials the host using the protocol specified in host.Protocol. An empty or "sftp" protocol uses SSH/SFTP; "ftp" uses plain FTP; "ftps" uses FTP over explicit TLS.

Jump to

Keyboard shortcuts

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