Scripts2026年7月24日·1 分钟阅读

libtorrent — High-Performance C++ BitTorrent Library

libtorrent is a feature-complete C++ implementation of the BitTorrent protocol. It powers popular clients like qBittorrent and Deluge, providing efficient peer-to-peer file transfer with extensive protocol support.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
libtorrent
直接安装命令
npx -y tokrepo@latest install 64c0432f-87a2-11f1-9bc6-00163e2b0d79 --target codex

先 dry-run 确认安装计划,再运行此命令。

Introduction

libtorrent (libtorrent-rasterbar) is a C++ library implementing the BitTorrent protocol with a focus on performance and standards compliance. It serves as the engine behind popular torrent clients and is used in both desktop and embedded applications.

What libtorrent Does

  • Implements the full BitTorrent protocol including DHT, PEX, and magnet links
  • Manages concurrent downloads with disk caching, piece prioritization, and rate limiting
  • Supports protocol extensions including uTP (micro transport protocol) for low-overhead transfers
  • Provides Python bindings for scripted torrent management and automation
  • Handles web seeding (HTTP/FTP sources) alongside peer-to-peer transfers

Architecture Overview

libtorrent uses an async I/O model built on Boost.Asio. A session object manages all torrents, coordinating peer connections, disk I/O, and bandwidth allocation. The disk subsystem uses memory-mapped files and an LRU cache to minimize system calls. Each torrent runs its own piece picker and choking algorithm.

Self-Hosting & Configuration

  • Link against libtorrent-rasterbar via CMake with find_package(LibtorrentRasterbar)
  • Create a session with settings_pack to configure ports, rate limits, and connection caps
  • Add torrents via .torrent files, magnet URIs, or in-memory resume data
  • Tune disk cache size and hashing threads for your storage hardware
  • Enable encryption, DHT, and local peer discovery in settings

Key Features

  • Powers qBittorrent, Deluge, and other widely used torrent clients
  • uTP transport reduces network congestion while maintaining throughput
  • Full DHT implementation with BEP-44 mutable items for decentralized data storage
  • Efficient memory-mapped disk I/O with configurable caching strategies
  • Supports seeding, super-seeding, and web seeding from HTTP sources

Comparison with Similar Tools

  • libtorrent (Rakshasa) — Rakshasa's libtorrent powers rTorrent; libtorrent-rasterbar offers broader protocol support and Python bindings
  • Transmission — Transmission is a full client; libtorrent is an embeddable library for building custom clients
  • aria2 — aria2 is a multi-protocol downloader; libtorrent specializes in BitTorrent with deeper protocol features
  • WebTorrent — WebTorrent runs in browsers via WebRTC; libtorrent targets native applications with system-level performance

FAQ

Q: What is the difference between libtorrent and libtorrent-rasterbar? A: libtorrent-rasterbar (by Arvid Norberg) is the widely used library powering qBittorrent and Deluge. A separate, older project by Rakshasa powers rTorrent.

Q: Does libtorrent support magnet links? A: Yes. libtorrent fully supports magnet links, downloading metadata from the DHT or peers before starting the transfer.

Q: Can libtorrent be used in commercial software? A: Yes. libtorrent uses a BSD license, allowing unrestricted commercial use.

Q: What platforms does libtorrent support? A: Linux, macOS, Windows, FreeBSD, and Android. Any platform with a C++17 compiler and Boost.

Sources

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产