Skip to main content

Crate chorrent

Crate chorrent 

Source
Expand description

Peer-to-peer and swarm file transfer over Iroh/QUIC.

Share a file or folder and get a share code; anyone with the code can download it. Files are split into 64 KiB pieces, each verified against a BLAKE3/Bao hash as it arrives, and pulled from every peer in the swarm at once. Downloaders serve what they have to each other (reseeding), and with a data dir, downloads resume after a restart.

// Seeder
let client = chorrent::Client::new().await?;
let seed = client.seed("holiday-photos/").await?;
println!("share this: {}", seed.share_code());

// Downloader (another process or machine)
let client = chorrent::Client::new().await?;
let code: chorrent::ShareCode = "chr2...".parse()?;
let download = client.download(&code, None).await?;
let mut events = download.events(); // progress, peers, ...
let done = download.finished().await?;
if let Some(path) = &done.path {
    println!("saved to {}", path.display());
}

Re-exports§

pub use error::Error;
pub use error::Result;

Modules§

error
Error types. Error is the one most callers need.

Structs§

Client
A chorrent node: one network identity that can seed and download any number of shares at once.
ClientBuilder
Settings for a Client. Start from Client::builder.
DownloadHandle
A download in progress. Dropping it cancels the download (pieces already on disk are kept, and resumable with a data dir).
DownloadOptions
Extra settings for Client::download_with.
Endpoint
Re-exported so embedding apps name the same types (keep your iroh dependency semver-compatible with chorrent’s). Controls an iroh endpoint, establishing connections with other endpoints.
FileEntry
One file in a share.
Finished
A completed, verified download.
Manifest
The list of files in a share.
NetworkStatus
How this node is connected to the network; see Client::network_status.
PeerCheck
The result of trying one peer from a share code; see Client::check_peers.
SeedHandle
A share being seeded. Seeding stops when this is stopped or dropped.
SeedOptions
Extra settings for Client::seed_with and Client::seed_reader.
ShareCode
Everything a downloader needs to find a share’s swarm and verify it.
ShareId
Identifies a share: the BLAKE3 hash of its manifest.

Enums§

Event
Something that happened during a seed or a download.
SavedTransfer
Something from a previous run that can be picked up again with Client::resume.
Transfer
Either kind of transfer, as returned by Client::resume.

Constants§

ALPN
The ALPN chorrent’s protocol uses; see Client::alpns for the full list.
PIECE_SIZE
Size of one piece, in bytes.

Type Aliases§

EndpointId
Re-exported so embedding apps name the same types (keep your iroh dependency semver-compatible with chorrent’s). The identifier for an endpoint in the (iroh) network.