Skip to content

Application for transferring files from a computer to a phone within a network

License

Notifications You must be signed in to change notification settings

DATA35DELETE/Ozan-File-Sharing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ozan File Sharing

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.

Features

  • Cross-Platform: Core networking logic is written in Rust, allowing it to be compiled as a .dll for Windows and a .so library for Android.
  • Decentralized (P2P): Uses libp2p for 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.

Project Structure

  • ozan_core (Rust): The core library containing the libp2p swarm, custom FileTransferCodec, 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.

How It Works

  1. Initialization: The application initializes a libp2p Swarm with a randomly generated Ed25519 keypair or loads an existing one.
  2. Discovery: The mDNS protocol listens on the local network (excluding loopback addresses) to discover peers.
  3. Transfer: When a file is sent, it is read from the disk, chunked, and encapsulated in a FileRequest message. The receiving peer writes the chunks to a temporary file, verifies the SHA-256 checksum, and renames the file upon success.

Building the Core Library

You can use the provided build_all.bat script to compile the Rust libraries for both Windows and Android:

./build_all.bat

This script requires:

  • Rust & cargo
  • cargo-ndk (for Android compilation)
  • Android NDK installed and the ANDROID_NDK_HOME environment variable set.

Running the C# Example (Windows)

cd "Ozan File Sharing"
dotnet build
dotnet run

Running the Android App

Open the OzanFileSharing folder in Android Studio and run the app on a connected device or emulator.

License

MIT License

About

Application for transferring files from a computer to a phone within a network

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors