scp

package module
v0.0.0-...-24f402a Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2015 License: BSD-3-Clause Imports: 11 Imported by: 0

README

scp

GoDoc

Overview

Package scp provides SCP functionality atop the go.crypto/ssh package.

See the documentation on GoDoc.

License

3-clause BSD. A copy is included with the source.

Documentation

Overview

Package scp provides SCP functionality atop the go.crypto/ssh package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(c *ssh.Client, dir string, file *File) ([]string, error)

Write writes the given File to the directory specified. It returns a list of warnings and maybe an error on failure. Warnings are non-fatal, errors are fatal. If there are warnings returned, they're probably important.

Types

type File

type File struct {
	io.Reader
	// contains filtered or unexported fields
}

File is a file being read from or written to a remote host. It implements the io.Reader and os.FileInfo interfaces, with the io.Reader portion delegated through to a bufio.Reader in the case that this is a file being read from a remote host.

func NewFile

func NewFile(name string, size int64, mode os.FileMode, r io.Reader) *File

NewFile constructs a new File object with the given parameters. The size must be provided in advance because the remote host has to know how large the file is, so it can reject it in advance if there's not enough space.

func Read

func Read(c *ssh.Client, file string) (*File, error)

Read opens a session on the provided ssh.Client to run the scp program remotely in "from" mode, and handles the SCP protocol to the degree required to read the content of a single file.

Errors that occur before the content is being read will be returned directly from Read, while errors that occur during content reception will be returned via the Reader (e.g. from Reader.Read).

func (File) IsDir

func (f File) IsDir() bool

IsDir will always return false.

func (File) ModTime

func (f File) ModTime() time.Time

ModTime returns the modification time of the file. It is currently not implemented and returns a zero value.

func (File) Mode

func (f File) Mode() os.FileMode

Mode returns the mode reported by the remote side.

func (File) Name

func (f File) Name() string

Name returns the name of the file. It does not include the full path.

func (File) Size

func (f File) Size() int64

Size returns the size of the file in bytes.

func (File) Sys

func (f File) Sys() interface{}

Sys always returns nil.

Jump to

Keyboard shortcuts

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