A peer-to-peer file sharing application built with Tauri (now using Tauri 2.x) and Rust.
- UDP Peer Discovery: Automatically discover other LanShare instances on the local network
- Real-time Text Sharing: Instant text synchronization between discovered peers
- Real-time Peer Management: Maintain an up-to-date list of available peers
- Automatic Cleanup: Remove stale peers that haven't been seen for 30 seconds
- Cross-platform: Works on Windows, macOS, and Linux
- Modern Icon Assets: Updated and expanded icon set for all major platforms
The application includes a comprehensive UDP peer discovery system that:
- Broadcasts presence every 5 seconds on UDP port 7878
- Includes peer ID, port, hostname, and timestamp
- Uses broadcast address to reach all devices on the network
- Listens for discovery messages on UDP port 7878
- Automatically adds new peers to the registry
- Ignores its own broadcast messages
- Thread-safe peer management with
Arc<RwLock<HashMap>>
- Automatic cleanup of stale peers (30-second timeout)
- Provides methods to add, remove, and list peers
The application exposes the following Tauri commands for the frontend:
get_peers()
: Returns a list of all discovered peersget_peer_count()
: Returns the number of discovered peersget_peer_id()
: Returns the current peer's IDsend_text_to_all_peers(text)
: Sends text to all discovered peerssend_text_to_peer(peer_id, text)
: Sends text to a specific peer
LanShare now supports real-time text sharing between peers:
- Instant Sync: Text typed in one instance appears in all other instances
- UDP-based: Uses the same UDP infrastructure as peer discovery
- Cross-platform: Works seamlessly between Windows, macOS, and Linux
- Event-driven: Real-time updates via Tauri's event system
Peer
: Represents a discovered peer with ID, IP, port, last_seen timestamp, and hostnamePeerRegistry
: Thread-safe registry for managing discovered peersUdpBroadcaster
: Handles broadcasting presence messagesUdpListener
: Listens for discovery messages from other peersDiscoveryService
: Coordinates broadcasting and listening tasks
- Comprehensive error handling for network operations
- Graceful degradation when network issues occur
- Detailed logging for debugging and monitoring
- Rust: 1.88.0 (tested with 1.88.0)
- Cargo: 1.88.0 (tested with 1.88.0)
- Tauri CLI: 2.6.2 (tested with 2.6.2)
- Node.js: 16+
- Tauri Dependencies:
tauri = "2"
(as specified in Cargo.toml)tauri-build = "2"
(as specified in Cargo.toml)
- macOS:
create-dmg
(for DMG creation) - Windows: Microsoft Visual Studio C++ Build Tools
- Linux:
sudo apt install libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
β οΈ Version Compatibility Note: This project is tested and confirmed working with:
- Rust 1.88.0
- Cargo 1.88.0
- Tauri CLI 2.6.2
- Tauri framework 2.x
Using older versions may cause build failures. If you encounter issues, upgrade to these specific versions.
# Install dependencies
cargo build
# Run in development mode
cargo tauri dev
# Build for production (creates app bundle only)
cargo tauri build
# Create DMG file (macOS only)
./create_dmg.sh
To create a DMG installer on macOS:
-
Install
create-dmg
:brew install create-dmg
-
Build the application:
cargo tauri build
-
Create the DMG:
./create_dmg.sh
The DMG file will be created at src-tauri/target/release/bundle/dmg/lanshare_0.1.0_aarch64.dmg
.
To create a Windows executable and installer:
-
Prerequisites (if not already installed):
# Install Microsoft Visual Studio C++ Build Tools # Download from: https://visualstudio.microsoft.com/visual-cpp-build-tools/
-
Build the application:
cargo tauri build
-
Output files will be created in
src-tauri/target/release/bundle/
:- Executable:
msi/lanshare_0.1.0_x64_en-US.msi
(Windows installer) - Portable:
wix/lanshare_0.1.0_x64_en-US.msi
(alternative installer) - Direct EXE:
app/lanshare.exe
(standalone executable)
- Executable:
-
Optional - Create portable executable:
# The standalone .exe file can be distributed directly # Located at: src-tauri/target/release/lanshare.exe
To create a Linux AppImage:
-
Build the application:
cargo tauri build
-
Output files will be created in
src-tauri/target/release/bundle/
:- AppImage:
appimage/lanshare_0.1.0_amd64.AppImage
- Debian package:
deb/lanshare_0.1.0_amd64.deb
- AppImage:
# Run all tests
cargo test
# Run tests with logging
RUST_LOG=debug cargo test
- Broadcast Interval: 5 seconds (configurable)
- Peer Timeout: 30 seconds (configurable)
- UDP Port: 7878 (for both discovery and text sharing)
- Cleanup Interval: 10 seconds (configurable)
Set the RUST_LOG
environment variable to control logging level:
RUST_LOG=debug cargo tauri dev
RUST_LOG=info cargo tauri dev
RUST_LOG=warn cargo tauri dev
- UDP port 7878 must be open for discovery and text sharing
- Network must support UDP broadcast
- Firewall should allow UDP traffic on port 7878
- Discovery and text messages are not encrypted (for local network use)
- Peer IDs are randomly generated UUIDs
- No authentication mechanism (trusts local network)
- Consider implementing encryption for production use
- The app now includes a comprehensive set of icons for Windows, macOS, Linux, Android, and iOS.
- Icons are located in
src-tauri/icons/
and are automatically bundled for all platforms.
- UDP Peer Discovery: Automatic discovery of peers on local network
- Real-time Text Sharing: Instant text synchronization between peers
- Cross-platform Support: Windows, macOS, and Linux
- Automatic Cleanup: Stale peer removal
- Debug Interface: Real-time peer information display
- Event-driven Architecture: Real-time updates via Tauri events
- File Transfer: Basic file sharing capabilities
- UI Improvements: Enhanced user interface
- Encrypted Communication: End-to-end encryption for text and files
- File Transfer: Complete file sharing implementation
- Clipboard Sync: Cross-device clipboard synchronization
- Mobile Companion: iOS/Android companion apps
- Peer Authentication: Certificate-based peer verification
- Custom Network Interfaces: Support for multiple network interfaces
- Persistent Storage: Save and restore application state
- Install Rust (1.88.0 or later): https://rustup.rs/
- Install Cargo (1.88.0 or later): comes with Rustup
- Install Tauri CLI (2.6.2 or later):
cargo install tauri-cli --version 2.6.2
- Install Tauri prerequisites:
- macOS: Xcode Command Line Tools
- Linux:
sudo apt install libwebkit2gtk-4.0-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev
- Windows: Microsoft Visual Studio C++ Build Tools
β οΈ Important: This project is tested with specific versions. If you encounter build issues:
- Use Rust 1.88.0:
rustup install 1.88.0 && rustup default 1.88.0
- Use Cargo 1.88.0: comes with Rustup
- Use Tauri CLI 2.6.2:
cargo install tauri-cli --version 2.6.2
- The project uses Tauri framework 2.x (specified in Cargo.toml)
-
Clone the repository:
git clone https://github.com/RushitSolanki/lanshare.git cd lanshare
-
Build and run in development mode:
cargo tauri dev
-
Build for production:
cargo tauri build
- Run LanShare on two different machines on the same network
- Wait for peer discovery (should see each other in the debug panel)
- Type text in the textarea on one machine
- The text should appear in the textarea on the other machine
LanShare/
βββ src-tauri/ # Tauri-specific configuration
β βββ src/
β β βββ main.rs # Tauri main entry point
β β βββ discovery.rs # UDP discovery and text sharing
β βββ Cargo.toml # Tauri dependencies
β βββ tauri.conf.json # Tauri configuration
β βββ capabilities/ # Tauri 2.x permissions
βββ dist/ # Frontend files
β βββ index.html # Main HTML file
β βββ main.js # Frontend JavaScript
β βββ style.css # Styling
βββ ARCHITECTURE.md # Detailed architecture documentation
βββ README.md # This file
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter any issues, please open an issue on GitHub.
- Built with Tauri
- Inspired by the need for simple LAN-based text sharing