Skip to content

Commit

Permalink
refactor: [#1207] inline methods
Browse files Browse the repository at this point in the history
  • Loading branch information
josecelano committed Jan 27, 2025
1 parent 026f957 commit 209b52c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub async fn start(config: &Configuration, app_container: &AppContainer) -> Vec<
let registar = Registar::default();

// Load peer keys
if app_container.tracker.is_private() {
if config.core.private {
app_container
.keys_handler
.load_keys_from_database()
Expand All @@ -59,7 +59,7 @@ pub async fn start(config: &Configuration, app_container: &AppContainer) -> Vec<
}

// Load whitelisted torrents
if app_container.tracker.is_listed() {
if config.core.listed {
app_container
.whitelist_manager
.load_whitelist_from_database()
Expand All @@ -70,7 +70,7 @@ pub async fn start(config: &Configuration, app_container: &AppContainer) -> Vec<
// Start the UDP blocks
if let Some(udp_trackers) = &config.udp_trackers {
for udp_tracker_config in udp_trackers {
if app_container.tracker.is_private() {
if config.core.private {
tracing::warn!(
"Could not start UDP tracker on: {} while in private mode. UDP is not safe for private trackers!",
udp_tracker_config.bind_address
Expand Down
20 changes: 1 addition & 19 deletions src/core/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,28 +496,10 @@ impl Tracker {
})
}

/// Returns `true` is the tracker is in public mode.
#[must_use]
pub fn is_public(&self) -> bool {
!self.config.private
}

/// Returns `true` is the tracker is in private mode.
#[must_use]
pub fn is_private(&self) -> bool {
self.config.private
}

/// Returns `true` is the tracker is in whitelisted mode.
#[must_use]
pub fn is_listed(&self) -> bool {
self.config.listed
}

/// Returns `true` if the tracker requires authentication.
#[must_use]
pub fn requires_authentication(&self) -> bool {
self.is_private()
self.config.private
}

/// Returns `true` is the tracker is in whitelisted mode.
Expand Down

0 comments on commit 209b52c

Please sign in to comment.