| Crates.io | fastn-net |
| lib.rs | fastn-net |
| version | 0.1.2 |
| created_at | 2025-08-15 09:25:52.266904+00 |
| updated_at | 2025-08-15 12:17:47.125989+00 |
| description | Network utilities for fastn |
| homepage | https://fastn.com |
| repository | |
| max_upload_size | |
| id | 1796499 |
| size | 179,871 |
Network utilities and P2P communication for the fastn ecosystem.
fastn-net provides P2P networking capabilities for fastn entities using Iroh. Each fastn instance is called an "entity" in the P2P network, identified by a unique ID52 (52-character encoded Ed25519 public key).
[dependencies]
fastn-net = "0.1"
use fastn_net::{global_iroh_endpoint, ping};
// Get the global Iroh endpoint for entity connections
let endpoint = global_iroh_endpoint().await;
// Connect to another entity
let connection = endpoint.connect(entity_node_addr, b"").await?;
// Test connectivity with ping
ping(&connection).await?;
use fastn_net::Graceful;
let graceful = Graceful::new();
// Spawn tracked tasks
graceful.spawn(async move {
// Your async work here
Ok::<(), eyre::Error>(())
});
// Shutdown gracefully on Ctrl+C
graceful.shutdown().await?;
Protocol::Ping - Connectivity testingProtocol::Http - HTTP request proxyingProtocol::Tcp - TCP tunnelingProtocol::Socks5 - SOCKS5 proxyProtocol::HttpProxy - HTTP proxy protocolUPL-1.0