sshutil

package
v0.1.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DialSSH

func DialSSH(cfg SyncConfig) (*ssh.Client, error)

func GenerateEd25519Key

func GenerateEd25519Key(privateKeyPath string) (string, error)

GenerateEd25519Key generates an ed25519 key pair and writes to disk. Returns the public key string.

func ReadPublicKey added in v0.0.5

func ReadPublicKey(privateKeyPath string) (string, error)

ReadPublicKey reads the public key file from disk.

func RestartRemote

func RestartRemote(ctx context.Context, cfg SyncConfig, containerName string) error

RestartRemote runs docker restart on the remote host via SSH.

func TestSSH

func TestSSH(ctx context.Context, cfg SyncConfig) error

TestSSH tests SSH connectivity to a host.

Types

type SyncConfig

type SyncConfig struct {
	Host           string
	Port           int
	User           string
	PrivateKeyPath string
	SourceDir      string
	Exclude        []string
	DeleteExtra    bool
	KnownHostsPath string // path to known_hosts file (required)
}

SyncConfig holds configuration for a sync operation.

type SyncResult

type SyncResult struct {
	Host       string `json:"host"`
	FilesSent  int    `json:"files_sent"`
	FilesDel   int    `json:"files_deleted"`
	Error      string `json:"error,omitempty"`
	DurationMs int64  `json:"duration_ms"`
}

SyncResult holds the result of a sync operation.

func Sync

func Sync(ctx context.Context, cfg SyncConfig) (*SyncResult, error)

Sync performs an SFTP sync from source to remote.

Jump to

Keyboard shortcuts

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