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;
11mod process;
12mod remote;
13
14pub use binary::{BuildProfile, FreenetBinary};
15pub use builder::NetworkBuilder;
16pub use logs::LogEntry;
17pub use network::{
18    ring_nodes_from_diagnostics, write_ring_visualization_from_diagnostics,
19    NetworkDiagnosticsSnapshot, NetworkTopology, PeerDiagnosticsSnapshot, RingPeerSnapshot,
20    RingVizMetrics, TestNetwork,
21};
22pub use peer::TestPeer;
23pub use remote::{PeerLocation, RemoteMachine};
24
25/// Result type used throughout this crate
26pub type Result<T> = std::result::Result<T, Error>;
27
28/// Errors that can occur when managing test networks
29#[derive(Debug, thiserror::Error)]
30pub enum Error {
31    #[error("Failed to start peer: {0}")]
32    PeerStartupFailed(String),
33
34    #[error("Network connectivity check failed: {0}")]
35    ConnectivityFailed(String),
36
37    #[error("Binary not found or invalid: {0}")]
38    InvalidBinary(String),
39
40    #[error("Port allocation failed: {0}")]
41    PortAllocationFailed(String),
42
43    #[error("IO error: {0}")]
44    Io(#[from] std::io::Error),
45
46    #[error("Other error: {0}")]
47    Other(#[from] anyhow::Error),
48}