bin: boundif option

This commit is contained in:
eric
2021-12-29 09:07:25 +08:00
parent 4f8c726a73
commit 31145ab726
2 changed files with 11 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ socks-port = 1080
Direct = direct
```
More configuration examples can be found [here](https://github.com/eycorsican/leaf/blob/master/README.zh.md).
More configuration examples can be found [here](https://github.com/eycorsican/leaf/blob/master/README.zh.md). If you want more flexible control on the config options, the JSON format should be used, up-to-date examples for the JSON format could be found in the [tests](https://github.com/eycorsican/leaf/blob/master/leaf/tests), both client-side and server-side config examples are presented there.
## TUN Mode and Gateway Mode

View File

@@ -52,6 +52,11 @@ struct Args {
#[argh(option, short = 't')]
test_outbound: Option<String>,
/// bound interface, explicitly sets the OUTBOUND_INTERFACE environment variable
#[cfg(any(target_os = "macos", target_os = "linux"))]
#[argh(option, short = 'b')]
boundif: Option<String>,
/// prints version
#[argh(switch, short = 'V')]
version: bool,
@@ -75,6 +80,11 @@ fn main() {
}
}
#[cfg(any(target_os = "macos", target_os = "linux"))]
if let Some(iface) = args.boundif {
std::env::set_var("OUTBOUND_INTERFACE", &iface);
}
if let Some(tag) = args.test_outbound {
let config = leaf::config::from_file(&args.config).unwrap();
let rt = tokio::runtime::Builder::new_current_thread()