Documentation

Overview

    Package linuxssh provides Linux specific operations conducted via SSH

    Index

    Constants

    This section is empty.

    Variables

    This section is empty.

    Functions

    func DeleteTree

    func DeleteTree(ctx context.Context, s *ssh.Conn, baseDir string, files []string) error

      DeleteTree deletes all relative paths in files from baseDir on the host. If a specified file is a directory, all files under it are recursively deleted. Non-existent files are ignored.

      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
            )

            Source Files