Skip to content

juice094/syncthing-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

358 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🔄 syncthing-rust

Syncthing BEP Protocol in Rust

English · 中文

Zero runtime dependencies · Wire-compatible with Go Syncthing · Single static binary (~13 MB)

Rust CI Tests Version License


📋 Introduction

A Rust implementation of the Syncthing BEP protocol — zero runtime dependencies, single static binary, wire-compatible with the official Go daemon.

Current phase: Production. Core protocol, end-to-end sync, Windows system tray, and TUI are stable.

Latest release: v3.0.4


📚 Table of Contents


🌟 Highlights

Feature Description
🔐 Full BEP Protocol prost codec, TLS + Hello + ClusterConfig + Index, LZ4 compression
📁 End-to-End File Sync Block-level pull/push, SHA-256 scanning, bidirectional sync detects changes in ~1 s
🚀 Proactive Push Local changes pushed immediately to connected peers
🗂️ Versioning Simple (keep=N) + Staggered (4 time windows), .stversions/ archive
🌐 Multi-Path Discovery LAN UDP · Global HTTPS mTLS · STUN · UPnP · Relay v1
🖥️ Real-Time TUI Event-driven live sync status with hot-reload config
🔌 Go Interop Wire-compatible with Go Syncthing v2.1.0 (cross-version verified)
⚙️ Folder Orchestrator Unified multi-folder scan/pull scheduling with concurrency limits, jitter, and priority
🔮 Predictive Health Checks Real-time failure-rate / watcher-loss / state-flip assessment with automatic throttling
📈 Adaptive Pull Concurrency Dynamic downloads/blocks concurrency based on block-request RTT
🧩 Incremental Scanning Watcher dirty-path set triggers subtree/single-file incremental scans
📦 Single Static Binary Release build ~13 MB, zero runtime dependencies
🔄 BEP Relay Server v1 Standalone relay listener with TLS and device-id routing
🔑 RBAC API Keys Separate admin + read-only API keys for REST API
📜 Structured JSON Logging --log-format json for ELK/Splunk/Loki aggregation
📊 Prometheus Metrics /metrics endpoint with build/uptime/connection/folder stats
🐳 Docker & Compose Multi-stage Dockerfile + relay compose stack + Grafana dashboard

🔧 Tech Stack

Component Technology
Protocol BEP over TLS (prost + LZ4)
Async Runtime Tokio
TLS rustls + ed25519-dalek
Networking Tokio + rustls + ParallelDialer + Relay v1
Discovery UDP broadcast + HTTPS mTLS + STUN + UPnP
Storage sled (metadata + block-cache abstraction)
REST API Axum (Go-layout compatible) + RBAC API keys
Metrics Prometheus text format (/metrics)
Logging tracing + tracing-subscriber (text / JSON)
TUI ratatui + crossterm
CLI clap

📁 Project Structure

syncthing-rust/
├── cmd/syncthing/          # CLI entrypoint + TUI + daemon runner + tray
├── crates/
│   ├── syncthing-core/     # Core types (DeviceId, FileInfo, VersionVector)
│   ├── bep-protocol/       # BEP codec (prost) + handshake
│   ├── syncthing-net/      # TCP+TLS, ConnectionManager, dial, discovery, Relay
│   ├── syncthing-sync/     # Scanner, Puller, IndexHandler, watcher
│   ├── syncthing-fs/       # Filesystem abstraction (ignore, scanner, watcher)
│   ├── syncthing-api/      # REST API (Axum, Go-layout compatible)
│   ├── syncthing-db/       # Metadata and block cache
│   └── syncthing-versioner/# File versioning (Simple + Staggered)
├── deploy/                 # Docker, compose, nginx, Grafana dashboard
├── docs/                   # Design docs, plans, reports
└── scripts/                # Health checks, cloud-deploy, stress tests

Full Architecture


📖 Documentation

Document Content
docs/design/topology.md Project topology, crate dependency graph, runtime components, key entry points
docs/agent/index.md Agent guidance overview (constraints, testing, security, operations)
docs/agent/constraints.md Crate boundary red lines, forbidden items, coding standards
docs/KNOWN_ISSUES.md Authoritative defect register and fact-checking source
docs/plans/INDEX.md Roadmap and plan index

⚠️ Known Limitations

Limitation Impact Mitigation
High-latency / unstable networks Bulk large-file transfers may drop behind firewalls Auto-reconnect + keepalive; network tuning in KNOWN_ISSUES §14
No symlink sync Symlinks are silently skipped Planned for a future release
No Web GUI TUI + system tray + REST API are the primary interfaces (frozen per docs/agent/constraints.md)
No QUIC transport TCP + Relay v1 only (frozen per docs/agent/constraints.md) Under future evaluation

🚀 Quick Start

git clone https://github.com/juice094/syncthing-rust.git && cd syncthing-rust
cargo build --release

# Initialize configuration
cargo run --release -- init

# Start the daemon
cargo run --release -- run --config-dir ~/.syncthing

# Or start the TUI
cargo run --release -- tui --config-dir ~/.syncthing

An Ed25519 TLS certificate is generated automatically on first run. Default ports: BEP 22001, REST API 8385.


🤝 Contributing

See CONTRIBUTING.md and docs/agent/constraints.md.

Before submitting, run:

cargo test --workspace        # 392 passed / 6 ignored / 0 failed
cargo clippy --workspace --all-targets -- -D warnings -W clippy::await_holding_lock
cargo fmt --all -- --check

💬 Community & Support

Scenario Entry
Bug report GitHub Issues
Feature request GitHub Issues
Usage question / discussion GitHub Discussions
Security vulnerability See SECURITY.md (do not open a public issue)
Commercial support See SUPPORT.md / LICENSE-COMMERCIAL.md

📄 License

MIT + Commercial · Commercial License


About

A Rust implementation of the Syncthing BEP protocol — wire-compatible with official Go Syncthing. Block-level P2P file sync over TLS, LAN/Global discovery (UDP/HTTPS/STUN/UPnP/Relay v1), REST API, real-time TUI and Windows system tray. Production-ready single static binary. v3.0.3.

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE-COMMERCIAL.md

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors