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