Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cenkalti/rain
🌧 BitTorrent client and library in Go
https://github.com/cenkalti/rain
bittorrent golang p2p torrent
Last synced: 2 days ago
JSON representation
🌧 BitTorrent client and library in Go
- Host: GitHub
- URL: https://github.com/cenkalti/rain
- Owner: cenkalti
- License: mit
- Created: 2014-05-21T09:17:24.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2025-01-02T07:00:04.000Z (10 days ago)
- Last Synced: 2025-01-02T14:05:56.199Z (9 days ago)
- Topics: bittorrent, golang, p2p, torrent
- Language: Go
- Homepage:
- Size: 3.49 MB
- Stars: 992
- Watchers: 18
- Forks: 74
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-go - rain - BitTorrent client and library. (Distributed Systems / Search and Analytic Databases)
- awesome-repositories - cenkalti/rain - 🌧 BitTorrent client and library in Go (Go)
- go-awesome - rain - Bittorrent client and library (Open source library / The Internet)
- awesome-go-extra - rain - 05-21T09:17:24Z|2022-08-21T22:17:27Z| (Distributed Systems / Advanced Console UIs)
README
rain
====---
BitTorrent client and library in Go. Running in production at [put.io](putio-link) since 2019. Processing thousands of torrents every day.
[![GoDoc](https://godoc.org/github.com/cenkalti/rain?status.svg)](https://pkg.go.dev/github.com/cenkalti/rain/torrent?tab=doc)
[![GitHub Release](https://img.shields.io/github/release/cenkalti/rain.svg)](https://github.com/cenkalti/rain/releases)
[![Coverage Status](https://coveralls.io/repos/github/cenkalti/rain/badge.svg)](https://coveralls.io/github/cenkalti/rain)
[![Go Report Card](https://goreportcard.com/badge/github.com/cenkalti/rain)](https://goreportcard.com/report/github.com/cenkalti/rain)Features
--------
- [Core protocol](http://bittorrent.org/beps/bep_0003.html)
- [Fast extension](http://bittorrent.org/beps/bep_0006.html)
- [Magnet links](http://bittorrent.org/beps/bep_0009.html)
- [Multiple trackers](http://bittorrent.org/beps/bep_0012.html)
- [UDP trackers](http://bittorrent.org/beps/bep_0015.html)
- [DHT](http://bittorrent.org/beps/bep_0005.html)
- [PEX](http://bittorrent.org/beps/bep_0011.html)
- [Message stream encryption](http://wiki.vuze.com/w/Message_Stream_Encryption)
- [WebSeed](http://bittorrent.org/beps/bep_0019.html)
- Fast resuming
- IP blocklist
- RPC server & client
- Console UI
- Tool for creating & reading .torrent filesScreenshot
----------
![Rain Screenshot](https://cl.ly/b03c639da66c/Screen%20Shot%202019-09-30%20at%2019.04.00.png)Installing
----------If you are on MacOS you can install from [brew](https://brew.sh/):
```sh
brew install cenkalti/rain/rain
```Otherwise, get the latest binary from [releases page](https://github.com/cenkalti/rain/releases).
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 ` 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
----------------```go
import "github.com/cenkalti/rain/torrent"// 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](https://github.com/cenkalti/rain/blob/master/main.go) file.
See [package documentation](https://pkg.go.dev/github.com/cenkalti/rain/torrent?tab=doc) 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](https://github.com/cenkalti/rain/blob/master/torrent/config.go)Difference from other clients
-----------------------------Rain is the main BitTorrent client used at [put.io](putio-link).
It is designed to handle hundreds of torrents while using low system resources.
One notable 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
----------------The following features are not implemented in Rain, and this list should not be considered as a roadmap. These features are intentionally omitted either because they don't provide sufficient value for our use case at [put.io](putio-link), or because implementing them would add unnecessary complexity to the codebase. We prefer to maintain a focused and efficient implementation that serves our specific needs.
- [IPv6 tracker extension](http://bittorrent.org/beps/bep_0007.html)
- [IPv6 extension for DHT](http://bittorrent.org/beps/bep_0032.html)
- [uTorrent transport protocol](http://bittorrent.org/beps/bep_0029.html)
- [Superseeding](http://bittorrent.org/beps/bep_0016.html)
- [HTTP seeding](http://bittorrent.org/beps/bep_0017.html)
- [Merkle tree torrent extension](http://bittorrent.org/beps/bep_0030.html)
- uPnP port forwarding
- Selective downloading
- Sequential downloadingContributing
------------Rain is primarily developed to serve the specific requirements of [put.io](putio-link). Due to this focused purpose, feature requests that do not align with put.io's needs are likely to be rejected. Additionally, we maintain a strong preference for simplicity in implementation - complex solutions, even if technically superior, will generally not be accepted. Please keep these guidelines in mind when submitting issues or pull requests.
Star History
------------[![Star History Chart](https://api.star-history.com/svg?repos=cenkalti/rain&type=Date)](https://star-history.com/#cenkalti/rain&Date)
[putio-link]: https://put.io