Skip to main content

ios_core/tunnel/
mod.rs

1//! CDTunnel handshake, TUN device abstraction, and packet forwarding.
2
3#[cfg(feature = "tunnel")]
4pub mod forward;
5#[cfg(feature = "tunnel")]
6pub mod handshake;
7pub mod manager;
8#[cfg(feature = "tunnel")]
9pub mod tun;
10
11#[cfg(feature = "tunnel")]
12pub use handshake::TunnelInfo;
13#[cfg(not(feature = "tunnel"))]
14#[derive(Debug, Clone)]
15pub struct TunnelInfo {
16    pub server_address: String,
17    pub server_rsd_port: u16,
18    pub client_address: String,
19    pub client_mtu: u32,
20}
21pub use manager::{TunMode, TunnelHandle, TunnelManager};
22
23/// Errors from tunnel operations.
24#[derive(Debug, thiserror::Error)]
25pub enum TunnelError {
26    #[error("IO error: {0}")]
27    Io(#[from] std::io::Error),
28    #[error("protocol error: {0}")]
29    Protocol(String),
30    #[error("TUN device error: {0}")]
31    TunDevice(String),
32}