Skip to content

gmonarque/b1tpoti0n

Repository files navigation

b1tpoti0n

b1tpoti0n

Private BitTorrent tracker in Elixir.

Why b1tpoti0n?

b1tpoti0n Ocelot (C++) Chihaya (Go)
Zero-config start SQLite default MySQL required External storage required
Private tracker features Built-in Requires Gazelle Middleware plugins
Fault tolerance OTP supervision Manual Manual
Hot code upgrades Native No No
Clustering Horde + Redis No Redis/etcd
WebSocket live stats Built-in No No
Admin REST API Built-in Via Gazelle No

Start simple, scale when needed. SQLite + in-memory peers for small communities. Swap to PostgreSQL + Redis when you want with config changes only.

Scalability is built into Elixir. Elixir runs on the Erlang VM (BEAM), designed for telecom systems handling millions of concurrent connections. Each torrent swarm runs in its own lightweight process. The VM handles scheduling across all CPU cores automatically. When one node isn't enough, just add more! Horde distributes swarm workers across the cluster transparently. See DOCUMENTATION.md for details.

Fault tolerance by default. OTP supervision trees restart crashed processes automatically. A bug in one swarm doesn't take down the tracker. Hot code upgrades let you deploy fixes without disconnecting peers.

Batteries included. HnR detection, bonus points, freeleech, ratio enforcement and client whitelist are all built-in. No separate daemons or plugins to maintain.

Features

  • HTTP/HTTPS tracker (BEP 3) with TLS 1.2+ and secure cipher suites
  • UDP tracker (BEP 15) (public mode only, no user auth)
  • Passkey authentication
  • User ratio tracking
  • Client whitelist
  • IP banning (with CIDR support)
  • Rate limiting (token bucket per IP)
  • Hit-and-Run detection
  • Bonus points system
  • Freeleech and multipliers (with abuse prevention caps)
  • Prometheus metrics
  • SQLite or PostgreSQL database
  • In-memory or Redis peer storage
  • Clustering with Horde + libcluster
  • Admin API with IP whitelist protection
  • Real-time WebSocket stats

Quick Start

# Install dependencies
mix deps.get

# Setup database
mix ecto.create && mix ecto.migrate

# Start tracker
iex -S mix

Default port: HTTP 8080 (UDP disabled by default, set udp_port to enable)

Endpoints

  • GET /:passkey/announce - Announce
  • GET /:passkey/scrape - Scrape
  • GET /health - Health check
  • GET /stats - Basic statistics
  • GET /metrics - Prometheus metrics
  • /admin/* - Admin REST API
  • GET /ws - WebSocket (real-time updates)

Configuration

See config/config.exs for all options.

Key settings:

  • http_port / https_port / udp_port - Network ports
  • admin_token - Admin API authentication (required in production)
  • admin_api_ip_whitelist - Restrict admin API to specific IPs
  • trust_x_forwarded_for - Enable when behind a trusted reverse proxy
  • peer_storage - :memory (default) or :redis for clustering
  • hnr - Hit-and-Run detection settings
  • bonus_points - Bonus points system settings
  • enforce_torrent_whitelist - Require torrent pre-registration
  • stats_endpoint / metrics_endpoint - Protection for monitoring endpoints

For production, set environment variables (see DOCUMENTATION.md):

  • ADMIN_TOKEN, HTTP_PORT, UDP_PORT, DATABASE_URL, ADMIN_API_IP_WHITELIST, etc.

Documentation

See DOCUMENTATION.md for complete documentation including:

  • Full configuration reference
  • Architecture overview
  • Admin API reference
  • Deployment guide

Admin UI

A standalone admin interface is available at admin-ui/index.html.

Live Demo — UI preview (not connected to a tracker)

Tests

mix test

License

AGPL-3.0 — If you modify and run this on a server, you must share your changes. If you don't, I'll hunt you down.

About

A private BitTorrent tracker written in Elixir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published