scp

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package scp implements the Secure Copy (SCP) client protocol.

Index

Constants

View Source
const DefaultBinary = "scp"

DefaultBinary is the default name of the scp binary.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// Binary is the path to the scp binary.
	Binary string

	// Timeout is the timeout for the copy action.
	Timeout time.Duration
	// contains filtered or unexported fields
}

Client implements the SCP client protocol.

func New

func New(c *secureshell.Client) *Client

func NewClient

func NewClient(c *ssh.Client) *Client

func (*Client) Read

func (c *Client) Read(name string, w io.Writer) (os.FileInfo, error)

Read reads a single remote file and copies its contents to the passed writer.

func (*Client) ReadFile

func (c *Client) ReadFile(src, dst string) error

ReadFile reads a single remote file src and copies its contents to a local file dst. The time and mode attributes are copied from the remote file.

func (*Client) Send

func (c *Client) Send(r io.Reader, name string, size int64, mode os.FileMode) error

Send writes from the reader and copies its contents to remote file.

func (*Client) SendFile

func (c *Client) SendFile(src, dst string) error

SendFile reads a single local file src and copies its contents to a remote file dst.

func (*Client) SendWithTime

func (c *Client) SendWithTime(r io.Reader, name string, size int64, mode os.FileMode, modTime time.Time) error

SendWithTime is like Send but with specified modification time.

type ProtocolError

type ProtocolError struct {
	Message string
	Fatal   bool
}

func (ProtocolError) Error

func (err ProtocolError) Error() string

Jump to

Keyboard shortcuts

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