Update dependencies

This commit is contained in:
Alexander Neumann 2017-09-13 14:09:48 +02:00
parent f3b49987f8
commit fda563d606
926 changed files with 189726 additions and 98666 deletions

32
vendor/github.com/pkg/sftp/client.go generated vendored
View file

@ -14,12 +14,32 @@ import (
"golang.org/x/crypto/ssh"
)
// MaxPacket sets the maximum size of the payload.
func MaxPacket(size int) func(*Client) error {
// InternalInconsistency indicates the packets sent and the data queued to be
// written to the file don't match up. It is an unusual error and if you get it
// you should file a ticket.
var InternalInconsistency = errors.New("internal inconsistency")
// A ClientOption is a function which applies configuration to a Client.
type ClientOption func(*Client) error
// This is based on Openssh's max accepted size of 1<<18 - overhead
const maxMaxPacket = (1 << 18) - 1024
// MaxPacket sets the maximum size of the payload. The size param must be
// between 32768 (1<<15) and 261120 ((1 << 18) - 1024). The minimum size is
// given by the RFC, while the maximum size is a de-facto standard based on
// Openssh's SFTP server which won't accept packets much larger than that.
//
// Note if you aren't using Openssh's sftp server and get the error "failed to
// send packet header: EOF" when copying a large file try lowering this number.
func MaxPacket(size int) ClientOption {
return func(c *Client) error {
if size < 1<<15 {
return errors.Errorf("size must be greater or equal to 32k")
}
if size > maxMaxPacket {
return errors.Errorf("max packet size is too large (see docs)")
}
c.maxPacket = size
return nil
}
@ -27,7 +47,7 @@ func MaxPacket(size int) func(*Client) error {
// NewClient creates a new SFTP client on conn, using zero or more option
// functions.
func NewClient(conn *ssh.Client, opts ...func(*Client) error) (*Client, error) {
func NewClient(conn *ssh.Client, opts ...ClientOption) (*Client, error) {
s, err := conn.NewSession()
if err != nil {
return nil, err
@ -50,7 +70,7 @@ func NewClient(conn *ssh.Client, opts ...func(*Client) error) (*Client, error) {
// NewClientPipe creates a new SFTP client given a Reader and a WriteCloser.
// This can be used for connecting to an SFTP server over TCP/TLS or by using
// the system's ssh client program (e.g. via exec.Command).
func NewClientPipe(rd io.Reader, wr io.WriteCloser, opts ...func(*Client) error) (*Client, error) {
func NewClientPipe(rd io.Reader, wr io.WriteCloser, opts ...ClientOption) (*Client, error) {
sftp := &Client{
clientConn: clientConn{
conn: conn{
@ -611,7 +631,7 @@ func (c *Client) Mkdir(path string) error {
// applyOptions applies options functions to the Client.
// If an error is encountered, option processing ceases.
func (c *Client) applyOptions(opts ...func(*Client) error) error {
func (c *Client) applyOptions(opts ...ClientOption) error {
for _, f := range opts {
if err := f(c); err != nil {
return err
@ -791,7 +811,7 @@ func (f *File) WriteTo(w io.Writer) (int64, error) {
if inFlight == 0 {
if firstErr.err == nil && len(pendingWrites) > 0 {
return copied, errors.New("internal inconsistency")
return copied, InternalInconsistency
}
break
}