Skip to content

Latest commit

 

History

History

tracker-core

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Torrust Tracker Core

torrust-tracker-core contains the central logic of the Torrust Tracker, independent of the delivery protocol: announce and scrape handling, peer keys authentication, the whitelist, the database drivers and persistence of torrent statistics. You usually do not need it directly: use the Torrust Tracker. To build your own tracker, add a delivery layer (HTTP or UDP) on top.

Where it fits

Core package (*-core) below torrust-tracker-http-core and torrust-tracker-udp-core. Workspace dependencies: torrust-tracker-configuration, torrust-tracker-events, torrust-tracker-primitives, torrust-tracker-swarm-coordination-registry. Used by: torrust-tracker, torrust-tracker-axum-http-server, torrust-tracker-axum-rest-api-server, torrust-tracker-http-core, torrust-tracker-rest-api-runtime-adapter, torrust-tracker-udp-core and 1 more. See the package catalog for the full picture.

Main API

announce_handler, scrape_handler, authentication, whitelist, databases and container.

Stability

Versions are independent per package (see the ADR). While the version is 0.x, the public API can change in any minor release. The crate is developed for the Torrust Tracker first, so use it directly only if you accept that.

Documentation

Testing

Run tests including the tests of the MySQL driver (each driver suite needs the db-compatibility-tests feature, a container and its variable):

TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST=true cargo test --features db-compatibility-tests run_mysql_driver_tests

The PostgreSQL driver has its own suite and variable:

TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST=true cargo test --features db-compatibility-tests run_postgres_driver_tests

NOTE: The MySQL and PostgreSQL driver suites require docker to run. We don't run them by default because we don't want to run them when we build container images. The Torrust Tracker container build runs unit tests for all dependencies, including this library. The db-compatibility workflow (.github/workflows/db-compatibility.yaml) runs both suites against MySQL 8.0 and 8.4 and PostgreSQL 14 to 17. Without the feature the suites are not compiled, and with it but without the variable they return at once, so a run that skips them still reports them as passed.

Show coverage report:

TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST=true TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST=true cargo +stable llvm-cov --features db-compatibility-tests

Export coverage report to lcov format:

TORRUST_TRACKER_CORE_RUN_MYSQL_DRIVER_TEST=true TORRUST_TRACKER_CORE_RUN_POSTGRES_DRIVER_TEST=true cargo +stable llvm-cov --features db-compatibility-tests --lcov --output-path=./.coverage/lcov.info

If you use Visual Studio Code, you can use the Coverage Gutters extension to view the coverage lines.

License

The project is licensed under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE (AGPL-3.0-only).