Rename LICENCE to LICENSE
Merge pull request #29 from gbbr/patch-1

Rename LICENCE to LICENSE
Update wercker config
Send sftp packets in parallel

Benchmarks before:

    BenchmarkRead1k           10     142398598 ns/op      73.64 MB/s
    BenchmarkRead16k          50      32758323 ns/op     320.10 MB/s
    BenchmarkRead32k         100      42391983 ns/op     247.36 MB/s
    BenchmarkRead128k         50      42014906 ns/op     249.58 MB/s
    BenchmarkRead512k         50      32767844 ns/op     320.01 MB/s
    BenchmarkRead1MiB         50      38830615 ns/op     270.04 MB/s
    BenchmarkRead4MiB         50      33023037 ns/op     317.53 MB/s
    BenchmarkWrite1k          10     140492382 ns/op      74.64 MB/s
    BenchmarkWrite16k         50      37735998 ns/op     277.87 MB/s
    BenchmarkWrite32k         50      34301633 ns/op     305.70 MB/s
    BenchmarkWrite128k        50      29061948 ns/op     360.81 MB/s
    BenchmarkWrite512k        50      36087549 ns/op     290.57 MB/s
    BenchmarkWrite1MiB        50      39458367 ns/op     265.75 MB/s
    BenchmarkWrite4MiB        50      32230107 ns/op     325.34 MB/s
    BenchmarkMarshalInit     5000000           651 ns/op
    BenchmarkMarshalOpen     5000000           577 ns/op
    BenchmarkMarshalWriteWorstCase     50000         46544 ns/op
    BenchmarkMarshalWrite1k   500000          2823 ns/op
    ok      github.com/pkg/sftp 39.618s

after:

    BenchmarkRead1k        1        1069701026 ns/op           9.80 MB/s
    BenchmarkRead16k              20         111213902 ns/op          94.29 MB/s
    BenchmarkRead32k              50          69827661 ns/op         150.17 MB/s
    BenchmarkRead128k             50          43963052 ns/op         238.52 MB/s
    BenchmarkRead512k            100          26209817 ns/op         400.07 MB/s
    BenchmarkRead1MiB            100          22649939 ns/op         462.95 MB/s
    BenchmarkRead4MiB             50          35849768 ns/op         292.50 MB/s
    BenchmarkWrite1k               1        2450890588 ns/op           4.28 MB/s
    BenchmarkWrite16k             10         222473163 ns/op          47.13 MB/s
    BenchmarkWrite32k             10         135452515 ns/op          77.41 MB/s
    BenchmarkWrite128k            50          52768404 ns/op         198.72 MB/s
    BenchmarkWrite512k            50          31508170 ns/op         332.80 MB/s
    BenchmarkWrite1MiB            50          27730215 ns/op         378.14 MB/s
    BenchmarkWrite4MiB            50          43410403 ns/op         241.55 MB/s
    BenchmarkMarshalInit     5000000               659 ns/op
    BenchmarkMarshalOpen     5000000               560 ns/op
    BenchmarkMarshalWriteWorstCase     50000             43900 ns/op
    BenchmarkMarshalWrite1k  1000000              2471 ns/op
    ok      github.com/pkg/sftp     44.857s

I also tested a real-world scenario, uploading 500MiB of random data to
a (rather slow embedded) server in my living room:

sftp:

    $ sftp server
    Connected to server.
    sftp> put testdata
    testdata                      100% 500MB  41.7MB/s   00:12

before this commit, with simple client `put.go` and pv (pipe view),
backend is the system ssh client connecting to the sames server as
above, the file is written to the exact same location on the server:

    $ pv testdata | go run put.go
    500MiB 0:00:57 [8.68MiB/s] [=======================>] 100%

With the new code:

    $ pv testdata | go run put.go
    500MiB 0:00:14 [34.9MiB/s] [=======================>] 100%

Then I added 20ms of artificial latency to this server via tc:

    # tc qdisc add dev enp0s25 root netem delay 20ms

Afterwards the difference is even more drastic. First test with sftp
results in 41.7MiB/s. Next with `put.go`, old code is 1.35MiB/s, new
code reaches 30.9MiB/s.