mockforge_tunnel/
lib.rs

1//! MockForge Tunneling Service
2//!
3//! Provides functionality to expose local MockForge servers via public URLs
4//! without requiring cloud deployment. Supports multiple tunneling backends
5//! and provides a unified API for tunnel management.
6
7#[cfg(feature = "server")]
8pub mod audit;
9pub mod client;
10pub mod config;
11pub mod manager;
12pub mod provider;
13#[cfg(feature = "server")]
14pub mod rate_limit;
15#[cfg(feature = "server")]
16pub mod server;
17#[cfg(feature = "server")]
18pub mod server_config;
19#[cfg(feature = "server")]
20pub mod storage;
21
22pub use client::TunnelClient;
23pub use config::{TunnelConfig, TunnelProvider};
24pub use manager::TunnelManager;
25pub use provider::{TunnelProvider as ProviderTrait, TunnelStatus};
26
27/// Result type for tunnel operations
28pub type Result<T> = std::result::Result<T, TunnelError>;
29
30/// Error type for tunnel operations
31#[derive(Debug, thiserror::Error)]
32pub enum TunnelError {
33    #[error("Tunnel connection failed: {0}")]
34    ConnectionFailed(String),
35
36    #[error("Tunnel provider error: {0}")]
37    ProviderError(String),
38
39    #[error("Configuration error: {0}")]
40    ConfigError(String),
41
42    #[error("Tunnel not found: {0}")]
43    NotFound(String),
44
45    #[error("Tunnel already exists: {0}")]
46    AlreadyExists(String),
47
48    #[error("HTTP error: {0}")]
49    Http(#[from] reqwest::Error),
50
51    #[error("URL parsing error: {0}")]
52    Url(#[from] url::ParseError),
53
54    #[error("Serialization error: {0}")]
55    Serialization(#[from] serde_json::Error),
56
57    #[error("IO error: {0}")]
58    Io(#[from] std::io::Error),
59}