A decentralized, high-performance file sharing application built with Rust (libp2p) and C# / Kotlin. This project supports direct peer-to-peer (P2P) file transfers between Windows PCs and Android devices over a local network.
- Cross-Platform: Core networking logic is written in Rust, allowing it to be compiled as a
.dllfor Windows and a.solibrary for Android. - Decentralized (P2P): Uses
libp2pfor mDNS local network peer discovery. No central server is required. - High Performance: Large files are split into chunks, hashed using SHA-256 for integrity, and transferred directly via custom request-response protocols.
- Robust Transfer: Handles large file transfers with extended timeouts and proper memory management to prevent out-of-memory errors on mobile devices.
ozan_core(Rust): The core library containing thelibp2pswarm, customFileTransferCodec, and file reading/writing logic.ozanFileSharingWindows(Rust): A Windows-specific FFI wrapper that exposes C-compatible functions for C# interoperability.ozanFileSharingAndroid(Rust): A JNI wrapper that exposes the core logic to the Android Kotlin application.Ozan File Sharing(C#): The Windows desktop application.OzanFileSharing(Android): The Android mobile application.
- Initialization: The application initializes a
libp2pSwarm with a randomly generatedEd25519keypair or loads an existing one. - Discovery: The
mDNSprotocol listens on the local network (excluding loopback addresses) to discover peers. - Transfer: When a file is sent, it is read from the disk, chunked, and encapsulated in a
FileRequestmessage. The receiving peer writes the chunks to a temporary file, verifies theSHA-256checksum, and renames the file upon success.
You can use the provided build_all.bat script to compile the Rust libraries for both Windows and Android:
./build_all.batThis script requires:
Rust&cargocargo-ndk(for Android compilation)- Android NDK installed and the
ANDROID_NDK_HOMEenvironment variable set.
cd "Ozan File Sharing"
dotnet build
dotnet runOpen the OzanFileSharing folder in Android Studio and run the app on a connected device or emulator.
MIT License