Peer-to-Peer Sharing
DITS includes Wormhole-style P2P capabilities for sharing files directly between peers without uploading to a central server.
What is P2P Sharing?
Unlike traditional file sharing where you upload to a server and others download from it, P2P creates a direct connection between two computers. Your files never touch a third-party server - they go straight from your machine to your collaborator's.
How It Works
The Basic Flow
- Share: You run
dits p2p share ./folderand get a join code (e.g., ABC-123) - Discover: Your peer runs
dits p2p connect ABC-123 - Connect: DITS finds your address via discovery methods and establishes a direct QUIC connection
- Transfer: Files flow directly between your machines, encrypted end-to-end
Discovery Methods
DITS uses multiple discovery methods to find peers. They're tried in priority order - the first one that works is used.
Zero Port Forwarding with Relay Mode
--relay), you never need to configure port forwarding on your router. Traffic flows through the relay server, bypassing NAT completely. Your files are still encrypted end-to-end - the relay only forwards encrypted bytes.Signal Server vs. File Server
Local vs. Internet Sharing
Local Network (--local)
For peers on the same WiFi or LAN, use --local mode:
# Computer A
$ dits p2p share ./project --local
Connect with: dits p2p connect ABC-123 --local
# Computer B
$ dits p2p connect ABC-123 --localBenefits:
- No internet required
- Maximum privacy (no external servers)
- Fastest discovery (local broadcast)
- Zero configuration
Internet Sharing (default)
For peers on different networks, the default auto mode uses the signal server for NAT traversal:
# Computer A
$ dits p2p share ./project
Connect with: dits p2p connect XYZ-789
# Computer B (anywhere in the world)
$ dits p2p connect XYZ-789Security Model
Encryption
- QUIC + TLS 1.3: All connections are encrypted
- Certificate Pinning: Server cert verified via fingerprint
- BLAKE3 Checksums: Fast integrity verification
Join Codes
Join codes are 6-character codes (e.g., ABC-123) that:
- Use an unambiguous character set (no 0/O, 1/I/L confusion)
- Are valid only while the share is active
- Can be customized with
--code
Trust Model
- Signal server is semi-trusted (sees addresses, not data)
- Peer connection is end-to-end encrypted
- Use
--localfor maximum privacy
When to Use P2P
- Quick file transfers between collaborators
- Sharing large files without upload wait
- Privacy-sensitive transfers
- Same-office collaboration
- One-time transfers
- Persistent team collaboration (use remotes)
- Sharing with many people (use server)
- Asynchronous workflows (use push/pull)
- Version history needed (use repository)
Architecture Diagram
Discovery Chain
Direct IP
If target is IP:port, use directly
mDNS
Broadcast on local network
STUN
Query for external IP
Signal
WebSocket rendezvous
QUIC Connection
TLS 1.3 Encrypted
End-to-end encryption
UDP-based
NAT-friendly transport
Multiplexed
Multiple streams
Related Topics
- P2P Commands Reference - Full command documentation
- Remote Commands - Server-based sharing
- Configuration - P2P settings