Skip to content
Decentralized file transfer app using NKN client
Go Makefile
Branch: master
Clone or download
yilunzhang Set gin mode to production
Signed-off-by: Yilun <zyl.skysniper@gmail.com>
Latest commit bcd17f4 Aug 25, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore Add http mode for GET/PUT/HEAD request, range get, cancel file Aug 23, 2019
Makefile Add http mode for GET/PUT/HEAD request, range get, cancel file Aug 23, 2019
README.md Add http mode for GET/PUT/HEAD request, range get, cancel file Aug 23, 2019
common.go Dispatch worker more evenly for small file Aug 25, 2019
go.mod
go.sum
main.go
message.go
message.pb.go Add pull mode: receiver pull chunks from sender Aug 24, 2019
message.proto Add pull mode: receiver pull chunks from sender Aug 24, 2019
messagepb_test.go Add pull mode: receiver pull chunks from sender Aug 24, 2019
receiver.go
sender.go Dispatch worker more evenly for small file Aug 25, 2019

README.md

NKN File Transfer

A decentralized file transfer application using NKN client.

This application uses simple control mechanism similar to TCP. If you want to use it in production, it's recommended to implement more advanced mechanism (such as erasure coding) to achieve higher performance and reliability.

Get Started

You need Go 1.12+ to build from source:

go get -u github.com/nknorg/nkn-file-transfer

Then you can use

go run github.com/nknorg/nkn-file-transfer -$MODE

to run it, where $MODE can be one of send, receive, get, host. send mode should be used with receive mode to send file to peer, while get mode should be used with host mode to fetch file to peer.

When starting as receive mode or host, you will see something like Start receiver in receive mode at xxx or Start sender in host mode at xxx, where xxx will be your NKN address, and you will need that address when sending or getting files from other peers.

You can enable multiple modes together. For example, you can enable receive mode together with host mode to create a file storage server that can accept both send request (equivalent to HTTP PUT) and get request (equivalent to HTTP GET), and you can use send mode with get mode to create a client that can upload to (send) and download from (get) the aforementioned server. Actually if you enable both send mode and get mode together, you can use

GET hostAddress/fileName

to download file, and

PUT receiveAddress/fileName localFilePath

to upload file.

There is also a HTTP mode that can be enabled by -http together with host and receive mode. By default it will start a HTTP server at http://127.0.0.1:8080 and can accept HTTP GET/PUT/HEAD request with route remoteAddr/fileName. It accepts HTTP GET request with Range header so browser can stream video while downloading.

By default a random NKN address (key pair) will be generated each time. You can use a specific address by passing -seed and -identifier argument, same as a NKN client. Use -help argument to see all supported arguments.

Contributing

Can I submit a bug, suggestion or feature request?

Yes. Please open an issue for that.

Can I contribute patches to NKN project?

Yes, we appreciate your help! To make contributions, please fork the repo, push your changes to the forked repo with signed-off commits, and open a pull request here.

Please follow our Golang Style Guide for coding style.

Please sign off your commit. This means adding a line "Signed-off-by: Name " at the end of each commit, indicating that you wrote the code and have the right to pass it on as an open source patch. This can be done automatically by adding -s when committing:

git commit -s

Community

You can’t perform that action at this time.