-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
75e5405
commit 88fd179
Showing
5 changed files
with
509 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package generator | ||
|
||
import ( | ||
"io" | ||
"math/rand" | ||
"os" | ||
"time" | ||
) | ||
|
||
func GenerateFile(filename string, size int64) (err error) { | ||
reader := rand.New(rand.NewSource(time.Now().UnixNano())) | ||
var file *os.File | ||
file, err = os.OpenFile(filename, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) | ||
if err != nil { | ||
return err | ||
} | ||
defer func(file *os.File) { | ||
err = file.Close() | ||
}(file) | ||
|
||
_, err = io.CopyN(file, reader, size) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
return file.Close() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
module file-transfer-test | ||
|
||
go 1.21 | ||
|
||
require github.com/smallnest/rpcx v1.8.11 | ||
|
||
require ( | ||
github.com/akutz/memconn v0.1.0 // indirect | ||
github.com/alitto/pond v1.8.3 // indirect | ||
github.com/apache/thrift v0.18.1 // indirect | ||
github.com/cenk/backoff v2.2.1+incompatible // indirect | ||
github.com/cenkalti/backoff v2.2.1+incompatible // indirect | ||
github.com/dgryski/go-jump v0.0.0-20211018200510-ba001c3ffce0 // indirect | ||
github.com/edwingeng/doublejump v1.0.1 // indirect | ||
github.com/facebookgo/clock v0.0.0-20150410010913-600d898af40a // indirect | ||
github.com/fatih/color v1.14.1 // indirect | ||
github.com/go-ping/ping v1.1.0 // indirect | ||
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 // indirect | ||
github.com/godzie44/go-uring v0.0.0-20220926161041-69611e8b13d5 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/mock v1.6.0 // indirect | ||
github.com/golang/snappy v0.0.4 // indirect | ||
github.com/google/pprof v0.0.0-20230228050547-1710fef4ab10 // indirect | ||
github.com/google/uuid v1.3.0 // indirect | ||
github.com/grandcat/zeroconf v1.0.0 // indirect | ||
github.com/hashicorp/errwrap v1.1.0 // indirect | ||
github.com/hashicorp/go-multierror v1.1.1 // indirect | ||
github.com/hashicorp/golang-lru v0.5.4 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/juju/ratelimit v1.0.2 // indirect | ||
github.com/julienschmidt/httprouter v1.3.0 // indirect | ||
github.com/kavu/go_reuseport v1.5.0 // indirect | ||
github.com/klauspost/cpuid/v2 v2.2.4 // indirect | ||
github.com/klauspost/reedsolomon v1.11.7 // indirect | ||
github.com/libp2p/go-sockaddr v0.1.1 // indirect | ||
github.com/mattn/go-colorable v0.1.13 // indirect | ||
github.com/mattn/go-isatty v0.0.17 // indirect | ||
github.com/miekg/dns v1.1.51 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/onsi/ginkgo/v2 v2.9.0 // indirect | ||
github.com/philhofer/fwd v1.1.2 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/quic-go/qtls-go1-19 v0.3.2 // indirect | ||
github.com/quic-go/qtls-go1-20 v0.2.2 // indirect | ||
github.com/quic-go/quic-go v0.34.0 // indirect | ||
github.com/rs/cors v1.8.3 // indirect | ||
github.com/rubyist/circuitbreaker v2.2.1+incompatible // indirect | ||
github.com/smallnest/quick v0.1.0 // indirect | ||
github.com/soheilhy/cmux v0.1.5 // indirect | ||
github.com/templexxx/cpufeat v0.0.0-20180724012125-cef66df7f161 // indirect | ||
github.com/templexxx/xor v0.0.0-20191217153810-f85b25db303b // indirect | ||
github.com/tinylib/msgp v1.1.8 // indirect | ||
github.com/tjfoc/gmsm v1.4.1 // indirect | ||
github.com/valyala/fastrand v1.1.0 // indirect | ||
github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect | ||
github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect | ||
github.com/xtaci/kcp-go v5.4.20+incompatible // indirect | ||
golang.org/x/crypto v0.7.0 // indirect | ||
golang.org/x/exp v0.0.0-20230307190834-24139beb5833 // indirect | ||
golang.org/x/mod v0.9.0 // indirect | ||
golang.org/x/net v0.8.0 // indirect | ||
golang.org/x/sync v0.1.0 // indirect | ||
golang.org/x/sys v0.6.0 // indirect | ||
golang.org/x/text v0.8.0 // indirect | ||
golang.org/x/tools v0.7.0 // indirect | ||
google.golang.org/protobuf v1.29.1 // indirect | ||
) |
Oops, something went wrong.