pub struct Configuration {Show 16 fields
pub log_level: Option<String>,
pub mode: TrackerMode,
pub db_driver: DatabaseDriver,
pub db_path: String,
pub announce_interval: u32,
pub min_announce_interval: u32,
pub on_reverse_proxy: bool,
pub external_ip: Option<String>,
pub tracker_usage_statistics: bool,
pub persistent_torrent_completed_stat: bool,
pub max_peer_timeout: u32,
pub inactive_peer_cleanup_interval: u64,
pub remove_peerless_torrents: bool,
pub udp_trackers: Vec<UdpTracker>,
pub http_trackers: Vec<HttpTracker>,
pub http_api: HttpApi,
}Expand description
Core configuration for the tracker.
Fields§
§log_level: Option<String>Logging level. Possible values are: Off, Error, Warn, Info,
Debug and Trace. Default is Info.
mode: TrackerModeTracker mode. See TrackerMode for more information.
db_driver: DatabaseDriverDatabase driver. Possible values are: Sqlite3, and MySQL.
db_path: StringDatabase connection string. The format depends on the database driver.
For Sqlite3, the format is path/to/database.db, for example:
./storage/database/data.db.
For Mysql, the format is mysql://db_user:db_user_password:port/db_name, for
example: root:password@localhost:3306/torrust.
announce_interval: u32Interval in seconds that the client should wait between sending regular announce requests to the tracker.
It’s a recommended wait time between announcements.
This is the standard amount of time that clients should wait between sending consecutive announcements to the tracker. This value is set by the tracker and is typically provided in the tracker’s response to a client’s initial request. It serves as a guideline for clients to know how often they should contact the tracker for updates on the peer list, while ensuring that the tracker is not overwhelmed with requests.
min_announce_interval: u32Minimum announce interval. Clients must not reannounce more frequently than this.
It establishes the shortest allowed wait time.
This is an optional parameter in the protocol that the tracker may provide in its response. It sets a lower limit on the frequency at which clients are allowed to send announcements. Clients should respect this value to prevent sending too many requests in a short period, which could lead to excessive load on the tracker or even getting banned by the tracker for not adhering to the rules.
on_reverse_proxy: boolWeather the tracker is behind a reverse proxy or not.
If the tracker is behind a reverse proxy, the X-Forwarded-For header
sent from the proxy will be used to get the client’s IP address.
external_ip: Option<String>The external IP address of the tracker. If the client is using a loopback IP address, this IP address will be used instead. If the peer is using a loopback IP address, the tracker assumes that the peer is in the same network as the tracker and will use the tracker’s IP address instead.
tracker_usage_statistics: boolWeather the tracker should collect statistics about tracker usage.
If enabled, the tracker will collect statistics like the number of
connections handled, the number of announce requests handled, etc.
Refer to the Tracker for more
information about the collected metrics.
persistent_torrent_completed_stat: boolIf enabled the tracker will persist the number of completed downloads. That’s how many times a torrent has been downloaded completely.
max_peer_timeout: u32Maximum time in seconds that a peer can be inactive before being considered an inactive peer. If a peer is inactive for more than this time, it will be removed from the torrent peer list.
inactive_peer_cleanup_interval: u64Interval in seconds that the cleanup job will run to remove inactive peers from the torrent peer list.
remove_peerless_torrents: boolIf enabled, the tracker will remove torrents that have no peers.
THe clean up torrent job runs every inactive_peer_cleanup_interval
seconds and it removes inactive peers. Eventually, the peer list of a
torrent could be empty and the torrent will be removed if this option is
enabled.
udp_trackers: Vec<UdpTracker>The list of UDP trackers the tracker is running. Each UDP tracker represents a UDP server that the tracker is running and it has its own configuration.
http_trackers: Vec<HttpTracker>The list of HTTP trackers the tracker is running. Each HTTP tracker represents a HTTP server that the tracker is running and it has its own configuration.
http_api: HttpApiThe HTTP API configuration.
Implementations§
source§impl Configuration
impl Configuration
sourcepub fn get_ext_ip(&self) -> Option<IpAddr>
pub fn get_ext_ip(&self) -> Option<IpAddr>
Returns the tracker public IP address id defined in the configuration,
and None otherwise.
sourcepub fn load_from_file(path: &str) -> Result<Configuration, Error>
pub fn load_from_file(path: &str) -> Result<Configuration, Error>
Loads the configuration from the configuration file.
Errors
Will return Err if path does not exist or has a bad configuration.
sourcepub fn load_from_env_var(
config_env_var_name: &str
) -> Result<Configuration, Error>
pub fn load_from_env_var( config_env_var_name: &str ) -> Result<Configuration, Error>
Loads the configuration from the environment variable. The whole configuration must be in the environment variable. It contains the same configuration as the configuration file with the same format.
Errors
Will return Err if the environment variable does not exist or has a bad configuration.
Trait Implementations§
source§impl Debug for Configuration
impl Debug for Configuration
source§impl Default for Configuration
impl Default for Configuration
source§impl<'de> Deserialize<'de> for Configuration
impl<'de> Deserialize<'de> for Configuration
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
source§impl PartialEq<Configuration> for Configuration
impl PartialEq<Configuration> for Configuration
source§fn eq(&self, other: &Configuration) -> bool
fn eq(&self, other: &Configuration) -> bool
self and other values to be equal, and is used
by ==.source§impl Serialize for Configuration
impl Serialize for Configuration
impl Eq for Configuration
impl StructuralEq for Configuration
impl StructuralPartialEq for Configuration
Auto Trait Implementations§
impl RefUnwindSafe for Configuration
impl Send for Configuration
impl Sync for Configuration
impl Unpin for Configuration
impl UnwindSafe for Configuration
Blanket Implementations§
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.