Syncthing BEP Protocol in Rust
Zero runtime dependencies · Wire-compatible with Go Syncthing · Single static binary (~13 MB)
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.
- Highlights
- Tech Stack
- Project Structure
- Documentation
- Known Limitations
- Quick Start
- Contributing
- Community & Support
- License
| 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 |
| 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 |
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
- Project topology and runtime architecture:
docs/design/topology.md - Agent development constraints and coding standards:
docs/agent/constraints.md
| 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 |
| 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 |
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 ~/.syncthingAn Ed25519 TLS certificate is generated automatically on first run. Default ports: BEP 22001, REST API 8385.
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| 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 |
MIT + Commercial · Commercial License