freenet_test_network/
lib.rs

1//! Reliable test network infrastructure for Freenet
2//!
3//! This crate provides tools for spinning up and managing local Freenet test networks
4//! for integration testing.
5
6mod binary;
7mod builder;
8mod logs;
9mod network;
10mod peer;
11
12pub use binary::{BuildProfile, FreenetBinary};
13pub use builder::NetworkBuilder;
14pub use logs::LogEntry;
15pub use network::{NetworkTopology, TestNetwork};
16pub use peer::TestPeer;
17
18/// Result type used throughout this crate
19pub type Result<T> = std::result::Result<T, Error>;
20
21/// Errors that can occur when managing test networks
22#[derive(Debug, thiserror::Error)]
23pub enum Error {
24    #[error("Failed to start peer: {0}")]
25    PeerStartupFailed(String),
26
27    #[error("Network connectivity check failed: {0}")]
28    ConnectivityFailed(String),
29
30    #[error("Binary not found or invalid: {0}")]
31    InvalidBinary(String),
32
33    #[error("Port allocation failed: {0}")]
34    PortAllocationFailed(String),
35
36    #[error("IO error: {0}")]
37    Io(#[from] std::io::Error),
38
39    #[error("Other error: {0}")]
40    Other(#[from] anyhow::Error),
41}