#[global_allocator]
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
mod commands;
mod middleware;
use anyhow::Result;
use clap::{Parser, Subcommand};
#[derive(Parser)]
#[command(
name = "ferrotunnel",
author,
version,
about = "Secure, high-performance reverse tunnel system",
long_about = "FerroTunnel is a secure, high-performance reverse tunnel system in Rust.\n\n\
It can be used as a CLI tool or embedded directly into your applications.",
propagate_version = true
)]
struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
Server(commands::server::ServerArgs),
Client(commands::client::ClientArgs),
Version,
}
#[tokio::main]
async fn main() -> Result<()> {
let _ = rustls::crypto::ring::default_provider().install_default();
let cli = Cli::parse();
match cli.command {
Commands::Server(args) => commands::server::run(args).await,
Commands::Client(args) => commands::client::run(args).await,
Commands::Version => {
commands::version::run();
Ok(())
}
}
}