Skip to main content

Module tunnel

Module tunnel 

Source
Expand description

TUN tunnel loop — intercepts all TCP flows and relays them through the proxy chain.

§Architecture

A dedicated OS thread runs the smoltcp poll loop (because TunTapInterface is not Send). For every new TCP connection that appears on the TUN device, the poll loop spawns an async relay task via a Tokio Handle.

Data flows between the poll loop and relay tasks through tokio::sync::mpsc channels:

TUN fd  ──packets──►  IpDevice  ──►  smoltcp::Interface::poll()
                                            │
                         ┌──────────────────┘
                         │  per-flow mpsc channels
                         ▼
                    relay_flow()  ──►  ChainEngine::connect()  ──►  proxy

Re-exports§

pub use crate::chain::ChainConfig;

Structs§

ProxyChainTunnel
Intercepts all TCP flows arriving on a TUN device and relays them through the configured proxy chain.
TunnelConfig
Configuration for ProxyChainTunnel.