aria2-core 0.3.12

aria2-rust core download engine: multi-protocol segmented downloads, rate limiting, configuration, session persistence, and BitTorrent seeding
Documentation
mod checkpoint;
mod command;
mod dht_periodic_lookup;
mod download_speed;
mod environment;
mod finalization;
mod hash_verification;
mod incoming;
mod peer_management;
mod peer_session;
mod pex;
mod piece_download;
mod registry;
mod state;

#[cfg(test)]
mod runtime_tests;
#[cfg(test)]
mod tests;
mod tracker_actor;
pub mod types;
mod upload_speed;

// Keep the download-execution interface at this module root for its callers.
pub(crate) use tracker_actor::BtTrackerAnnouncerActor;
pub use types::EndgameState;

pub(crate) use dht_periodic_lookup::{DhtPeriodicLookup, check_periodic_dht_lookup};
pub(crate) use download_speed::spawn as spawn_download_speed_reporter;
pub(crate) use pex::{PEX_SEND_INTERVAL, send_periodic_pex_to_swarm};
pub(crate) use upload_speed::spawn as spawn_upload_speed_reporter;

use std::collections::HashSet;

pub(crate) fn deduplicate_tracker_tiers(tiers: Vec<Vec<String>>) -> Vec<Vec<String>> {
    let mut seen = HashSet::new();
    tiers
        .into_iter()
        .filter_map(|tier| {
            let unique = tier
                .into_iter()
                .filter(|url| seen.insert(url.clone()))
                .collect::<Vec<_>>();
            (!unique.is_empty()).then_some(unique)
        })
        .collect()
}