Commit Graph

212 Commits

Author SHA1 Message Date
John Eikenberry 027e3db83b handle all status packet results the same 2017-04-17 17:52:26 -07:00
unclejack 94df0a367c client,packet: remove redundant select & return
Signed-off-by: Cristian Staretu <cristian.staretu@gmail.com>
2017-02-25 12:56:13 -08:00
John Eikenberry ff7e52ffd7 Fix deadlock issue in client Read and WriteTo
Same bug from ReadFrom and Write as referenced in ticket #145.
See a couple back for commit message with explanation.
2017-02-13 17:36:29 -08:00
John Eikenberry 15a2bdbeee Fix deadlock issue in client ReadFrom and Write
Fixes github issue #145

Increase the buffer of channel for dispatchRequest() responses to be
equal to the maximum possible difference between desiredInFlight minus
inFlight, as this is the maximum possible error returns it would get
before moving on to channel handling code.
2017-02-13 00:32:44 -08:00
Allan Feid dab2d69fc2 Make remove directory public 2017-02-05 15:08:02 -08:00
Andrew Kupasrimonkol 59640f4fcc Make SSH_FXP_STATUS "message" field optional.
Cisco SSH 2.0 server doesn't fill out the "message" field,
even though it returns valid status codes. This makes
File.Read method error out without actually reading the
file due to unmarshalStatus returning a "packet too short"
error.
2017-02-05 14:53:51 -08:00
Paul Komkoff b4b1d297a4 Fix hang on error in WriteTo.
When writer returns an error, the code would mess up inFlight counter
and the loop will never finish as the result.

