anacrolix/torrent is a Go BitTorrent implementation used as a library, with CLI tools, streaming I/O, and multiple storage backends.
Overview
BitTorrent protocol support ships as Go packages alongside command-line utilities. The library exposes torrents and files through idiomatic io interfaces, including seeking and readahead so applications can stream data directly from the swarm.
Feature coverage includes protocol encryption, DHT, PEX, uTP, WebTorrent, web seeds, BitTorrent v2, hole punching, and several storage backends such as file, mmap, bolt, sqlite, and possum. Downstream products have used the code in production since 2014 according to the authors.
Command packages under cmd support tasks such as downloading magnets from the shell and generating magnet links from metainfo files. Building from a full checkout may require initializing git submodules for optional storage modules referenced in go.work.
The emphasis is on embedding torrent functionality in other services—media systems, web frontends, Android clients, and custom storage layers—rather than shipping a single end-user desktop client as part of this tree.
Key features
- Go library with io-friendly torrent access
- DHT, PEX, and WebTorrent support
- BitTorrent v2 and encryption
- Multiple storage backends
- Streaming and seekable downloads
- Command-line download utilities
- SOCKS5 peer dialing option
- Production use since 2014
Use cases
- Building custom BitTorrent clients
- Streaming media from torrent swarms
- Integrating P2P downloads into services
- Experimenting with Go concurrency patterns