11 releases

0.3.2 May 23, 2023
0.3.1 Dec 1, 2022
0.3.0 Sep 14, 2022
0.2.5 Apr 4, 2022
0.1.2 Oct 14, 2020

#1565 in Magic Beans

Download history 39/week @ 2023-10-27 32/week @ 2023-11-03 38/week @ 2023-11-10 26/week @ 2023-11-17 51/week @ 2023-11-24 48/week @ 2023-12-01 22/week @ 2023-12-08 75/week @ 2023-12-15 43/week @ 2023-12-22 11/week @ 2023-12-29 25/week @ 2024-01-05 28/week @ 2024-01-12 36/week @ 2024-01-19 41/week @ 2024-01-26 31/week @ 2024-02-02 46/week @ 2024-02-09

158 downloads per month
Used in 2 crates (via yarapi)

LGPL-3.0 and GPL-3.0 licenses

115KB
3K SLoC

Using gftp transfer binary

Publishing files

Start yagna service:

cargo run service run

Publish a chosen file (blocking).

cargo run -p gftp -- publish {file name}

Example output:

{"result": [{"file": "Cargo.toml", "url": "gftp://0xf2f32374dde7326be2461b4e16a34adb0afe018f/39dc05a25ea97a1c90166658d93786f3302a51b8e31eb9b26001b615dea7e773"}]}

or with --verbose (-v)

cargo run -p gftp -- publish {file name} -v
{"jsonrpc": "2.0", "id": null, "result": [{"file": "Cargo.toml", "url": "gftp://0xf2f32374dde7326be2461b4e16a34adb0afe018f/39dc05a25ea97a1c90166658d93786f3302a51b8e31eb9b26001b615dea7e773"}]}

Downloading a file

cargo run -p gftp -- download \
    gftp://0x06bf342e4d1633aac5db38817c2e938e9d6ab7f3/edb0016d9f8bafb54540da34f05a8d510de8114488f23916276bdead05509a53 \
    -o workdir/gftp/download.txt

Uploading a file

Publish file for upload (blocking):

cargo run -p gftp -- receive workdir/gftp-upload/License

Upload file on provider side:

cargo run -p gftp -- upload LICENSE gftp://0x06bf342e4d1633aac5db38817c2e938e9d6ab7f3/z2IeDvgs1Q1hZ6seR0iSEsKW8kxdxQCK0eoz6DsYVznqJIl5K18NqwJPdLgesY9yR

JSON-RPC 2.0 server

To start the application in JSON RPC server mode, type:

cargo run -p gftp -- server

JSON RPC messages can be sent to application's stdin. Each JSON object needs to be terminated with a new line (\n).

Publish

{"jsonrpc": "2.0", "id": "1", "method": "publish", "params": {"files": ["Cargo.toml"]}}

Download

{"jsonrpc": "2.0", "id": 2, "method": "download", "params": {"url": "gftp://0xf2f32374dde7326be2461b4e16a34adb0afe018f/1d040d4ea83249ec6b8264305365acf3068e095245ea3981de1c4b16782253cc", "output_file": "/home/me/download.bin"}}

AwaitUpload

{"jsonrpc": "2.0", "id": "3", "method": "receive", "params": {"output_file": "/home/me/upload.bin"}}

Upload

{"jsonrpc": "2.0", "id": 4, "method": "upload", "params": {"url": "gftp://0xf2f32374dde7326be2461b4e16a34adb0afe018f/1d040d4ea83249ec6b8264305365acf3068e095245ea3981de1c4b16782253cc", "file": "/etc/passwd"}}

Flags

  • -v, --verbose

    Increases output verbosity to match the one in JSON RPC server mode.

Dependencies

~14–27MB
~395K SLoC