Documentation
¶
Overview ¶
Package gotorrent is a BitTorrent protocol library and CLI for Go 1.24+.
It provides focused, composable packages implementing the core BitTorrent specification (BEP 3) and related extensions.
Packages ¶
bencode: Encoder and decoder for the bencoding format used in .torrent files and tracker responses -- supports int64, string, []byte, []any, and map[string]any.
bitfield: Compact byte-slice bitfield for tracking which pieces a peer has downloaded, with O(1) Has/Set and an O(n) popcount.
metainfo: Parser for .torrent files -- extracts the Info struct, computes the 20-byte SHA-1 InfoHash, and provides the flat tracker URL list.
tracker: HTTP tracker client -- constructs announce requests and parses compact and dictionary peer responses.
peer: BitTorrent peer wire protocol -- handshake (BEP 3), length-prefixed message framing, and helpers for the Request and Piece message types.
piece: Per-piece download state machine -- block-level request tracking, data accumulation, and SHA-1 hash verification.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package bencode implements bencoding -- the binary serialisation format used by the BitTorrent protocol for .torrent files and tracker responses.
|
Package bencode implements bencoding -- the binary serialisation format used by the BitTorrent protocol for .torrent files and tracker responses. |
|
Package bitfield provides a compact byte-slice bitfield for tracking which pieces a peer has downloaded in a BitTorrent swarm.
|
Package bitfield provides a compact byte-slice bitfield for tracking which pieces a peer has downloaded in a BitTorrent swarm. |
|
cmd
|
|
|
gotorrent
command
Command gotorrent is a command-line tool for working with BitTorrent files.
|
Command gotorrent is a command-line tool for working with BitTorrent files. |
|
Package metainfo parses .torrent files as specified by BEP 3.
|
Package metainfo parses .torrent files as specified by BEP 3. |
|
Package peer implements the BitTorrent peer wire protocol as defined in BEP 3.
|
Package peer implements the BitTorrent peer wire protocol as defined in BEP 3. |
|
Package piece manages per-piece download state for a BitTorrent client.
|
Package piece manages per-piece download state for a BitTorrent client. |
|
Package tracker implements an HTTP tracker client for the BitTorrent protocol, as defined in BEP 3 and BEP 23 (compact peer lists).
|
Package tracker implements an HTTP tracker client for the BitTorrent protocol, as defined in BEP 3 and BEP 23 (compact peer lists). |