repowisecenkalti/rain

Architecture of cenkalti/rain

cenkalti/rain is 248 source files holding 1,536 symbols across 4 modules, written mainly in Go. The largest module is internal, with 194 files, and 2 files are entry points into the dependency graph.

How rain fits together

Input enters through the rain binary, whose entry point is main.go, and the server is started with the rain server command. torrent/session.go is the main orchestrator that manages torrents, DHT and shared resources, and torrent/torrent.go handles the lifecycle of each individual torrent. The BitTorrent protocol implementation lives in internal/peerprotocol/, and internal/piecepicker/piecepicker.go decides which pieces to request. Downloaded data is written to disk by the code in internal/storage/, with resume data persisted using BoltDB. rainrpc/ holds the shared types for the JSON-RPC 2.0 control API.

Largest modules

  • internal: 194 files and 14,730 lines of code
  • torrent: 44 files and 5,398 lines of code
  • rainrpc: 2 files and 269 lines of code
  • root: 1 file and 108 lines of code

Documentation

Repowise documents rain in 344 pages generated from the source, 17 of them written explanations of the repository and its modules. Module guides include:

  • root: Application Main Entrypoint
  • internal/btconn: BT Connection Transport Helpers
  • internal/command: Command Service Interface
  • internal/semaphore: Concurrency and File Semaphore

More on rain: summary and FAQ, codebase overview, code health.

Related guide: Best dependency graph tools for monorepos