pub struct ProxyChainTunnel { /* private fields */ }Expand description
Intercepts all TCP flows arriving on a TUN device and relays them through the configured proxy chain.
Implementations§
Source§impl ProxyChainTunnel
impl ProxyChainTunnel
Sourcepub fn new(config: TunnelConfig) -> Self
pub fn new(config: TunnelConfig) -> Self
Create a new tunnel with the given configuration.
Sourcepub fn spawn(self, tun_file: File, rt: Handle) -> JoinHandle<Result<()>>
pub fn spawn(self, tun_file: File, rt: Handle) -> JoinHandle<Result<()>>
Spawn the blocking poll loop on a new OS thread and return immediately.
tun_file must be a File wrapping the TUN device fd with O_NONBLOCK set.
The returned thread::JoinHandle can be used to detect if the loop exits unexpectedly.
Sourcepub async fn run(self, tun_file: File) -> Result<()>
pub async fn run(self, tun_file: File) -> Result<()>
Run the tunnel loop on an async task, blocking the current async context until the tunnel exits.
The blocking work runs on a dedicated OS thread (not the Tokio thread pool)
so that the non-Send smoltcp state stays on its own thread.
§Errors
Propagates any error returned by the poll loop.
Auto Trait Implementations§
impl Freeze for ProxyChainTunnel
impl RefUnwindSafe for ProxyChainTunnel
impl Send for ProxyChainTunnel
impl Sync for ProxyChainTunnel
impl Unpin for ProxyChainTunnel
impl UnsafeUnpin for ProxyChainTunnel
impl UnwindSafe for ProxyChainTunnel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more