chihaya

module
v0.0.0-...-384af84 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2023 License: BSD-2-Clause

README

Chihaya

Build Status Container Image GoDoc License IRC Channel

Chihaya is an open source BitTorrent tracker written in Go.

Differentiating features include:

  • HTTP and UDP protocols
  • IPv4 and IPv6 support
  • Pre/Post middleware hooks
  • YAML configuration
  • Metrics via Prometheus
  • High Availability via Redis
  • Kubernetes deployment via Helm

Note: The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order to get stable binaries.

Why Chihaya?

Chihaya is built for developers looking to integrate BitTorrent into a preexisting production environment. Chihaya's pluggable architecture and middleware framework offers a simple and flexible integration point that abstracts the BitTorrent tracker protocols. The most common use case for Chihaya is enabling peer-to-peer cloud software deployments.

Development

Contributing

Long-term discussion and bug reports are maintained via GitHub Issues. Code review is done via GitHub Pull Requests. Real-time discussion is done via freenode IRC.

For more information read CONTRIBUTING.md.

Getting Started
Building from HEAD

In order to compile the project, the latest stable version of Go and knowledge of a working Go environment are required.

git clone git@github.com:chihaya/chihaya.git
cd chihaya
go build ./cmd/chihaya
./chihaya --help
Docker

Docker containers are available for HEAD and stable releases.

Testing

The following will run all tests and benchmarks. Removing -bench will just run unit tests.

go test -bench $(go list ./...)

The Chihaya executable contains a command to end-to-end test a BitTorrent tracker. See

chihaya --help
Configuration

Configuration of Chihaya is done via one YAML configuration file. The dist/ directory contains an example configuration file. Files and directories under docs/ contain detailed information about configuring middleware, storage implementations, architecture etc.

  • BitTorrent.org: a static website containing the BitTorrent spec and all BEPs
  • OpenTracker: a popular BitTorrent tracker written in C
  • Ocelot: a private BitTorrent tracker written in C++

Directories

Path Synopsis
Package bittorrent implements all of the abstractions used to decouple the protocol of a BitTorrent tracker from the logic of handling Announces and Scrapes.
Package bittorrent implements all of the abstractions used to decouple the protocol of a BitTorrent tracker from the logic of handling Announces and Scrapes.
Package frontend provides implementations and abstractions for tracker logic, parsing and request handling over multiple protocols, such as UDP and HTTP.
Package frontend provides implementations and abstractions for tracker logic, parsing and request handling over multiple protocols, such as UDP and HTTP.
http
Package http implements a BitTorrent frontend via the HTTP protocol as described in BEP 3 and BEP 23.
Package http implements a BitTorrent frontend via the HTTP protocol as described in BEP 3 and BEP 23.
http/bencode
Package bencode implements bencoding of data as defined in BEP 3 using type assertion over reflection for performance.
Package bencode implements bencoding of data as defined in BEP 3 using type assertion over reflection for performance.
udp
Package udp implements a BitTorrent tracker via the UDP protocol as described in BEP 15.
Package udp implements a BitTorrent tracker via the UDP protocol as described in BEP 15.
udp/bytepool
Package bytepool implements an optimization for byte slice allocations by caching those slices for later reuse.
Package bytepool implements an optimization for byte slice allocations by caching those slices for later reuse.
Package middleware implements the TrackerLogic interface by executing a series of middleware hooks.
Package middleware implements the TrackerLogic interface by executing a series of middleware hooks.
clientapproval
Package clientapproval implements a Hook that fails an Announce based on a whitelist or blacklist of BitTorrent client IDs.
Package clientapproval implements a Hook that fails an Announce based on a whitelist or blacklist of BitTorrent client IDs.
jwt
Package jwt implements a Hook that fails an Announce if the client's request is missing a valid JSON Web Token.
Package jwt implements a Hook that fails an Announce if the client's request is missing a valid JSON Web Token.
pkg/random
Package random implements the XORShift PRNG and a way to derive random state from an AnnounceRequest.
Package random implements the XORShift PRNG and a way to derive random state from an AnnounceRequest.
torrentapproval
Package torrentapproval implements a Hook that fails an Announce based on a whitelist or blacklist of torrent hash.
Package torrentapproval implements a Hook that fails an Announce based on a whitelist or blacklist of torrent hash.
varinterval
Package varinterval provides a middleware implementation that handles announcement intervals according to configured ranges, giving different values for each peer so they don't re-announce at the same time.
Package varinterval provides a middleware implementation that handles announcement intervals according to configured ranges, giving different values for each peer so they don't re-announce at the same time.
pkg
log
Package log adds a thin wrapper around logrus to improve non-debug logging performance.
Package log adds a thin wrapper around logrus to improve non-debug logging performance.
metrics
Package metrics implements a standalone HTTP server for serving pprof profiles and Prometheus metrics.
Package metrics implements a standalone HTTP server for serving pprof profiles and Prometheus metrics.
stop
Package stop implements a pattern for shutting down a group of processes.
Package stop implements a pattern for shutting down a group of processes.
timecache
Package timecache provides a cache for the system clock, to avoid calls to time.Now().
Package timecache provides a cache for the system clock, to avoid calls to time.Now().
Package storage provides abstractions and implementations for storing and retrieving peers from their announced infohashes.
Package storage provides abstractions and implementations for storing and retrieving peers from their announced infohashes.
memory
Package memory implements the storage interface for a Chihaya BitTorrent tracker keeping peer data in memory.
Package memory implements the storage interface for a Chihaya BitTorrent tracker keeping peer data in memory.
redis
Package redis implements the storage interface for a Chihaya BitTorrent tracker keeping peer data in redis with hash.
Package redis implements the storage interface for a Chihaya BitTorrent tracker keeping peer data in redis with hash.

Jump to

Keyboard shortcuts

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