Add Start Command

Command that will start burrow.
This commit is contained in:
Sam Poder 2023-06-06 15:50:22 +00:00 committed by Cara Salter
parent e8704a2560
commit a73228cee0

View file

@ -1,4 +1,4 @@
use clap::Parser; use clap::{Args, Parser, Subcommand};
use tokio::io::Result; use tokio::io::Result;
use tun::TunInterface; use tun::TunInterface;
@ -8,7 +8,19 @@ use tun::TunInterface;
#[command(version = "0.1")] #[command(version = "0.1")]
#[command(about = "Burrow is a tool for burrowing through firewalls, built by teenagers at Hack Club.", long_about = None)] #[command(about = "Burrow is a tool for burrowing through firewalls, built by teenagers at Hack Club.", long_about = None)]
struct Cli {} struct Cli {
#[command(subcommand)]
command: Commands,
}
#[derive(Subcommand)]
enum Commands {
/// Adds files to myapp
Start(StartArgs),
}
#[derive(Args)]
struct StartArgs {}
async fn try_main() -> Result<()> { async fn try_main() -> Result<()> {
let iface = TunInterface::new()?; let iface = TunInterface::new()?;
@ -19,6 +31,10 @@ async fn try_main() -> Result<()> {
#[tokio::main(flavor = "current_thread")] #[tokio::main(flavor = "current_thread")]
async fn main() { async fn main() {
let _cli = Cli::parse(); let cli = Cli::parse();
match &cli.command {
Commands::Start(..) => {
try_main().await.unwrap(); try_main().await.unwrap();
}
}
} }