Skip to content

kamui-fin/dream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Dream

License

Dream is a peer-to-peer streaming platform powered by BitTorrent and a decentralized tracker with Kademlia DHT.

Why Dream?

The current video streaming ecosystem is dominated by centralized platforms. While convenient, these systems come with significant drawbacks:

  • Bottlenecks: Centralized servers can struggle under high demand.
  • Censorship: Content can be removed or restricted due to external pressures.
  • High Costs: Maintaining large-scale server infrastructure is expensive.

Dream addresses these challenges by decentralizing video streaming. By leveraging the efficiency of BitTorrent and the robustness of Kademlia DHT, Dream empowers users to share and stream content directly without intermediaries. The result? A more open, democratic, and scalable streaming solution.

Core Features

  • Decentralized Tracker: Uses Kademlia DHT for peer discovery, eliminating the need for central servers.
  • Efficient Streaming: Streams video directly from peers using the BitTorrent protocol for seamless playback.
  • On-Demand HTTP Streaming: Fully compatible with any video player that supports HTTP.
  • Private Networks: Enables private deployments for home or institutional use.
  • Simple CLI Interface: dream-cli provides an intuitive command-line tool for browsing, uploading, and streaming videos.

Getting Started

Here are a couple prerequisites to get setup before moving on:

Installation

Follow these steps to set up Dream:

  1. Clone the repository and build the project:
git clone https://github.com/kamui-fin/dream.git
cd dream
cargo build --release cp target/release/dream-dht /usr/local/bin
cp target/release/dream-torrent /usr/local/bin
cp target/release/dream-cli /usr/local/bin
  1. Configure settings:
mkdir ~/.config/dream
cp config.toml ~/.config/dream

Update the following variables in ~/.config/dream/config.toml:

  • bootstrap_ip: IP of the bootstrap server (use localhost if starting a new network).
  • output_dir: Directory where downloaded video files are stored.
  • private_dht: Enable this if you want to restrict the network to private use.
  1. Forward necessary ports on your router:
  • BitTorrent (default: 6881)
  • DHT (default: 8999)
  • ElasticSearch (default: 9200) if acting as a bootstrap node.
  1. Start the required services:
dream-dht &
dream-torrent

Quick Start

The architecture of dream is relatively simple. There are mainly three services that should be ran 24/7:

  1. Kademlia DHT (dream-dht) - This functions as the decentralized BitTorrent tracker, allowing the BT engine to fetch peers associated with a video to download and upload. It essentially manages the p2p network by itself.
  2. BitTorrent engine (dream-torrent) - Similar to transmission, just another BitTorrent client. Essentially ensures that only the necessary data is downloaded from peers.
  3. HTTP Stream server (part of dream-torrent) It gets video data from the BT engine on-demand, and supplies it to any video player supporting HTTP.

Command-Line Interface (dream-cli)

The CLI simplifies interaction with Dream's network. Examples:

  • Upload a video file:
dream-cli upload video.mp4 "title"
  • Upload an external torrent file:
dream-cli upload video.torrent "title"
  • Stream a video by searching its title:
dream-cli stream "query"

Bootstrap Node

A bootstrap node serves as the entry point to a Dream network by providing peers with initial connection information. In addition to this role, bootstrap nodes currently maintain an index of all available videos for search functionality (e.g., fuzzy search). Future updates aim to decentralize this indexing process for greater scalability.

Contributing

By no means did we include fully featured implementations of the protocols, so feel free to open a PR and contribute! We're also open to any bug reports or feature ideas.

There's a lot of potential and work to be done in the p2p space, so we're excited to discover more!

Roadmap

Here’s what’s next for Dream:

  1. Optimize speed through caching and dynamic load balancing
  2. Modularize codebase for easier integration into other projects
  3. Improve error handling for better debugging experiences
  4. Add support for UDP trackers
  5. Reduce required port forwarding to a single port
  6. Decentralize the video index for improved scalability

License

Distributed under the GPLv3 License. See LICENSE for more information.

About

A decentralized torrent-based streaming platform

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages