rain

command module
v1.12.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 27 Imported by: 0

README

rain

BitTorrent client and library in Go. Running in production at put.io since 2019.

GoDoc GitHub Release Coverage Status Go Report Card

Features

Screenshot

Rain Screenshot

Installing

If you are on MacOS you can install from brew:

brew install cenkalti/rain/rain

Otherwise, get the latest binary from releases page.

Usage as torrent client

Rain is distributed as single binary file. The main use case is running rain server command and operating the server with rain client <subcommand> commands. Server consists of a BitTorrent client and a RPC server. rain client is used to give commands to the server. There is also rain client console command which opens up a text based UI that you can view and manage the torrents on the server. Run rain help to see other commands.

Usage as library

// Create a session
ses, _ := torrent.NewSession(torrent.DefaultConfig)

// Add magnet link
tor, _ := ses.AddURI(magnetLink, nil)

// Watch the progress
for range time.Tick(time.Second) {
	s := tor.Stats()
	log.Printf("Status: %s, Downloaded: %d, Peers: %d", s.Status.String(), s.Bytes.Completed, s.Peers.Total)
}

More complete example can be found under handleDownload function at main.go file.

See package documentation for complete API.

Configuration

All values have sensible defaults, so you can run Rain with an empty config but if you want to customize it's behavior, you can pass a YAML config with -config flag. Config keys must be in lowercase. See the description of values in here: config.go

Difference from other clients

Rain is the main BitTorrent client used at put.io. It is designed to handle hundreds of torrents while using low system resources. The main difference from other clients is that Rain uses a separate peer port for each torrent. This allows Rain to download same torrent for multiple accounts in same private tracker and keep reporting their ratio correctly.

Missing features

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
bitfield
Package bitfield provides support for manipulating bits in a []byte.
Package bitfield provides support for manipulating bits in a []byte.
blocklist/stree
Package stree implements a segment tree and serial algorithm to query intervals
Package stree implements a segment tree and serial algorithm to query intervals
btconn
Package btconn provides support for dialing and accepting BitTorrent connections.
Package btconn provides support for dialing and accepting BitTorrent connections.
fast
Package fast provides an algorithm for generating fast set.
Package fast provides an algorithm for generating fast set.
magnet
Package magnet provides support for parsing magnet links.
Package magnet provides support for parsing magnet links.
metainfo
Package metainfo support for reading and writing torrent files.
Package metainfo support for reading and writing torrent files.
mse
Package mse (Message Stream Encryption) provides a transparent wrapper for bidirectional data streams (e.g.
Package mse (Message Stream Encryption) provides a transparent wrapper for bidirectional data streams (e.g.
peerpriority
Package peerpriority implements BEP 40.
Package peerpriority implements BEP 40.
resumer
Package resumer contains an interface that is used by torrent package for resuming an existing download.
Package resumer contains an interface that is used by torrent package for resuming an existing download.
resumer/boltdbresumer
Package boltdbresumer provides a Resumer implementation that uses a Bolt database file as storage.
Package boltdbresumer provides a Resumer implementation that uses a Bolt database file as storage.
storage
Package storage contains an interface for reading and writing files in a torrent.
Package storage contains an interface for reading and writing files in a torrent.
storage/filestorage
Package filestorage implements Storage interface that uses files on disk as storage.
Package filestorage implements Storage interface that uses files on disk as storage.
tracker
Package tracker provides support for announcing torrents to HTTP and UDP trackers.
Package tracker provides support for announcing torrents to HTTP and UDP trackers.
Package rainrpc provides a RPC client implementation for communicating with Rain session.
Package rainrpc provides a RPC client implementation for communicating with Rain session.
Package torrent provides a BitTorrent client implementation.
Package torrent provides a BitTorrent client implementation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL