8 releases (4 breaking)

0.5.0 Jun 28, 2025
0.4.2 Mar 4, 2025
0.4.1 Feb 18, 2025
0.3.1 Jan 5, 2025
0.1.0 Oct 23, 2024

#596 in Network programming

Download history 2/week @ 2025-03-16 2/week @ 2025-03-23 4/week @ 2025-03-30 20/week @ 2025-04-06 22/week @ 2025-04-13 37/week @ 2025-04-20 15/week @ 2025-04-27 8/week @ 2025-05-04 29/week @ 2025-05-11 7/week @ 2025-05-18 2/week @ 2025-05-25 1/week @ 2025-06-01 7/week @ 2025-06-08 4/week @ 2025-06-15 89/week @ 2025-06-22 64/week @ 2025-06-29

164 downloads per month
Used in 2 crates

MIT license

165KB
3K SLoC

yosemite

License Crates.io docs.rs

yosemite is a SAMv3 client library for interacting with the I2P network.

It provides synchronous and asynchronous APIs and supports both tokio and smol.

Supported features

Usage

tokio is enabled by default:

yosemite = "0.5.0"

sync enables synchronous APIs:

yosemite = { version = "0.5.0", default-features = false, features = ["sync"] }

smol enables asynchronous APIs implemented with smol:

yosemite = { version = "0.5.0", default-features = false, features = ["smol"] }

tokio, smol, and sync are all mutually exclusive and only one them can be enabled. The APIs are otherwise the same but tokio and smol require blocking calls to .await.

Example usage of the API:

use tokio::io::AsyncReadExt;
use yosemite::{style::Stream, Session};

#[tokio::main]
async fn main() -> yosemite::Result<()> {
    let mut session = Session::<Stream>::new(Default::default()).await?;

    while let Ok(mut stream) = session.accept().await {
        println!("{} connected", stream.remote_destination());

        tokio::spawn(async move {
            let mut buffer = vec![0u8; 512];

            while let Ok(nread) = stream.read(&mut buffer).await {
                println!(
                    "client sent: {:?}",
                    std::str::from_utf8(&buffer[..nread])
                );
            }
        });
    }

    Ok(())
}

See examples for instructions on how to use yosemite.

Copying

MIT

Dependencies

~4–15MB
~194K SLoC