Files
tuwunel/src/router/mod.rs
June Strawberry 2f4d3c2851 fix some unused_crate_dependencies lint warns
Signed-off-by: June Strawberry <june@vern.cc>
2026-01-18 13:18:10 -05:00

52 lines
1.1 KiB
Rust

#![type_length_limit = "32768"] //TODO: reduce me
mod layers;
mod request;
mod router;
mod run;
mod serve;
use std::{panic::AssertUnwindSafe, pin::Pin, sync::Arc};
use futures::{Future, FutureExt, TryFutureExt};
use log as _;
use tuwunel_core::{Error, Result, Server};
use tuwunel_service::Services;
tuwunel_core::mod_ctor! {}
tuwunel_core::mod_dtor! {}
tuwunel_core::rustc_flags_capture! {}
#[unsafe(no_mangle)]
pub extern "Rust" fn start(
server: &Arc<Server>,
) -> Pin<Box<dyn Future<Output = Result<Arc<Services>>> + Send>> {
AssertUnwindSafe(run::start(server.clone()))
.catch_unwind()
.map_err(Error::from_panic)
.unwrap_or_else(Err)
.boxed()
}
#[unsafe(no_mangle)]
pub extern "Rust" fn stop(
services: Arc<Services>,
) -> Pin<Box<dyn Future<Output = Result> + Send>> {
AssertUnwindSafe(run::stop(services))
.catch_unwind()
.map_err(Error::from_panic)
.unwrap_or_else(Err)
.boxed()
}
#[unsafe(no_mangle)]
pub extern "Rust" fn run(
services: &Arc<Services>,
) -> Pin<Box<dyn Future<Output = Result> + Send>> {
AssertUnwindSafe(run::run(services.clone()))
.catch_unwind()
.map_err(Error::from_panic)
.unwrap_or_else(Err)
.boxed()
}