s0_wire 0.1.1

sync0 紧凑二进制线协议、TACK 双层确认帧与 Ed25519 自签名节点名片编解码库
docs.rs failed to build s0_wire-0.1.1
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.

sync0

sync0 is a peer-to-peer (P2P) file sharing and multi-machine synchronization tool that competes with Resilio Sync.

Each machine is both a server and a client: any node can publish multiple file sharing groups. After other nodes join, it will automatically discover available seed nodes and pull them from multiple sources concurrently. After synchronization is completed, it will automatically seed seeds for more nodes to accelerate downloading.

Core Highlights

  • Decentralized peer-to-peer synchronization: No central server dependency, any node can create or join multiple sharing groups, automatically exchange seeds between nodes and synchronize multiple sources concurrently.
  • IP-free node address: By default, the node key and base64url encoded iroh address are automatically generated in ~/.config/sync0 without needing to remember or expose the public IP.
  • Multi-select synchronization on demand: Supports synchronization of the entire sharing group, and you can also select any number of single files and subdirectories for synchronization on demand.
  • Grade permissions and upload directory control: Supports read-only (ro), read-write (rw), and management (admin) permissions, and can limit the subdirectory prefixes allowed for uploading by member.
  • Cross-network full speed and in-situ increment: Native UDP congestion control + compio asynchronous I/O, supports multi-source striping concurrency of large files, massive small file memory aggregation and FastCDC block-level incremental synchronization.

Speed ​​comparison with rsync

Actual measurement of transcontinental WAN (United States c1 → Europe n1, s1 collaborative seeding, RTT 65 ms):

A la carte mode vs rsync

Data set Size sync0 Single Point(Mbps) rsync(Mbps) A la carte / rsync
linux-7.3.3.tar.xz(not compressible) 155 MB 218.88 107.05 2.04×
linux-7.3.3.tar(compressible) 1.6 GB 580.26 254.71 2.28×
linux-7.3.3.tar(local change increment) 1.6 GB 5,661.76 1,404.10 4.03×
linux-7.3.3/ (95,979 small files) 1.5 GB 486.19 292.23 1.66×

P2P dual source mode vs rsync

Data set Size sync0 P2P Dual Source(Mbps) rsync(Mbps) P2P / rsync
linux-7.3.3.tar.xz(not compressible) 155 MB 374.36 107.05 3.50×
linux-7.3.3.tar(compressible) 1.6 GB 1,648.27 254.71 6.47×
linux-7.3.3.tar(local change increment) 1.6 GB 5,367.18 1,404.10 3.82×
linux-7.3.3/ (95,979 small files) 1.5 GB 774.98 292.23 2.65×

For more link data and reproduction scripts, see Performance Measurement Report.

Install

Method 1: Install via Cargo

cargo install sync0

Method 2: Download precompiled binaries

Go to GitHub Releases to download the .tar.xz compressed package corresponding to the system (supports Linux, macOS, Windows, Android, FreeBSD, NetBSD), unzip and put into PATH:

tar -xJf sync0-*.tar.xz
sudo mv sync0 /usr/local/bin/

Get started quickly

The default configuration directory is ~/.config/sync0 (can be switched via -c <directory>).

1. View node address and set business card

# View the local node address (automatically generate a key for the first run)
sync0 id

# Generate a personal self-signed business card (supports nickname, city code, email, website and introduction)
sync0 profile -u alice --region SHA --email alice@example.com --url https://example.com -b "Shanghai node"

2. Publish multiple sharing groups and set member permissions (.nt Configuration)

sync0 Configure using the NestedText (.nt) format. Create a separate .nt file for each member in the users_dir directory; when write_prefix is omitted, rw members are allowed to upload to the root directory of the sharing group by default.

  1. Member configuration example (~/.config/sync0/users/):

~/.config/sync0/users/alice.nt (read-only member, rate limited 80MB):

id: 8J9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789ab_c
perm: ro
rate: 80MB

~/.config/sync0/users/bob.nt (Restricted upload members: only allowed to upload to specified subdirectories):

id: 7K8bCdEfGhIjKlMnOpQrStUvWxYz0123456789de_f
perm: rw
write_prefix:
  - uploads/bob
  - shared/common

~/.config/sync0/users/charlie.nt(root directory upload member):

id: 9M0cDeFgHiJkLmNoPqRsTuVwXyZ0123456789gh_i
perm: rw
  1. Sharing group configuration example (~/.config/sync0/config.nt):
users_dir: ./users

groups:
  dataset:
    path: ./data
    auth: false
    perm: ro
    rate: 50MB

  models:
    path: ./models
    auth: false
    perm: ro
    rate: 1GB

  team-vault:
    path: ./vault
    auth: true
    perm: ro
    rate: 512KB
    users:
      - alice
      - bob
      - charlie

Start sharing service:

# Load ~/.config/sync0/config.nt to start
sync0 share --region SHA

# Or publish multiple sharing groups and authorize members directly through the command line
sync0 share dataset:./data team-vault:./vault \
  --auth \
  --allow-ro 8J9aBcDeFgHiJkLmNoPqRsTuVwXyZ0123456789ab_c \
  --allow-rw 7K8bCdEfGhIjKlMnOpQrStUvWxYz0123456789de_f:uploads/bob,shared/common \
  --allow-rw 9M0cDeFgHiJkLmNoPqRsTuVwXyZ0123456789gh_i

3. Pull full content or multiple selections of files and directories (sync0 pull)

# Pull the entire dataset sharing group to the local ./local_data
sync0 pull dataset:// ./local_data -p <node address>

# Multi-select synchronization: pull single files and multiple subdirectories at the same time
sync0 pull dataset://docs/readme.md,assets/icons,src/core ./local_data -p <node address>

4. Upload a file or directory (sync0 push)

# Upload to the root directory of the sharing group
sync0 push team-vault:// ./new_release -p <node address>

# Upload to authorized subdirectory prefix
sync0 push team-vault://uploads/bob/report.pdf ./report.pdf -p <node address>

5. Subscribe to automatic sync and seeding (sync0 sub)

While maintaining real-time synchronization, the subscribing node automatically serves as a seed source to provide concurrent downloads for other nodes:

# Subscribe to the entire sharing group and automatically seed
sync0 sub dataset:// ./local_mirror -p <node address>

# Multi-select to subscribe to specified files and subdirectories and seed them
sync0 sub dataset://models/llama.onnx,configs ./local_mirror -p <node address>

6. Multi-machine group two-way synchronization (sync0 group)

# Fully join the group and two-way synchronization
sync0 group team-docs:// ./docs -p <node address>

# Multi-select specified directories and files in the synchronization group
sync0 group team-docs://wal,meta.json ./docs -p <node address>

7. Point-to-point direct transmission between two machines (send / recv)

There is no need to pre-configure a sharing group to temporarily transfer files or directories between two machines:

# Receiver monitoring
sync0 recv 0.0.0.0:9000 ./backup

# Direct transmission from the sender (optional --delete mirror to clean up excess files, --rate speed limit)
sync0 send ./project 192.168.1.10:9000

8. Multi-language switching

Supports 75 languages, automatically switches according to the system language by default, or can be specified through SYNC0_LANG:

SYNC0_LANG=en sync0 --help
SYNC0_LANG=ja sync0 --help
SYNC0_LANG=de sync0 --help