table of contents
| lcsync(1) | IPv6 multicast file sync tool | lcsync(1) |
NAME¶
lcsync - IPv6 multicast file sync tool
SYNOPSIS¶
Serve a a single file:
lcshare [OPTION...] FILENAME Serve all files below a directory:
lcshare [OPTION...] DIRECTORY Sync remote file(s) with local:
lcsync [OPTION...] REMOTEFILENAME LOCALFILENAME Sync two local files (Path required. Can be ./):
lcsync ./LOCALFILE1 ./LOCALFILE2
DESCRIPTION¶
lcsync is a pair of tools to sync files over IPv6 multicast or the local filesystem. It splits the file into blocks, hashes them, and compares them in order to efficiently transfer a minimal amount of data.
lcshare is the server-side component which indexes files and listens for MLD multicast group joins and sends the file and directory block data.
lcsync is the client-side component which joins multicast groups to receive files and directories.
lcshare (server) Options:
- --loopback
- enable multicast loopback (sending host will receive sent data)
lcsync (client) Options:
- -a, --archive
- set archive options [-g -o -p -r -t]
- -n, --dry-run
- don't copy any data
- -g, --group
- set group on destination
- -o, --owner
- set owner on destination
- -p, --perms
- set permissions on destination
- --remote
- source path is remote
- -t, --times
- set modification times on destination
General Options:
- -b, --batch
- Batch mode. No prompting. NB: if you do not specify a keyfile for encryption, encryption will be disabled.
- --bwlimit INTEGER
- Set send rate limit (bps). An SI prefix of T, G, M or K may be added (eg. --bwlimit 10M)
- --hex
- print file hashes in hex
- -i, --interface INTERFACE
- Set network interface to use (default: all)
- --keyfile keyfile
- Read symmetric key from keyfile, which must be the path to a file containing a 128 byte random key. This can be created with a command like:
dd if=/dev/random of=keyfile count=1 bs=128
- --loglevel INTEGER
- set loglevel
- -r, --recursive
- recurse into directories
- -q, --quiet
- shhh - we're hunting wabbits
- -v, --verbose
- increase verbosity
- -V, --version
- display version and exit
To sync remote files, each file is split into blocks and a merkle tree is built by hashing the blocks using BLAKE3. On the sending/server side, this tree is sent on Librecast Channel (IPv6 multicast group) that is formed from the hash of the filename. The receiver/client joins this channel, and receives the tree. If the client already has some data to compare, it builds a merkle tree of the destination file and uses this to quickly compare which blocks differ. It builds a bitmap with this information, and then joins the Channel(s) for the block(s) required which are sent by the server
Forward Error Correction (FEC) is enabled by default using RaptorQ (RFC 6330) from the Librecast LCRQ library.
Symmetric encryption is provided using the XSalsa20 stream cipher from libsodium with Poly1305 MAC authentication tags. A keyfile can be provided, or a key can be derived from a user-supplied password.
There is no unicast communication with the server. There are no requests sent, and the server can sit behind a firewall which is completely closed to inbound TCP and UDP traffic. Instead, the server listens on a raw socket for Multicast Listener Discovery (MLD2) reports. It compares any MLD multicast group JOINs against the index it built on startup and finds matches for file (tree) and blocks. In this way, the server only sends data when at least one client is subscribed. If more clients want to download the data, the server need take no further action. Thus, the load on the server does not change at all, regardless of whether there is one client or a billion.
ENVIRONMENT¶
- LCSYNC_PASSWORD
- the value of LCSYNC_PASSWORD will be used to derive the symmetric encryption key used for encryption and decryption.
BUGS¶
If you find one, email bugs@librecast.net
SEE ALSO¶
AUTHOR¶
lcsync was written by Brett Sheffield <bacs@librecast.net> and released under the terms of the GPL-2 or (at your option) GPL-3.
| 2025-03-08 | lcsync |