This is the tracker component for the Reliable BitTorrent group project (UBC CPSC 416 2022W2). The peer (baseline provider) repository can be found here, and the validation repository can be found here.
Performance focused BitTorrent tracker supporting HTTP, UDP, IPv4 and IPv6.
Try Trakx for yourself! These instances are hosted on Oracles always free tier.
Status | Protocol | Address |
---|---|---|
✅Ok | IPv4 UDP | udp://u4.trakx.crim.ist:1337 |
✅Ok | IPv6 UDP | udp://u6.trakx.crim.ist:1337 |
✅Ok | IPv4 HTTP | http://h4.trakx.crim.ist/announce |
✅Ok | IPv6 HTTP | http://h6.trakx.crim.ist/announce |
Go 1.19+ required.
git clone https://github.com/crimist/trakx && cd trakx
# install to go bin
go install .
trakx status # generates configuration
# or build
go build .
./trakx status # generates configuration
See configuration and netdata setup.
The configuration file can be found at ~/.config/trakx/trakx.yaml
.
You'll have to run the trakx controller at least once to generate this file.
Config settings can be overwritten with environment variables:
$ cat trakx.yaml
...
loglevel = error
...
$ TRAKX_LOGLEVEL=DEBUG trakx run
2022-01-16T19:52:25.627-0800 DEBUG Debug level enabled, debug panics are on
...
Trakx attempts to load the config file from the following directories in order:
.
~/.config/trakx/
You can modify the default configuration and files served by the webserver in the tracker/config/embeded/
folder.
NOTE: Trakx webserver will only serve files at their full path. dmca
will 404, dmca.html
will 200.
To bind to privileged ports I recommend using CAP_NET_BIND_SERVICE
. More information can be found here.
$ sudo setcap 'cap_net_bind_service=+ep' ./trakx
$ TRAKX_TRACKER_HTTP_PORT=80 ./trakx run
2022-04-05T16:18:05.847-0700 INFO HTTP tracker enabled {"port": 80}
Warning: install.sh
will overwrite go_expvar.conf
. If you are using other expvar programs with netdata manually merge the two files.
- Run
/etc/netdata/edit-config python.d.conf
, changego_expvar
toyes
. - Customize the url in
netdata/expvar.conf
if needed. - Install netdata plugins with
cd netdata; ./install.sh
.
You can build with different tags with go build/install -tags <tag> .
Tags
fast
will build without IP, seed, and leech metrics which will reduce cpu and memory usageheroku
will build trakx for app engines. This means the controller will not be built and trakx will run immediately when the binary is executed.
The following metrics were collected on Heroku free tier running an HTTP tracker with the fast
tag disabled.
Heroku dashboard:
Database stats:
Flamegraph:
Trakx has been optimized to use a little CPU time as possible. In most cases, almost all CPU time will be spent handing (negotiating/send/recv) connections, especially for TCP (HTTP).
Trakx has also been optimized to use minimal memory and is mostly limited by the go GC. In this example the GC runs every 2 minutes (the forced GC period) at this level of traffic. The inuse_space
delta from GC is 7.5% meaning this collection frequency would be sustained at GOGC=8
.