From e002d3d1c88fea6c964fa3a09d72cc81e793a444 Mon Sep 17 00:00:00 2001 From: fangdingjun Date: Sat, 4 Aug 2018 13:38:43 +0800 Subject: [PATCH] change max packet size --- obfscp/scp.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/obfscp/scp.go b/obfscp/scp.go index 873a5c0..ce11e6c 100644 --- a/obfscp/scp.go +++ b/obfscp/scp.go @@ -210,7 +210,7 @@ func createSFTPConn(host, user string, cfg *options) (*sftp.Client, error) { //defer conn.Close() - sftpConn, err := sftp.NewClient(conn.Client(), sftp.MaxPacket(64*1024)) + sftpConn, err := sftp.NewClient(conn.Client(), sftp.MaxPacket(32*1024)) if err != nil { //log.Fatal(err) return nil, err @@ -326,6 +326,7 @@ func upload(args []string, cfg *options) error { sftpConn, err := createSFTPConn(host, user, cfg) if err != nil { + log.Debugf("create sftp failed: %s", err) return err } defer sftpConn.Close() @@ -591,7 +592,7 @@ func passwordAuth() (string, error) { // use this function has no problem // func copyFile(w io.Writer, r io.Reader) error { - buf := make([]byte, 34*1024) + buf := make([]byte, 32*1024) for { n, err := r.Read(buf) if n > 0 {