Skip to main content

Crate gosh_dl

Crate gosh_dl 

Source
Expand description

§gosh-dl

A fast, safe, and reliable download engine written in Rust.

§Features

  • HTTP/HTTPS Downloads: Multi-connection segmented downloads with resume support
  • BitTorrent: Full protocol support including DHT, PEX, and LPD
  • Cross-platform: Works on Linux, macOS, and Windows
  • Memory-safe: Written in Rust with no unsafe code in core paths
  • Async: Built on Tokio for efficient concurrent downloads

§Quick Start

use gosh_dl::{DownloadEngine, EngineConfig, DownloadOptions};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create engine with default config
    let config = EngineConfig::default();
    let engine = DownloadEngine::new(config).await?;

    // Add a download
    let id = engine.add_http(
        "https://example.com/file.zip",
        DownloadOptions::default(),
    ).await?;

    // Subscribe to events
    let mut events = engine.subscribe();
    while let Ok(event) = events.recv().await {
        println!("Event: {:?}", event);
    }

    Ok(())
}

Re-exports§

pub use config::AllocationMode;
pub use config::EngineConfig;
pub use config::HttpConfig;
pub use config::TorrentConfig;
pub use engine::DownloadEngine;
pub use error::EngineError;
pub use error::NetworkErrorKind;
pub use error::ProtocolErrorKind;
pub use error::Result;
pub use error::StorageErrorKind;
pub use protocol::ProtocolError;
pub use protocol::ProtocolResult;
pub use storage::SqliteStorage;
pub use storage::MemoryStorage;
pub use storage::Segment;
pub use storage::SegmentState;
pub use storage::Storage;
pub use http::ConnectionPool;
pub use http::HttpDownloader;
pub use http::ResumeInfo;
pub use http::RetryPolicy;
pub use http::SegmentedDownload;
pub use http::ServerCapabilities;
pub use http::SpeedCalculator;

Modules§

config
Engine configuration
engine
Download Engine - Main coordinator
error
Typed error hierarchy for gosh-dl
http
HTTP Download Engine
protocol
Protocol types for gosh-dl
storage
Storage Module
torrent
BitTorrent Module

Structs§

BandwidthLimits
Current bandwidth limits (possibly from schedule)
BandwidthScheduler
Bandwidth scheduler that manages time-based limits
DownloadId
Unique identifier for a download
DownloadMetadata
Metadata about a download
DownloadOptions
Options for adding a new download
DownloadProgress
Progress information for a download
DownloadStatus
Full status of a download
GlobalStats
Global statistics
PeerInfo
Peer information (for torrents)
PriorityQueue
Priority-based download queue
PriorityQueueStats
Statistics about the priority queue
ScheduleRule
A rule for time-based bandwidth scheduling
TorrentFile
Information about a file in a torrent
TorrentInfo
Parsed torrent metadata
TorrentStatusInfo
Torrent status information embedded in DownloadStatus

Enums§

DownloadEvent
Events emitted by the download engine
DownloadKind
Type of download
DownloadPriority
Priority levels for downloads
DownloadState
Current state of a download