aria2-core 0.3.14

aria2-rust core download engine: multi-protocol segmented downloads, rate limiting, configuration, session persistence, and BitTorrent seeding
Documentation
use super::{DEFAULT_DISK_CACHE_BYTES, DownloadOptions};

// Manual Default impl: `enable_dht` and `enable_public_trackers` default to
// `true`, matching the canonical config/task option conversion paths that use
// `unwrap_or(true)`. All other fields use their type-level defaults.
impl Default for DownloadOptions {
    fn default() -> Self {
        Self {
            split: None,
            force_sequential: false,
            max_connection_per_server: None,
            max_http2_sessions_per_server: None,
            max_http2_streams_per_session: None,
            http_version: crate::http::HttpVersion::default(),
            http_adaptive: super::HttpAdaptiveOptions::default(),
            max_download_limit: None,
            max_upload_limit: None,
            dir: None,
            out: None,
            disk_cache: Some(DEFAULT_DISK_CACHE_BYTES),
            file_allocation: None,
            allow_piece_length_change: false,
            async_dns: true,
            continue_download: true,
            allow_overwrite: false,
            auto_file_renaming: true,
            always_resume: true,
            max_resume_failure_tries: 0,
            remove_control_file: false,
            mmap_threshold: None,
            enable_mmap: false,
            max_mmap_limit: None,
            no_file_allocation_limit: Some(5 * 1024 * 1024),
            secure_falloc: false,
            check_integrity: false,
            hash_check_only: false,
            bt_enable_hook_after_hash_check: true,
            bt_hash_check_seed: true,
            bt_seed_unverified: false,
            seed_time: None,
            seed_ratio: Some(1.0),
            checksum: None,
            cookie_file: None,
            cookies: None,
            bt_exclude_tracker: None,
            bt_external_ip: None,
            bt_force_encrypt: false,
            bt_require_crypto: false,
            bt_load_saved_metadata: false,
            bt_metadata_only: false,
            bt_min_crypto_level: "plain".to_string(),
            bt_request_peer_speed_limit: 50 * 1024,
            bt_save_metadata: false,
            bt_enable_web_seed: true,
            bt_max_open_files: 100,
            bt_peer_blocklist: None,
            bt_keep_alive_interval: 120,
            bt_timeout: 180,
            bt_request_timeout: 60,
            peer_connection_timeout: 20,
            peer_id_prefix: aria2_protocol::identity::DEFAULT_PEER_ID_PREFIX.to_string(),
            peer_agent: aria2_protocol::identity::DEFAULT_PEER_AGENT.to_string(),
            dht_message_timeout: 10,
            dht_refresh_check_interval: 300,
            dht_token_rotation_interval: 600,
            dht_node_contact_interval: 900,
            dht_cleanup_interval: 300,
            dht_save_interval: 1800,
            dht_bootstrap_timeout: 60,
            dht_max_concurrent_lookups: 16,
            dht_persistence_max_age: 24 * 60 * 60,
            enable_dht6: false,
            dht_listen_addr6: None,
            dht_entry_point_host: None,
            dht_entry_point_port: None,
            dht_entry_point6: None,
            dht_entry_point_host6: None,
            dht_entry_point_port6: None,
            dht_file_path6: None,
            dht_listen_addr: None,
            enable_dht: true,
            dht_listen_port: None,
            index_out: None,
            dht_entry_point: None,
            bt_tracker: None,
            bt_tracker_interval: 0,
            bt_tracker_connect_timeout: 60,
            bt_tracker_timeout: 60,
            bt_tracker_stopped_timeout: crate::constants::BT_TRACKER_STOPPED_TIMEOUT_SECS,
            enable_peer_exchange: true,
            enable_public_trackers: true,
            bt_piece_selection_strategy: crate::constants::DEFAULT_PIECE_STRATEGY.to_string(),
            bt_endgame_threshold: crate::constants::DEFAULT_BT_ENDGAME_THRESHOLD as u32,
            max_retries: crate::constants::DEFAULT_MAX_RETRIES,
            retry_wait: 0,
            http_proxy: None,
            http_proxy_user: None,
            http_proxy_passwd: None,
            all_proxy: None,
            all_proxy_user: None,
            all_proxy_passwd: None,
            https_proxy: None,
            https_proxy_user: None,
            https_proxy_passwd: None,
            ftp_proxy: None,
            ftp_proxy_user: None,
            ftp_proxy_passwd: None,
            no_proxy: None,
            dht_file_path: None,
            bt_max_peers: 55,
            bt_max_upload_slots: None,
            bt_optimistic_unchoke_interval: None,
            bt_snubbed_timeout: None,
            bt_prioritize_piece: String::new(),
            bt_detach_seed_only: false,
            enable_utp: false,
            utp_listen_port: None,
            header: Vec::new(),
            user_agent: None,
            referer: None,
            enable_http_keep_alive: true,
            enable_http_pipelining: false,
            http_accept_gzip: false,
            http_no_cache: false,
            use_head: false,
            no_want_digest_header: false,
            check_certificate: true,
            ca_certificate: None,
            certificate: None,
            private_key: None,
            min_tls_version: None,
            // Metalink
            metalink_version: None,
            metalink_language: None,
            metalink_os: None,
            metalink_location: None,
            metalink_preferred_protocol: None,
            metalink_base_uri: None,
            select_file: None,
            bt_remove_unselected_file: false,
            piece_length: None,
            metalink_enable_unique_protocol: true,
            min_split_size: Some(crate::constants::DEFAULT_MIN_SPLIT_SIZE),
            min_http_range_size: Some(crate::constants::DEFAULT_HTTP_RANGE_SIZE_FLOOR_BYTES),
            parameterized_uri: false,
            reuse_uri: true,
            uri_selector: "feedback".to_string(),
            stream_piece_selector: "default".to_string(),
            // FTP
            timeout: None,
            connect_timeout: None,
            startup_idle_time: None,
            lowest_speed_limit: None,
            ftp_pasv: true,
            ftp_type: "binary".to_string(),
            remote_time: false,
            dry_run: false,
            ftp_reuse_connection: true,
            // Download
            realtime_chunk_checksum: true,
            bt_stop_timeout: None,
            // BitTorrent extended
            disable_ipv6: false,
            listen_port: None,
            bt_enable_lpd: false,
            enable_rpc: false,
            pause: false,
            pause_metadata: false,
            force_save: false,
            save_not_found: true,
            rpc_save_upload_metadata: true,
            content_disposition_default_utf8: false,
            proxy_method: "get".to_string(),
            max_file_not_found: 0,
            // Follow options
            follow_torrent: None,
            follow_metalink: None,
            // HTTP authentication
            http_auth_challenge: false,
            http_user: None,
            http_passwd: None,
            ftp_user: None,
            ftp_passwd: None,
            ssh_host_key_md: None,
            sftp_connect_timeout: None,
            sftp_read_timeout: None,
            sftp_compression: false,
            sftp_keepalive_interval: None,
            sftp_preferred_ciphers: None,
            no_netrc: false,
            netrc_path: None,
            // Conditional GET
            conditional_get: false,
            // Event hooks
            on_download_start: None,
            on_download_complete: None,
            on_download_error: None,
            on_download_pause: None,
            on_download_stop: None,
            on_bt_download_complete: None,
        }
    }
}