linuxssh

package
v0.0.0-...-d046166 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2020 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Overview

Package linuxssh provides Linux specific operations conducted via SSH TODO(oka): now that this file is not used from framework, simplify the code.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFile

func GetFile(ctx context.Context, s *ssh.Conn, src, dst string) error

GetFile copies a file or directory from the host to the local machine. dst is the full destination name for the file or directory being copied, not a destination directory into which it will be copied. dst will be replaced if it already exists.

func PutFiles

func PutFiles(ctx context.Context, s *ssh.Conn, files map[string]string,
	symlinkPolicy SymlinkPolicy) (bytes int64, err error)

PutFiles copies files on the local machine to the host. files describes a mapping from a local file path to a remote file path. For example, the call:

PutFiles(ctx, conn, map[string]string{"/src/from": "/dst/to"})

will copy the local file or directory /src/from to /dst/to on the remote host. Local file paths can be absolute or relative. Remote file paths must be absolute. SHA1 hashes of remote files are checked in advance to send updated files only. bytes is the amount of data sent over the wire (possibly after compression).

Types

type SymlinkPolicy

type SymlinkPolicy = int

SymlinkPolicy describes how symbolic links should be handled by PutFiles.

const (
	// PreserveSymlinks indicates that symlinks should be preserved during the copy.
	PreserveSymlinks SymlinkPolicy = iota
	// DereferenceSymlinks indicates that symlinks should be dereferenced and turned into normal files.
	DereferenceSymlinks
)

Jump to

Keyboard shortcuts

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