You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// It loads the application configuration from the environment.
59
+
///
60
+
/// There are two methods to inject the configuration:
61
+
///
62
+
/// 1. By using a config file: `config.toml`. The file must be in the same folder where you are running the tracker.
63
+
/// 2. Environment variable: `TORRUST_TRACKER_CONFIG`. The variable contains the same contents as the `config.toml` file.
64
+
///
65
+
/// Environment variable has priority over the config file.
66
+
///
67
+
/// Refer to the [configuration documentation](https://docs.rs/torrust-tracker-configuration) for the configuration options.
68
+
///
35
69
/// # Panics
36
70
///
37
71
/// Will panic if it can't load the configuration from either
Copy file name to clipboardExpand all lines: src/bootstrap/jobs/http_tracker.rs
+20Lines changed: 20 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,16 @@
1
+
//! HTTP tracker job starter.
2
+
//!
3
+
//! The function [`http_tracker::start_job`](crate::bootstrap::jobs::http_tracker::start_job) starts a new HTTP tracker server.
4
+
//!
5
+
//! > **NOTICE**: the application can launch more than one HTTP tracker on different ports.
6
+
//! Refer to the [configuration documentation](https://docs.rs/torrust-tracker-configuration) for the configuration options.
7
+
//!
8
+
//! The [`http_tracker::start_job`](crate::bootstrap::jobs::http_tracker::start_job) function spawns a new asynchronous task,
9
+
//! that tasks is the "**launcher**". The "**launcher**" starts the actual server and sends a message back to the main application.
10
+
//! The main application waits until receives the message [`ServerJobStarted`](crate::bootstrap::jobs::http_tracker::ServerJobStarted) from the "**launcher**".
11
+
//!
12
+
//! The "**launcher**" is an intermediary thread that decouples the HTTP servers from the process that handles it. The HTTP could be used independently in the future.
13
+
//! In that case it would not need to notify a parent process.
1
14
use std::sync::Arc;
2
15
3
16
use axum_server::tls_rustls::RustlsConfig;
@@ -10,9 +23,16 @@ use crate::servers::http::v1::launcher;
10
23
usecrate::servers::http::Version;
11
24
usecrate::tracker;
12
25
26
+
/// This is the message that the "**launcher**" spawned task sends to the main application process to notify that the HTTP server was successfully started.
27
+
///
28
+
/// > **NOTICE**: it does not mean the HTTP server is ready to receive requests. It only means the new server started. It might take some time to the server to be ready to accept request.
13
29
#[derive(Debug)]
14
30
pubstructServerJobStarted();
15
31
32
+
/// It starts a new HTTP server with the provided configuration and version.
33
+
///
34
+
/// Right now there is only one version but in the future we could support more than one HTTP tracker version at the same time.
35
+
/// This feature allows supporting breaking changes on `BitTorrent` BEPs.
Copy file name to clipboardExpand all lines: src/bootstrap/jobs/torrent_cleanup.rs
+17Lines changed: 17 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,15 @@
1
+
//! Job that runs a task on intervals to clean up torrents.
2
+
//!
3
+
//! It removes inactive peers and (optionally) peerless torrents.
4
+
//!
5
+
//! **Inactive peers** are peers that have not been updated for more than `max_peer_timeout` seconds.
6
+
//! `max_peer_timeout` is a customizable core tracker option.
7
+
//!
8
+
//! If the core tracker configuration option `remove_peerless_torrents` is true, the cleanup job will also
9
+
//! remove **peerless torrents** which are torrents with an empty peer list.
10
+
//!
11
+
//! Refer to [`torrust-tracker-configuration documentation`](https://docs.rs/torrust-tracker-configuration) for more info about those options.
12
+
1
13
use std::sync::Arc;
2
14
3
15
use chrono::Utc;
@@ -7,6 +19,11 @@ use torrust_tracker_configuration::Configuration;
7
19
8
20
usecrate::tracker;
9
21
22
+
/// It starts a jobs for cleaning up the torrent data in the tracker.
23
+
///
24
+
/// The cleaning task is executed on an `inactive_peer_cleanup_interval`.
25
+
///
26
+
/// Refer to [`torrust-tracker-configuration documentation`](https://docs.rs/torrust-tracker-configuration) for more info about that option.
Copy file name to clipboardExpand all lines: src/bootstrap/jobs/tracker_apis.rs
+34Lines changed: 34 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,25 @@
1
+
//! Tracker API job starter.
2
+
//!
3
+
//! The [`tracker_apis::start_job`](crate::bootstrap::jobs::tracker_apis::start_job)
4
+
//! function starts a the HTTP tracker REST API.
5
+
//!
6
+
//! > **NOTICE**: that even thought there is only one job the API has different
7
+
//! versions. API consumers can choose which version to use. The API version is
8
+
//! part of the URL, for example: `http://localhost:1212/api/v1/stats`.
9
+
//!
10
+
//! The [`tracker_apis::start_job`](crate::bootstrap::jobs::tracker_apis::start_job)
11
+
//! function spawns a new asynchronous task, that tasks is the "**launcher**".
12
+
//! The "**launcher**" starts the actual server and sends a message back
13
+
//! to the main application. The main application waits until receives
14
+
//! the message [`ApiServerJobStarted`](crate::bootstrap::jobs::tracker_apis::ApiServerJobStarted)
15
+
//! from the "**launcher**".
16
+
//!
17
+
//! The "**launcher**" is an intermediary thread that decouples the API server
18
+
//! from the process that handles it. The API could be used independently
19
+
//! in the future. In that case it would not need to notify a parent process.
20
+
//!
21
+
//! Refer to the [configuration documentation](https://docs.rs/torrust-tracker-configuration)
22
+
//! for the API configuration options.
1
23
use std::sync::Arc;
2
24
3
25
use axum_server::tls_rustls::RustlsConfig;
@@ -9,9 +31,21 @@ use torrust_tracker_configuration::HttpApi;
9
31
usecrate::servers::apis::server;
10
32
usecrate::tracker;
11
33
34
+
/// This is the message that the "launcher" spawned task sends to the main
35
+
/// application process to notify the API server was successfully started.
36
+
///
37
+
/// > **NOTICE**: it does not mean the API server is ready to receive requests.
38
+
/// It only means the new server started. It might take some time to the server
39
+
/// to be ready to accept request.
12
40
#[derive(Debug)]
13
41
pubstructApiServerJobStarted();
14
42
43
+
/// This function starts a new API server with the provided configuration.
44
+
///
45
+
/// The functions starts a new concurrent task that will run the API server.
46
+
/// This task will send a message to the main application process to notify
47
+
/// that the API server was successfully started.
48
+
///
15
49
/// # Panics
16
50
///
17
51
/// It would panic if unable to send the `ApiServerJobStarted` notice.
Copy file name to clipboardExpand all lines: src/bootstrap/jobs/udp_tracker.rs
+11Lines changed: 11 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,11 @@
1
+
//! UDP tracker job starter.
2
+
//!
3
+
//! The [`udp_tracker::start_job`](crate::bootstrap::jobs::udp_tracker::start_job)
4
+
//! function starts a new UDP tracker server.
5
+
//!
6
+
//! > **NOTICE**: that the application can launch more than one UDP tracker
7
+
//! on different ports. Refer to the [configuration documentation](https://docs.rs/torrust-tracker-configuration)
8
+
//! for the configuration options.
1
9
use std::sync::Arc;
2
10
3
11
use log::{error, info, warn};
@@ -7,6 +15,9 @@ use torrust_tracker_configuration::UdpTracker;
7
15
usecrate::servers::udp::server::Udp;
8
16
usecrate::tracker;
9
17
18
+
/// It starts a new UDP server with the provided configuration.
19
+
///
20
+
/// It spawns a new asynchronous task for the new UDP server.
Copy file name to clipboardExpand all lines: src/bootstrap/logging.rs
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,3 +1,15 @@
1
+
//! Setup for the application logging.
2
+
//!
3
+
//! It redirects the log info to the standard output with the log level defined in the configuration.
4
+
//!
5
+
//! - `Off`
6
+
//! - `Error`
7
+
//! - `Warn`
8
+
//! - `Info`
9
+
//! - `Debug`
10
+
//! - `Trace`
11
+
//!
12
+
//! Refer to the [configuration crate documentation](https://docs.rs/torrust-tracker-configuration) to know how to change log settings.
1
13
use std::str::FromStr;
2
14
use std::sync::Once;
3
15
@@ -6,6 +18,7 @@ use torrust_tracker_configuration::Configuration;
6
18
7
19
staticINIT:Once = Once::new();
8
20
21
+
/// It redirects the log info to the standard output with the log level defined in the configuration
9
22
pubfnsetup(cfg:&Configuration){
10
23
let level = config_level_or_default(&cfg.log_level);
0 commit comments