From e4499d44e931d2ee7c70e7610bbfca3fefd00fea Mon Sep 17 00:00:00 2001 From: metamuffin Date: Fri, 14 Jun 2024 04:48:14 +0200 Subject: implement upload and download --- readme.md | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'readme.md') diff --git a/readme.md b/readme.md index b3c1929..7053403 100644 --- a/readme.md +++ b/readme.md @@ -31,3 +31,51 @@ Backups are stored as-is on the remote server: If your backup requires it, encrypt it! ## Usage + +1. Intall the CLI with cargo: + `cargo install --path /path/to/online-offsite-backup` + +2. Place a configuration file somewhere. + ```toml + [storage] + root = "/home/muffin/temp/backuptest" + size = 1_000_000_000 # maximum size of a single backup version + versions = 3 # number of backups to keep + upload_cooldown = 864000 # cooldown in seconds for backup uploads + download_cooldown = 43200 # cooldown in seconds for backup downloads + upload_speed = 3_000_000 # maximum sustained backup upload speed in bytes per second + download_speed = 3_000_000 # maximum sustained backup download speed in bytes per second + + [server] + address = "127.0.0.1:29285" + + [[peer]] + name = "alice" + address = "aliceserver.net:29285" + shared_secret = "hunter2" + + [[peer]] + name = "bob" + address = "bobserver.net:29285" + shared_secret = "p4ssw0rd" + ``` +3. Start uploading a backup: `backuptool config.toml upload /path/to/backup` +4. List currently stored backups: `backuptool config.toml list` +5. Restore a remote backup by serial: + `backuptool config.toml download 2 /path/to/restore` +6. See further usage `backuptool --help` + +## Protocol + +Connect to the server via TCP and follow this simple text-based protocol. +Whenever there is an error the server replies `error,` and then +disconnects you.First send a line with the shared secret, then send commands. + +- `list`: Client sends `list` on a line. The server replies with multiple lines + in the format `::` ended with a single empty line. +- `upload`: Client sends `upload,` on a line. If accepted the server + replies `ready`. The client should now send exactly as many bytes as + announced. Once done the server replies `done` on a line. +- `download`: Client sends `download,` on a line. If accepted the server + replies `ready,` on a line and then continues sending exactly this many + bytes before concluding with `done` on a line. -- cgit v1.2.3-70-g09d2