We switch to only use inFlight to count requests to sftp server -
we delete from pendingWrites now so we can use len(pendingWrites) to
count.
2017-02-05 14:25:51 -08:00
Paul Komkoff caba5e8043 Fix memory leak in WriteTo.
When reassembling out-of-order responses, give Go a chance to
free blocks we already wrote.
2017-02-05 14:25:51 -08:00
John Eikenberry f37534d398 Fixes #83, documentation of File.Read()
Docs had it following semantics of os.File.Read when it was actually
adhering to io.Reader.Read semantics.
2017-01-13 19:58:21 -08:00
Carl Jackson 8197a2e580 client: satisfy go vet (#136) 2016-09-08 20:00:35 +10:00
Dave Cheney ea1a7bcdfc conn: seperate io.Reader and io.WriteCloser (#118)
Reading and Writing are less coupled in the sftp client and server than
they may be over a traditional ReadWriter. This mirrors the full duplex
/ half close nature of a TCP connection.

In essence conn.Reader cannot be closed locally, it can only close in
response to the remote side using conn.WriteCloser.Close(), or a network
error, which is effectively the same thing.

Make this behaviour super clear by no longer smooshing the type into a
ReadWriteCloser.
2016-06-15 20:19:51 +10:00
Dave Cheney 1a25dc501f rename sendRequest to sendPacket
clientConn.sendPacket now obscures clientConn.conn.sendPacket with a
diferent signature.
2016-06-15 18:57:05 +10:00
Dave Cheney 0847713e96 Migrate sendRequest to clientConn 2016-06-15 18:30:05 +10:00
Dave Cheney c91ab27c13 Move client.Close to clientConn.Close 2016-06-15 18:23:51 +10:00
Dave Cheney 9184483985 Introduce clientConn
clientConn embeds a conn and adds the basic loop/recv methods.
2016-06-15 18:08:04 +10:00
Dave Cheney a3218d2747 client: break out recv into loop and recv (#115)
This isolates the use of broadcastErr from the normal recv/lookup loop.
2016-06-15 17:58:19 +10:00
Dave Cheney 7d4fc94878 Introduce sftp.conn type to handle common send/recv behaviour (#113)
Introduce sftp.conn type to bind packet send/recv to a
io.ReadWriteCloser.
2016-06-15 11:50:02 +10:00
Dave Cheney 04d5f67e72 Small cleanups 2016-06-14 18:05:33 +10:00
akupas f4e06643a3 Make SSH_FXP_STATUS error message optional (#109)
Some SSH implementations do not include an error message in the
SSH_FXP_STATUS response causing an "index out of range" panic.
2016-06-14 12:24:38 +10:00
Dave Cheney 530345cb99 client: use a waitgroup rather than a close channel (#112) 2016-06-13 22:40:12 +10:00
Dave Cheney aca140bc99 Revert "Fix sendRequest"
This reverts commit 7500207056.
2016-06-13 21:37:38 +10:00
Dave Cheney 7500207056 Fix sendRequest
sendRequest was not returning a value to the channel if there was
_not_ an error. How did this even work ?!?

Also remove server_test.go because it was wrong, it was testing that
sending a properly formed, but invalid (ie, requested wrong extended
packet) packet would cause an error during send ... which is wrong.
sendRequest will only return an error if the client connection was
closed.
2016-06-13 21:29:13 +10:00
Dave Cheney 5e9ad277fc Use pkg/errors for error handling (#101) 2016-05-19 15:16:48 +10:00
Matt Layher 9374ae613d *: golint: add and fix up comments on exported types 2016-01-07 15:16:34 -05:00
Matt Layher b348482b1a *: golint (part 1) 2016-01-07 12:10:24 -05:00
Matt Layher 3fa7dab0f1 client: add normaliseError, make Client.{Lstat,Open,Stat} satisfy os.IsNotExist 2016-01-03 16:10:58 -05:00
Dave Cheney bd1c81068b Always pass buffered channel to Read/Write
Fixes #55

c.sendRequest always does the right thing, but a few fast paths were not
constructing a buffered channel which would cause c.dispatchRequest to
block on error.
2015-12-25 18:35:37 +01:00
xiu 00e2b63272 Merge branch 'master' into bugfix/35-cant-remove-directories-on-servu 2015-12-23 17:14:04 +01:00
Matthew Sykes f5afc8315a Add Getwd to client 2015-12-22 09:04:46 -05:00
Dave Cheney 167ae32ca7 Handle osx returning EPERM not ENOTDIR
Fixes #57

Also fix the integration tests to run on darwin by default.
2015-12-22 13:34:21 +09:00
xiu 2034fcb625 Support SSH_FX_FILE_IS_A_DIRECTORY while trying to remove a directory 2015-12-21 16:27:15 +01:00
Dave Cheney e09e01e6e1 Merge pull request #53 from boomlinde/missing-language-tag
make the StatusError language tag optional
2015-10-31 11:23:59 +11:00
Philip Linde e6dc896441 make the StatusError language tag optional 2015-10-27 12:16:11 +01:00
Josh Deprez d434a0c545 Add Name method to File
Similar to os.File's Name.
2015-09-25 17:55:20 +10:00
Mark Sheahan a6fc4b8c1f Add comments for *Client.Stat and *Client.Lstat 2015-09-07 23:04:52 -07:00
Mark Sheahan d80ae36051 rmdir and symlink packet handling 2015-09-07 01:05:16 -07:00
Mark Sheahan 7bb2083ca9 Address review comments; about to change decodePacket() 2015-09-06 23:55:15 -07:00
Mark Sheahan 0aec5ce5ec use merge-to target branches, not ScriptRock ones 2015-09-06 21:54:42 -07:00
Mark Sheahan 4325c3654b fix format of 'name' packets (shortname, longname, attrs), add Stat 2015-08-05 12:57:28 -07:00
Mark Sheahan 2f3ef8b897 Merge branch 'master' into server 2015-08-04 21:11:01 -07:00
Mark Sheahan 615df6108a Merge branch 'master' of https://github.com/pkg/sftp 2015-08-04 21:00:34 -07:00
Mark Sheahan f4c4138a0e update client integration tests for more coverage 2015-08-04 20:47:26 -07:00
Mark Sheahan 0f2bc1aa17 server is passing the client integration tests now. I don't understand the ATTRs field, it has a name in it. 2015-07-31 23:09:51 -07:00
Mark Sheahan 5b6348f034 version, lstat 2015-07-25 01:19:29 -07:00
Dave Cheney c1748e2776 Fix typo in slice creation.
Fixes #43
2015-06-15 20:12:08 +10:00
Glenn Griffin 34978efaaf Address review comments and fix a data race.
Previously sftp.Close() would only shutdown the write side of the
connection and return. The sftp server would then shutdown the read side
of the connection at which point the recv goroutine would receive a
failure and return. When using a local sftp server in the intergration
tests we first call sftp.Close() followed by cmd.Wait(). cmd.Wait()
calls close on stdout while the sftp recv goroutine is still reading
from it. The fix is to block in sftp.Close() until the sftp server has
closed the receive end of the connection and the recv goroutine has
subsequently exited.
2015-06-03 09:33:09 -07:00
Glenn Griffin 29600148e4 Handle recvPacket in a single goroutine.
Previously recvPacket would be invoked in several goroutines. This meant
that when multiple concurrent requests were in flight there were N
goroutines each waiting on recvPacket. For optimal throughput the goal
is to send a new request as quickly as possible once a response is
received. The previous mechanism worked counter to this because the
goroutine sending new requests would be competing against N recvPacket
goroutines that may become runnable as data streams in. Having a single
goroutine responsible for recvPacket means that the recv and send
goroutines will ping-pong back and forth optimizing throughput.

This changes shows a ~10-25% increase in throughput in the the *Delay*
benchmark tests.

$ go test -bench=. -integration
PASS
BenchmarkRead1k	       2	 840068631 ns/op	  12.48 MB/s
BenchmarkRead16k	      20	  72968548 ns/op	 143.70 MB/s
BenchmarkRead32k	      30	  56871347 ns/op	 184.38 MB/s
BenchmarkRead128k	     100	  34150953 ns/op	 307.05 MB/s
BenchmarkRead512k	     100	  15730685 ns/op	 666.59 MB/s
BenchmarkRead1MiB	     200	  10462421 ns/op	1002.24 MB/s
BenchmarkRead4MiB	     200	   7325236 ns/op	1431.47 MB/s
BenchmarkRead4MiBDelay10Msec	      10	 186893765 ns/op	  56.11 MB/s
BenchmarkRead4MiBDelay50Msec	       2	 907127114 ns/op	  11.56 MB/s
BenchmarkRead4MiBDelay150Msec	       1	2708025060 ns/op	   3.87 MB/s
BenchmarkWrite1k	       1	1623940932 ns/op	   6.46 MB/s
BenchmarkWrite16k	      10	 174293843 ns/op	  60.16 MB/s
BenchmarkWrite32k	      10	 120377272 ns/op	  87.11 MB/s
BenchmarkWrite128k	      20	  54592205 ns/op	 192.08 MB/s
BenchmarkWrite512k	      50	  66449591 ns/op	 157.80 MB/s
BenchmarkWrite1MiB	      50	  70965660 ns/op	 147.76 MB/s
BenchmarkWrite4MiB	      50	  69234861 ns/op	 151.45 MB/s
BenchmarkWrite4MiBDelay10Msec	       5	 276624260 ns/op	  37.91 MB/s
BenchmarkWrite4MiBDelay50Msec	       1	1318396552 ns/op	   7.95 MB/s
BenchmarkWrite4MiBDelay150Msec	       1	3918416658 ns/op	   2.68 MB/s
BenchmarkCopyDown10MiBDelay10Msec	      10	 152240808 ns/op	  68.88 MB/s
BenchmarkCopyDown10MiBDelay50Msec	       2	 715003188 ns/op	  14.67 MB/s
BenchmarkCopyDown10MiBDelay150Msec	       1	2116878801 ns/op	   4.95 MB/s
BenchmarkCopyUp10MiBDelay10Msec	      10	 192748258 ns/op	  54.40 MB/s
BenchmarkCopyUp10MiBDelay50Msec	       2	 691486538 ns/op	  15.16 MB/s
BenchmarkCopyUp10MiBDelay150Msec	       1	1997162991 ns/op	   5.25 MB/s
BenchmarkMarshalInit	 2000000	       644 ns/op
BenchmarkMarshalOpen	 3000000	       562 ns/op
BenchmarkMarshalWriteWorstCase	   20000	     75166 ns/op
BenchmarkMarshalWrite1k	  500000	      3862 ns/op
ok  	github.com/pkg/sftp	71.174s
2015-06-02 13:13:32 -07:00
Glenn Griffin de236e835b Implement ReadFrom for *sftp.File
Improve the naive io.Copy case by splitting up the transfer into
multiple concurrent chunks similar to how large Write's are performed. This
improves the throughput on the BenchmarkCopyUp tests by 15-20x.

$ go test -bench=. -integration
PASS
BenchmarkRead1k	      20	  78382052 ns/op	 133.78 MB/s
BenchmarkRead16k	     100	  14038681 ns/op	 746.93 MB/s
BenchmarkRead32k	     100	  12076514 ns/op	 868.29 MB/s
BenchmarkRead128k	     200	   8892708 ns/op	1179.16 MB/s
BenchmarkRead512k	     300	   5937224 ns/op	1766.13 MB/s
BenchmarkRead1MiB	     300	   5383775 ns/op	1947.68 MB/s
BenchmarkRead4MiB	     300	   5896306 ns/op	1778.38 MB/s
BenchmarkRead4MiBDelay10Msec	       5	 213987487 ns/op	  49.00 MB/s
BenchmarkRead4MiBDelay50Msec	       1	1013717329 ns/op	  10.34 MB/s
BenchmarkRead4MiBDelay150Msec	       1	3012666692 ns/op	   3.48 MB/s
BenchmarkWrite1k	      10	 189878293 ns/op	  55.22 MB/s
BenchmarkWrite16k	      50	  57726712 ns/op	 181.65 MB/s
BenchmarkWrite32k	      30	  79804300 ns/op	 131.39 MB/s
BenchmarkWrite128k	      20	  71296126 ns/op	 147.08 MB/s
BenchmarkWrite512k	      20	 101823875 ns/op	 102.98 MB/s
BenchmarkWrite1MiB	      50	  70351842 ns/op	 149.05 MB/s
BenchmarkWrite4MiB	      20	  70187426 ns/op	 149.40 MB/s
BenchmarkWrite4MiBDelay10Msec	       5	 333251686 ns/op	  31.47 MB/s
BenchmarkWrite4MiBDelay50Msec	       1	1576708254 ns/op	   6.65 MB/s
BenchmarkWrite4MiBDelay150Msec	       1	4823796059 ns/op	   2.17 MB/s
BenchmarkCopyDown10MiBDelay10Msec	      10	 196175368 ns/op	  53.45 MB/s
BenchmarkCopyDown10MiBDelay50Msec	       2	 918624682 ns/op	  11.41 MB/s
BenchmarkCopyDown10MiBDelay150Msec	       1	2880111274 ns/op	   3.64 MB/s
BenchmarkCopyUp10MiBDelay10Msec	       5	 246048181 ns/op	  42.62 MB/s
BenchmarkCopyUp10MiBDelay50Msec	       2	 872059111 ns/op	  12.02 MB/s
BenchmarkCopyUp10MiBDelay150Msec	       1	2516801139 ns/op	   4.17 MB/s
BenchmarkMarshalInit	 2000000	       690 ns/op
BenchmarkMarshalOpen	 3000000	       579 ns/op
BenchmarkMarshalWriteWorstCase	   20000	     60438 ns/op
BenchmarkMarshalWrite1k	  300000	      4318 ns/op
ok  	github.com/pkg/sftp	70.210s
2015-06-02 13:13:32 -07:00
Glenn Griffin 828850be97 Implement WriteTo for *sftp.File
Improve the naive io.Copy case by splitting up the transfer into
multiple concurrent chunks similar to how large Read's are performed. This
improves the throughput on the BenchmarkCopyDown tests by 15-20x.

$ go test -bench=. -integration
PASS
BenchmarkRead1k	      20	  80039871 ns/op	 131.01 MB/s
BenchmarkRead16k	     100	  13109576 ns/op	 799.86 MB/s
BenchmarkRead32k	     100	  13002925 ns/op	 806.42 MB/s
BenchmarkRead128k	     200	   9189480 ns/op	1141.07 MB/s
BenchmarkRead512k	     300	   5863892 ns/op	1788.21 MB/s
BenchmarkRead1MiB	     300	   5350731 ns/op	1959.71 MB/s
BenchmarkRead4MiB	     300	   5880209 ns/op	1783.25 MB/s
BenchmarkRead4MiBDelay10Msec	       5	 211600615 ns/op	  49.56 MB/s
BenchmarkRead4MiBDelay50Msec	       1	1014580728 ns/op	  10.34 MB/s
BenchmarkRead4MiBDelay150Msec	       1	3015748763 ns/op	   3.48 MB/s
BenchmarkWrite1k	      10	 210602614 ns/op	  49.79 MB/s
BenchmarkWrite16k	      30	  53914210 ns/op	 194.49 MB/s
BenchmarkWrite32k	      20	  68630676 ns/op	 152.79 MB/s
BenchmarkWrite128k	      50	  70518854 ns/op	 148.70 MB/s
BenchmarkWrite512k	      30	  69846510 ns/op	 150.13 MB/s
BenchmarkWrite1MiB	      30	  70971873 ns/op	 147.75 MB/s
BenchmarkWrite4MiB	      20	  68902426 ns/op	 152.18 MB/s
BenchmarkWrite4MiBDelay10Msec	       5	 334770724 ns/op	  31.32 MB/s
BenchmarkWrite4MiBDelay50Msec	       1	1439154435 ns/op	   7.29 MB/s
BenchmarkWrite4MiBDelay150Msec	       1	4381710538 ns/op	   2.39 MB/s
BenchmarkCopyDown10MiBDelay10Msec	      10	 161331837 ns/op	  64.99 MB/s
BenchmarkCopyDown10MiBDelay50Msec	       2	 844679071 ns/op	  12.41 MB/s
BenchmarkCopyDown10MiBDelay150Msec	       1	2721133400 ns/op	   3.85 MB/s
BenchmarkCopyUp10MiBDelay10Msec	       1	3410147635 ns/op	   3.07 MB/s
BenchmarkCopyUp10MiBDelay50Msec	       1	16310789039 ns/op	   0.64 MB/s
BenchmarkCopyUp10MiBDelay150Msec	       1	48479031068 ns/op	   0.22 MB/s
BenchmarkMarshalInit	 2000000	       685 ns/op
BenchmarkMarshalOpen	 3000000	       606 ns/op
BenchmarkMarshalWriteWorstCase	   20000	     81904 ns/op
BenchmarkMarshalWrite1k	  300000	      4646 ns/op
ok  	github.com/pkg/sftp	128.842s
2015-06-02 13:13:32 -07:00
Glenn Griffin d9e7820587 Increase throughput of Read/Write.
Break up Read/Write calls into multiple concurrent requests to allow the
roundtrip time to the server to overlap. This provides a roughly 10x
throughput increase when using large buffers over a high latency link. This
does not help the naive io.Copy case since io.Copy defaults to an 8k buffer.

$ go test -bench=. -integration
PASS
BenchmarkRead1k	      20	  82017395 ns/op	 127.85 MB/s
BenchmarkRead16k	     100	  14634723 ns/op	 716.51 MB/s
BenchmarkRead32k	     100	  13706765 ns/op	 765.02 MB/s
BenchmarkRead128k	     200	   9614364 ns/op	1090.65 MB/s
BenchmarkRead512k	     200	   5778457 ns/op	1814.65 MB/s
BenchmarkRead1MiB	     300	   5624251 ns/op	1864.41 MB/s
BenchmarkRead4MiB	     200	   5798324 ns/op	1808.43 MB/s
BenchmarkRead4MiBDelay10Msec	       5	 214369945 ns/op	  48.91 MB/s
BenchmarkRead4MiBDelay50Msec	       1	1014850552 ns/op	  10.33 MB/s
BenchmarkRead4MiBDelay150Msec	       1	3016993337 ns/op	   3.48 MB/s
BenchmarkWrite1k	      10	 200740041 ns/op	  52.24 MB/s
BenchmarkWrite16k	      50	  74597799 ns/op	 140.57 MB/s
BenchmarkWrite32k	      20	  63229429 ns/op	 165.84 MB/s
BenchmarkWrite128k	      20	  78691019 ns/op	 133.25 MB/s
BenchmarkWrite512k	      20	  64372711 ns/op	 162.89 MB/s
BenchmarkWrite1MiB	      20	  95393443 ns/op	 109.92 MB/s
BenchmarkWrite4MiB	      20	  72211301 ns/op	 145.21 MB/s
BenchmarkWrite4MiBDelay10Msec	       3	 335329748 ns/op	  31.27 MB/s
BenchmarkWrite4MiBDelay50Msec	       1	1668562466 ns/op	   6.28 MB/s
BenchmarkWrite4MiBDelay150Msec	       1	4535944414 ns/op	   2.31 MB/s
BenchmarkCopyDown10MiBDelay10Msec	       1	3371273197 ns/op	   3.11 MB/s
BenchmarkCopyDown10MiBDelay50Msec	       1	16250399252 ns/op	   0.65 MB/s
BenchmarkCopyDown10MiBDelay150Msec	       1	48459210755 ns/op	   0.22 MB/s
BenchmarkCopyUp10MiBDelay10Msec	       1	3410202609 ns/op	   3.07 MB/s
BenchmarkCopyUp10MiBDelay50Msec	       1	16291168491 ns/op	   0.64 MB/s
BenchmarkCopyUp10MiBDelay150Msec	       1	48478335678 ns/op	   0.22 MB/s
BenchmarkMarshalInit	 2000000	       716 ns/op
BenchmarkMarshalOpen	 2000000	       638 ns/op
BenchmarkMarshalWriteWorstCase	   20000	     61127 ns/op
BenchmarkMarshalWrite1k	  300000	      4724 ns/op
ok  	github.com/pkg/sftp	186.575s
2015-06-02 13:13:15 -07:00
Dave Cheney 2fc1e77011 Final cleanup 2015-05-24 14:56:15 +10:00
Dave Cheney a17c010174 use a named type for readability 2015-05-24 14:51:18 +10:00
Dave Cheney c020667ac1 Make c.sendRequest concurrent
This is an attempt to permit overlapping requests.

For each request sent, we spin off a goroutine to send the request for us
then handle _a_ response. That goroutine will try to dispatch the request
to the original sender. As every request is initiated from the client, there
will always be a matching number of replies from the server so eventally
every worker goroutine will process a request and exit.
2015-05-23 22:51:29 +10:00
Dave Cheney be8bb997e5 Add MaxPacket option to increase the size of the payload
% buffered-read-benchmark
2015/05/23 21:51:27 reading 1e+09 bytes
2015/05/23 21:51:53 read 1000000000 bytes in 25.668237836s
% buffered-read-benchmark -s 65536
2015/05/23 21:52:02 reading 1e+09 bytes
2015/05/23 21:52:20 read 1000000000 bytes in 18.419390056s
% buffered-read-benchmark -s 262144
2015/05/23 21:52:50 reading 1e+09 bytes
2015/05/23 21:53:08 read 1000000000 bytes in 18.367038236s
2015-05-23 21:53:59 +10:00
Dave Cheney 50631306d7 Push c.mu.Lock/Unlock down to sendRequest
Also includes gofmt cleanups
2015-05-23 17:10:22 +10:00
Maximilian Pachl 267a179e16 added integration test for client.StatVFS 2015-05-16 00:54:02 +02:00
Maximilian Pachl 0b805e96f9 added statvfs@openssh.com extension request 2015-05-15 20:37:52 +02:00
Mark Sheahan 1165da51c7 Updated to use github.com/Scriptrock/crypto/ssh 2015-02-13 09:59:47 -08:00
Mark Sheahan 074b201d7d Reference ScriptRock ssh library, not current google one 2015-01-08 20:33:06 -08:00
Javier Blazquez 62281627fa Fixed write errors not bubbling up correctly 2014-12-18 17:22:24 -08:00
Otto Bretz 1c05ca70ba New import paths for Go sub-respositories
see https://groups.google.com/forum/?fromgroups#!topic/golang-nuts/eD8dh3T9yyA
2014-11-06 09:30:12 +01:00
Alexander Neumann e2bfa2bf74 Reduce code duplication in init 2014-10-09 21:10:54 +02:00
Alexander Neumann 24e228535b Check version on init 2014-10-09 21:10:54 +02:00
Alexander Neumann 5af3cfa4ea Add sftp.NewClientPipe()
This method returns a Client from a pair of pipes.  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).

An Example function is added, and the client integration test uses the
function.
2014-09-30 00:49:01 +02:00
Matthieu Rakotojaona 6c93917172 Manually marshal readlink packet 2014-09-28 03:57:44 +02:00
Dave Cheney 09a8c3d9c0 Merge pull request #18 from rakoo/marshalling
Manually marshal packets for more speed
2014-09-28 11:01:28 +10:00
Matthieu Rakotojaona c01839afa0 Manually marshal packets for more speed 2014-09-27 14:29:57 +02:00
Andy Hochhaus a2df54ebb9 ReadLink cleanups. 2014-09-23 14:42:28 -04:00
Andy Hochhaus f64817295f Implement ssh_FXP_READLINK 2014-09-22 22:29:20 -04:00
Donavan Pantke 1260413c8e Switch from fi to fs for type clarity. 2014-06-24 02:06:55 -04:00
Donavan Pantke 5ea2cc512e Refactor stat functions to look more like Go's original. Also allows for access to fields we can access from SFTP but do not conform to os.FileInfo. 2014-06-22 23:11:28 -04:00
Donavan Pantke 1fdb26e0b9 Fix a few various typecasting bugs. 2014-06-22 16:01:04 -04:00
Donavan Pantke 0ed9339c17 Implement aliases to client methods in an individual File. 2014-06-22 01:48:11 -04:00
Donavan Pantke 17a3539b2a Remove old Chtimes implementation. 2014-06-22 01:26:53 -04:00
Donavan Pantke 311e0fd159 Slightly refactor Chtimes and add support for other variants of setstat. 2014-06-22 01:25:40 -04:00
Donavan Pantke 7b37dffc24 Merge commit 'ecc928e8ba95a479858406dd87029a55cbd3262b' 2014-06-21 20:48:56 -04:00
Donavan Pantke c077755e5d Convert Chtimes to a setstat call for reuse with other stat setting functions. 2014-06-21 20:48:40 -04:00
Sean Treadway b5d9767c0a Consistent puncutation, names and constants
* European sentence punctuation, consistent with package docs
  * Match os.SEEK_* constants instead of numeric constants from io.Seeker
  * Consistent (shorter) receiver name for quickcheck value
2014-06-13 10:22:04 +02:00
Sean Treadway 68aec0278e Implement io.Seeker for *sftp.File
Test that reads at the seeked offset of sftp.File are consistent with
the reads of offset of os.File for the same file.

Error conditions and undefined seeks are not tested.
2014-06-11 21:17:53 +02:00
Dave Cheney 452cdf6b53 Merge from nemith-master 2014-05-25 14:31:57 +10:00
Dave Cheney 451f9602c8 Merge pull request #4 from claudiofelber/master
Added client methods CreateDirectory() and RemoveDirectory()
2014-05-25 14:24:03 +10:00
Saulius Gurklys 8d59c9c638 Fixed incompatibility with latest code.google.com/p/go.crypto/ssh 2014-04-10 15:37:10 +03:00
Claudio Felber c9c2be8791 Added function Chtimes() to modify access and modification time of a file 2013-12-11 00:18:53 +01:00
Claudio Felber e8b14451d6 For better standard file system interface compatibility:
- Renamed CreateDirectory() to MkDir()
- Integrated RemoveDirectory() into Remove()
2013-11-23 14:00:17 +01:00
Claudio Felber e2bb7bc10b Added client methods CreateDirectory() and RemoveDirectory() 2013-11-23 00:35:12 +01:00
Dave Cheney b8aa2fe3d1 Fixed Read, removed ReadAt
ReadAt should be replaced by Seek when the fs interface provides it.
2013-11-15 22:04:14 +11:00
Dave Cheney 4d6ea4f122 Added OpenFile support
Close #3
2013-11-14 15:32:21 +11:00
Dave Cheney 31b82445b2 Switched back to kr/fs 2013-11-11 12:57:03 +11:00
Dave Cheney 216912b085 Added Client.sendRequest, and more tests 2013-11-08 21:56:25 +11:00
Dave Cheney d4d73b4a58 Added better walk tests 2013-11-08 21:24:50 +11:00
Dave Cheney 046ffa9135 Assert that *Client is a fs.FileSystem 2013-11-07 17:43:06 +11:00
Dave Cheney 3fd0eb3048 Switched from WalkFunc to WalkFS 2013-11-07 17:23:51 +11:00
Dave Cheney e24b14daee always use path.Join 2013-11-07 12:50:01 +11:00
Dave Cheney e31015aaf3 Use forked fs.Walker 2013-11-07 11:31:46 +11:00
Dave Cheney 331b71c05b Added more example and help text 2013-11-06 19:48:37 +11:00
Dave Cheney 2a93daf2d0 made all constants private 2013-11-06 19:10:28 +11:00
Dave Cheney a5056a6347 fixed writing 2013-11-06 16:09:06 +11:00
Dave Cheney 44d7769a0d added File.Stat/fstat coverage 2013-11-06 16:03:08 +11:00
Dave Cheney fc1d4adce0 more integration tests 2013-11-06 15:53:14 +11:00
Dave Cheney ec6ff9e634 Initial integration tests 2013-11-06 15:40:35 +11:00
Dave Cheney 0a125fe805 added tests for ok/eof helpers 2013-11-06 15:00:04 +11:00
Dave Cheney f687584582 use unmarshalStatus everywhere 2013-11-06 14:50:04 +11:00
Dave Cheney 7f887a54b8 added Client.Rename and example 2013-11-06 14:15:26 +11:00
Dave Cheney af29244473 Added Client.Remove and example 2013-11-06 14:08:26 +11:00
Dave Cheney 566083d9db Remove duplicate package doc 2013-11-06 13:10:18 +11:00
Dave Cheney 402fa50430 added Write/writeAt and example 2013-11-06 13:04:40 +11:00
Dave Cheney 6247331082 implement open(path, flags) 2013-11-06 12:53:45 +11:00
Dave Cheney 9407ad8dcb Move functions around 2013-11-06 12:42:14 +11:00
Dave Cheney e7b8e37839 Added File.Stat and example 2013-11-06 12:36:05 +11:00
Dave Cheney d533956e46 added File.Close 2013-11-06 11:30:01 +11:00
Dave Cheney 3f580d42b1 Added Client.Open method and example 2013-11-06 11:04:26 +11:00
Dave Cheney 97f68804ee the time has come to split sftp into client and server 2013-11-05 22:16:36 +11:00