Skip to content

abneeeees/Magnetio

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Magnetio

Magnetio is a minimal BitTorrent-based streaming and downloading client written in C.
It focuses on clean architecture, low-level socket programming, and protocol-level implementation of the BitTorrent ecosystem.

Inspired by Stremio, but built from scratch for systems-level learning and control.


Overview

Magnetio is designed in layers:

  • utils/ → Parsing, hashing, logging
  • net/ → Raw sockets, HTTP, event loop
  • core/ → Torrent engine (trackers, peers, pieces)
  • gui/ → GTK4 interface and playback

The torrent engine is independent from the GUI.


Features

  • Stream video from magnet links
  • Download media via BitTorrent
  • Multi-peer support
  • Event-driven networking
  • Magnet search (planned)

Project Structure

magnetio/
├── README.md
├── LICENSE
├── .gitignore
├── CMakeLists.txt
│
├── docs/
│   ├── architecture.md
│   ├── bittorrent-notes.md
│   └── protocol-diagrams/
│
├── include/
│   ├── core/
│   │   ├── torrent.h
│   │   ├── peer.h
│   │   ├── piece.h
│   │   └── tracker.h
│   │
│   ├── net/
│   │   ├── socket.h
│   │   ├── event_loop.h
│   │   └── http.h
│   │
│   ├── utils/
│   │   ├── bencode.h
│   │   ├── sha1.h
│   │   └── logger.h
│   │
│   └── gui/
│       ├── app.h
│       ├── main_window.h
│       └── player.h
│
├── src/
│   ├── main.c
│   │
│   ├── core/
│   │   ├── torrent.c
│   │   ├── peer.c
│   │   ├── piece.c
│   │   └── tracker.c
│   │
│   ├── net/
│   │   ├── socket.c
│   │   ├── event_loop.c
│   │   └── http.c
│   │
│   ├── utils/
│   │   ├── bencode.c
│   │   ├── sha1.c
│   │   └── logger.c
│   │
│   └── gui/
│       ├── app.c
│       ├── main_window.c
│       └── player.c
│
└── tests/
    ├── test_bencode.c
    ├── test_tracker.c
    └── test_peer.c

Project Architecture

┌──────────────────────────────┐
│           gui/               │  ← GTK4 + GStreamer
└──────────────┬───────────────┘
               │ calls
┌──────────────▼───────────────┐
│            core/             │  ← Torrent brain
└──────────────┬───────────────┘
               │ uses
┌──────────────▼───────────────┐
│             net/             │  ← Raw networking
└──────────────┬───────────────┘
               │ uses
┌──────────────▼───────────────┐
│            utils/            │  ← Shared tools
└──────────────────────────────┘

Building

Magnetio uses CMake.

Clone

git clone https://github.com/abneeeees/Magnetio
cd Magnetio

Building & Running

  • cmake Module for building C/C++ Code.

Cloning & Building

git clone https://github.com/abneeeees/Magnetio
cd Magnetio
mkdir build && cd build
cmake ..
make #use "make clean" to clean build files in case outdated

Running & Cleaning

./Magnetio
make clean # cleans the build, to run next time you have to build again

About

Magnetio is a minimal BitTorrent-based streaming and downloading client written in C.

Topics

Resources

License

Stars

Watchers

Forks

Contributors