Skip to content

somewherelostt/Traverse

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Traverse

Fast P2P file sharing with global internet relay support

Traverse is a lightweight Rust CLI tool that enables instant file sharing between devices on local networks and across the internet. Built for developers who need reliable, fast file transfer without cloud dependency.

Key Features

  • Instant streaming - Files start transferring immediately (no upload wait)
  • Global reach - Share files across the internet via relay server
  • Room-based sharing - 6-digit room codes for secure access
  • Multi-interface - CLI, web browser, and QR code mobile access
  • Chunked transfers - 64KB chunks with SHA-256 integrity verification
  • Smart discovery - Auto-finds local network portals

Why Traverse?

The Problem:

  • Cloud uploads are slow and require internet for both parties
  • Email has file size limits and compresses content
  • USB drives are physical and inconvenient
  • Traditional tools require complex setup

The Solution:

  • Share files instantly without waiting for uploads
  • Works on local network AND across internet
  • One command to share, multiple ways to receive
  • Zero configuration required

Code Structure

alt text

  • 500 lines of optimized Rust code across 2 core components:
    • src/main.rs: 359 lines - Main P2P application (local discovery, file streaming, web interface)
    • render-server/src/main.rs: 141 lines - HTTP relay server (global internet access)
  • Both components essential: Main app handles P2P transfers, relay server enables internet sharing
  • Competition compliant: Exactly 500 executable lines (excluding comments/blanks)
  • Zero external dependencies for core functionality
  • Memory efficient - streams large files without loading to RAM
  • Thread-based concurrency for handling multiple connections

Project Architecture

  • Main Component: src/main.rs - Core P2P functionality (359 lines)
    • P2P file sharing and streaming
    • Local network discovery
    • Web interface for downloads
    • QR code generation for mobile access
    • Room-based sharing with codes
  • Relay Component: render-server/src/main.rs - Internet relay server (141 lines)
    • HTTP-based global file sharing
    • Room management and file registration
    • Web interface for internet downloads
    • Essential for cross-network file sharing

Technical Architecture

  • Pure Rust: Memory-safe, fast, single binary
  • Multi-protocol: TCP for P2P + HTTP for web + QR for mobile
  • Chunked streaming: 64KB chunks with SHA-256 integrity verification
  • Disk-based: Supports multi-GB files without memory limitations
  • Thread-based: Concurrent handling of multiple peers and protocols

Network Protocols

  • TCP: Direct peer-to-peer file streaming
  • HTTP: Web interface and relay server communication
  • Auto-discovery: Local network portal scanning
  • SHA-256: File integrity verification

Supported Platforms

  • Windows (tested)
  • Linux (compatible)
  • macOS (compatible)
  • Mobile browsers (web interface)

Performance Benchmarks

Local Network (1GB file)

  • Traditional methods: 2-5 minutes (upload + download)
  • Traverse P2P: 30-60 seconds (direct streaming)
  • Traverse Swarm (4 peers): 15-30 seconds (distributed)

Cross-Network (100MB file)

  • Email/Cloud: 3-10 minutes (upload + share + download)
  • Traverse Web: 1-2 minutes (direct HTTP transfer)

Scalability

  • 2 peers: Full bandwidth utilization
  • 3+ peers: Swarm mode activation → 2-3x faster distribution
  • 10+ peers: Near-linear scaling with peer count

./traverse send - 3+ peers: Swarm mode activation → 2-3x faster distribution

  • 10+ peers: Near-linear scaling with peer count

Commands Reference

# Show help and usage
./traverse

# Share a file (creates global portal)
./traverse send <filename>

# Discover and download from local network
./traverse recv

# Join internet room by code
./traverse join <room-code>

Command Line Options

# Basic sharing
traverse send file.zip

# Multiple files (creates archive)  
traverse send file1.txt file2.txt folder/

# Private sharing (future feature)
traverse send --private --password mypassword file.zip

# Custom port (if default conflicts)
traverse send --port 9000 file.zip

Troubleshooting

Common Issues

  • "File not found": Check file path and permissions
  • "No portals found": Ensure sender and receiver on same network for local discovery
  • "Room not found": Verify room code or try internet URL directly

Network Requirements

  • Local sharing: Same WiFi/Ethernet network
  • Internet sharing: Internet connection for relay server
  • Firewall: May need to allow ports 8765, 8766, 8767

Contributing

This project demonstrates efficient P2P file sharing. The project showcases:

  • Clean, readable code architecture
  • Multiple network protocols working together
  • Beautiful CLI user experience
  • Cross-platform compatibility
  • Production-ready error handling

License

MIT License - Free for personal and commercial use.


Built with Rust | 500 lines of code

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors