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
- func GetFile(ctx context.Context, s *ssh.Conn, src, dst string, symlinkPolicy SymlinkPolicy) error
- func GetFileTail(ctx context.Context, conn *ssh.Conn, src, dst string, startLine, maxSize int64) error
- func PutFiles(ctx context.Context, s *ssh.Conn, files map[string]string, ...) (bytes int64, err error)
- func ReadFile(ctx context.Context, conn *ssh.Conn, path string) ([]byte, error)
- func WriteFile(ctx context.Context, conn *ssh.Conn, path string, data []byte, ...) error
- type SymlinkPolicy
- type WordCountInfo
Constants ¶
const ( // PreserveSymlinks indicates that symlinks should be preserved during the copy. PreserveSymlinks = linuxssh.PreserveSymlinks // DereferenceSymlinks indicates that symlinks should be dereferenced and turned into normal files. DereferenceSymlinks = linuxssh.DereferenceSymlinks )
Variables ¶
This section is empty.
Functions ¶
func GetFile ¶
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 GetFileTail ¶
func GetFileTail(ctx context.Context, conn *ssh.Conn, src, dst string, startLine, maxSize int64) error
GetFileTail reads the file on the path and returns the file truncate by command tail with the Max System Message Log Size and destination.
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).
func WriteFile ¶
func WriteFile(ctx context.Context, conn *ssh.Conn, path string, data []byte, perm os.FileMode) error
WriteFile writes data to the file on the path. If the file does not exist, WriteFile creates it with permissions perm; otherwise WriteFile truncates it before writing, without changing permissions. Unlike ioutil.WriteFile, it doesn't apply umask on perm.
Types ¶
type SymlinkPolicy ¶
type SymlinkPolicy = linuxssh.SymlinkPolicy
SymlinkPolicy describes how symbolic links should be handled by PutFiles.
type WordCountInfo ¶
WordCountInfo describes the result from the unix command wc.