mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-23 01:20:52 +00:00
Restore network configuration on Drop
This commit is contained in:
parent
e4d4e0965e
commit
4a48b297f3
3 changed files with 21 additions and 11 deletions
|
@ -1,6 +1,6 @@
|
|||
use clap::Parser;
|
||||
use env_logger::Env;
|
||||
use std::process::exit;
|
||||
use std::process::ExitCode;
|
||||
|
||||
use tun2proxy::setup::{get_default_cidrs, Setup};
|
||||
use tun2proxy::Options;
|
||||
|
@ -44,7 +44,7 @@ enum ArgSetup {
|
|||
Auto,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fn main() -> ExitCode {
|
||||
dotenvy::dotenv().ok();
|
||||
env_logger::Builder::from_env(Env::default().default_filter_or("info")).init();
|
||||
let args = Args::parse();
|
||||
|
@ -63,12 +63,13 @@ fn main() {
|
|||
setup = Setup::new(&args.tun, &args.proxy.addr.ip(), get_default_cidrs());
|
||||
if let Err(e) = setup.setup() {
|
||||
log::error!("{e}");
|
||||
exit(1);
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
if let Err(e) = main_entry(&args.tun, args.proxy, options) {
|
||||
log::error!("{e}");
|
||||
exit(1);
|
||||
return ExitCode::FAILURE;
|
||||
}
|
||||
ExitCode::SUCCESS
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue