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.
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.
- Stream video from magnet links
- Download media via BitTorrent
- Multi-peer support
- Event-driven networking
- Magnet search (planned)
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
┌──────────────────────────────┐
│ gui/ │ ← GTK4 + GStreamer
└──────────────┬───────────────┘
│ calls
┌──────────────▼───────────────┐
│ core/ │ ← Torrent brain
└──────────────┬───────────────┘
│ uses
┌──────────────▼───────────────┐
│ net/ │ ← Raw networking
└──────────────┬───────────────┘
│ uses
┌──────────────▼───────────────┐
│ utils/ │ ← Shared tools
└──────────────────────────────┘
Magnetio uses CMake.
git clone https://github.com/abneeeees/Magnetio
cd MagnetiocmakeModule for building C/C++ Code.
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./Magnetio
make clean # cleans the build, to run next time you have to build again