Configuring the Tracker
torrust-tracker's configuration is stored in a TOML file called: config.toml
. The config file can be generated by running the torrust-tracker for the first time.
Tracker Modes
torrust-tracker currently supports 4 different tracking modes.
Public
mode: public
In this mode the tracker allows any torrent, even if unknown to be tracked.
Whitelisted
mode: listed
In listed mode, anyone can use the tracker like in public mode. Except that torrents must be whitelisted ahead of being announced. Torrents can be added to a whitelist using the REST API.
Private
mode: private
Private tracking requires all peers to be authenticated.
Peers can authenticate themselves using a key: https://torrust-tracker.com/announce/<key>
.
Keys can be created using the REST API.
Private-Whitelisted
mode: private_listed
This mode is a combination of listen and private mode. All peers must authenticate themselves, AND the tracker will only track whitelisted torrents.
Configuration
Root Level
Root | Requirement | Values | Default | |
---|---|---|---|---|
log_level | OPTIONAL | Log level. | off , info or trace |
info |
mode | REQUIRED | Tracker Mode (See above). | public , listed , private or private_listed |
public |
db_driver | REQUIRED | Database Driver. | MySQL or Sqlite3 |
Sqlite3 |
db_path | REQUIRED | Database Path. | MySQL CONNECTION URL (mysql://USERNAME:PASSWORD@HOST:3306/DATABASE) or Sqlite3 DATABASE PATH |
data.db |
announce_interval | REQUIRED | Interval that peers will announce in. | Interval in seconds. | 120 |
min_announce_interval | REQUIRED | Minimal interval that peers will announce in. | Interval in seconds. | 120 |
max_peer_timeout | REQUIRED | Maximum seconds peers can be inactive before being removed. | Seconds. | 900 |
on_reverse_proxy | REQUIRED | If true, tracker will use X-Forwarded-For header as peer IP. | true or false |
false |
external_ip | OPTIONAL | Needs to be set if announcing to this tracker from local network. | IP like: 100.69.420.117 |
EMPTY |
tracker_usage_statistics | REQUIRED | Keep track of tracker usage statistics. | true or false |
true |
persistent_torrent_completed_stat | REQUIRED | Keep track of the completed stat in torrents, even after reboot. | true or false |
false |
inactive_peer_cleanup_interval | REQUIRED | Inactive peers get removed from each torrent every interval. | Interval in seconds or 0 to disable. | 600 |
remove_peerless_torrents | REQUIRED | Remove torrents without peers during the inactive_peer_cleanup_interval. | true or false |
true |
UDP Tracker
[[udp_trackers]] (can add multiple) | OPTIONAL | Values | Default | |
---|---|---|---|---|
enabled | REQUIRED | Whether this bind is enabled. | true or false | false |
bind_address | REQUIRED | Bind address + port. | Example: 0.0.0.0:6969 |
0.0.0.0:6969 |
HTTP Tracker
[[http_trackers]] (can add multiple) | OPTIONAL | Values | Default | |
---|---|---|---|---|
enabled | REQUIRED | Whether this bind is enabled. | true or false | false |
bind_address | REQUIRED | Bind address + port. | Example: 0.0.0.0:6969 |
0.0.0.0:6969 |
ssl_enabled | REQUIRED | Enable SSL or not. HIGHLY RECOMMENDED for private trackers. | true or false | false |
ssl_cert_path | OPTIONAL | Path to SSL cert. | Any path. | EMPTY |
ssl_key_path | OPTIONAL | Path to SSL cert key. | Any path. | EMPTY |
HTTP API
[http_api] | REQUIRED | Values | Default | |
---|---|---|---|---|
enabled | REQUIRED | Enables built-in API. | true or false | true |
bind_address | REQUIRED | Bind address + port. | Example: 127.0.0.1:1212 |
127.0.0.1:1212 |
[http_api.access_tokens] | REQUIRED IF HTTP API ENABLED | Values | Default | |
---|---|---|---|---|
{user} | OPTIONAL | Token for built-in API. | {key} | admin = "MyAccessToken" |
Sample Configuration
log_level = "info"
mode = "public"
db_driver = "Sqlite3"
db_path = "data.db"
announce_interval = 120
min_announce_interval = 120
max_peer_timeout = 900
on_reverse_proxy = false
external_ip = "0.0.0.0"
tracker_usage_statistics = true
persistent_torrent_completed_stat = false
inactive_peer_cleanup_interval = 600
remove_peerless_torrents = true
[[udp_trackers]]
enabled = true
bind_address = "0.0.0.0:6969"
[[udp_trackers]]
enabled = true
bind_address = ":::6969"
[[http_trackers]]
enabled = true
bind_address = "0.0.0.0:6969"
ssl_enabled = false
ssl_cert_path = ""
ssl_key_path = ""
[[http_trackers]]
enabled = true
bind_address = ":::6969"
ssl_enabled = false
ssl_cert_path = ""
ssl_key_path = ""
[http_api]
enabled = true
bind_address = "127.0.0.1:1212"
[http_api.access_tokens]
admin = "MyAccessToken"