A decentralized file storage system built with Rust, leveraging a Kademlia-based DHT for peer-to-peer file sharing.
- Decentralized File Storage: Store and retrieve files from a distributed network of nodes.
- Peer-to-Peer Networking: Nodes communicate directly with each other to share files.
- Content-Addressable Storage: Files are identified by the hash of their content, ensuring data integrity.
- Command-Line Interface: Easy-to-use CLI for interacting with the network.
The project is designed as a distributed file storage network. It consists of the following key components:
- Nodes: Each node in the network is a peer that can store and retrieve file chunks.
- Distributed Hash Table (DHT): A Kademlia-based DHT is used to locate file chunks across the network.
- gRPC API: Nodes communicate with each other using a gRPC API for actions like storing, retrieving, and replicating data.
- Command-Line Interface (CLI): A
clap-based CLI allows users to manage the node and interact with the network.
Data is serialized using Protocol Buffers for efficient storage and network transmission.
Logging: Tracing
- Rust (latest stable version)
- Protocol Buffers Compiler
-
Clone the repository:
git clone <repository-url> cd ufs
-
Build the project:
cargo build --release
-
Run the node:
./target/release/ufs
The program has two main modes: server and cli.
Run a node on a given port:
./target/release/ufs server --port 42069Join an existing network by providing a bootstrap peer:
./target/release/ufs server --port 42070 --bootstrap-peer http://127.0.0.1:42069Interact with a running node:
./target/release/ufs cli --node-addr http://127.0.0.1:42069 <COMMAND>Upload a file:
./target/release/ufs cli --node-addr http://127.0.0.1:42069 upload --path ./myfile.txtDownload a file by hash:
./target/release/ufs cli --node-addr http://127.0.0.1:42069 download --hash <file_hash> --output ./downloaded.txtList stored files:
./target/release/ufs cli listfilesList connected peers:
./target/release/ufs cli listpeersShow stored chunks:
./target/release/ufs cli showchunksContributions are welcome! Please feel free to submit a pull request or open an issue.
This project is licensed under the MIT License. See the LICENSE file for details.