mirror of
https://github.com/tun2proxy/tun2proxy.git
synced 2025-06-07 23:27:46 +00:00
Make setup argument optional
This commit is contained in:
parent
d0c24b9f6a
commit
2a2b188c75
2 changed files with 9 additions and 8 deletions
|
@ -71,6 +71,7 @@ Options:
|
||||||
-t, --tun <name> Name of the tun interface [default: tun0]
|
-t, --tun <name> Name of the tun interface [default: tun0]
|
||||||
-p, --proxy <URL> Proxy URL in the form proto://[username[:password]@]host:port
|
-p, --proxy <URL> Proxy URL in the form proto://[username[:password]@]host:port
|
||||||
-d, --dns <method> DNS handling [default: virtual] [possible values: virtual, none]
|
-d, --dns <method> DNS handling [default: virtual] [possible values: virtual, none]
|
||||||
|
-s, --setup <method> Routing and system setup [possible values: auto]
|
||||||
-h, --help Print help
|
-h, --help Print help
|
||||||
-V, --version Print version
|
-V, --version Print version
|
||||||
```
|
```
|
||||||
|
|
|
@ -28,9 +28,9 @@ struct Args {
|
||||||
)]
|
)]
|
||||||
dns: ArgDns,
|
dns: ArgDns,
|
||||||
|
|
||||||
/// Setup
|
/// Routing and system setup
|
||||||
#[arg(short, long, value_name = "method", value_enum)]
|
#[arg(short, long, value_name = "method", value_enum)]
|
||||||
setup: ArgSetup,
|
setup: Option<ArgSetup>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)]
|
#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, clap::ValueEnum)]
|
||||||
|
@ -59,7 +59,7 @@ fn main() -> ExitCode {
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut setup: Setup;
|
let mut setup: Setup;
|
||||||
if args.setup == ArgSetup::Auto {
|
if args.setup == Some(ArgSetup::Auto) {
|
||||||
setup = Setup::new(&args.tun, &args.proxy.addr.ip(), get_default_cidrs());
|
setup = Setup::new(&args.tun, &args.proxy.addr.ip(), get_default_cidrs());
|
||||||
if let Err(e) = setup.setup() {
|
if let Err(e) = setup.setup() {
|
||||||
log::error!("{e}");
|
log::error!("{e}");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue