summaryrefslogtreecommitdiffhomepage
path: root/talpid_cli/src
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-03-07 12:59:32 +0100
committerLinus Färnstrand <linus@mullvad.net>2017-03-07 12:59:32 +0100
commitb7e6675c663e23e6cbaa150b2540152e508684ed (patch)
treedaa6a7b4dc5779ff21d7b69d3cde26908bcb8c5d /talpid_cli/src
parent79836cdcddff32feb1c30e0e7035f94ffc16053f (diff)
downloadmullvadvpn-b7e6675c663e23e6cbaa150b2540152e508684ed.tar.xz
mullvadvpn-b7e6675c663e23e6cbaa150b2540152e508684ed.zip
Make path to plugin configurable
Diffstat (limited to 'talpid_cli/src')
-rw-r--r--talpid_cli/src/cli.rs14
-rw-r--r--talpid_cli/src/main.rs2
2 files changed, 15 insertions, 1 deletions
diff --git a/talpid_cli/src/cli.rs b/talpid_cli/src/cli.rs
index d6d5899846..765180379a 100644
--- a/talpid_cli/src/cli.rs
+++ b/talpid_cli/src/cli.rs
@@ -3,8 +3,17 @@ use std::path::PathBuf;
use talpid_core::net::RemoteAddr;
+#[cfg(all(unix, not(target_os="macos")))]
+static DEFAULT_PLUGIN_PATH: &'static str = "./target/debug/libtalpid_openvpn_plugin.so";
+#[cfg(target_os="macos")]
+static DEFAULT_PLUGIN_PATH: &'static str = "./target/debug/libtalpid_openvpn_plugin.dylib";
+#[cfg(windows)]
+static DEFAULT_PLUGIN_PATH: &'static str = "./target/debug/libtalpid_openvpn_plugin.dll";
+
+
pub struct Args {
pub binary: String,
+ pub plugin_path: PathBuf,
pub config: PathBuf,
pub remotes: Vec<RemoteAddr>,
pub verbosity: u64,
@@ -15,6 +24,7 @@ pub fn parse_args_or_exit() -> Args {
let remotes = values_t!(matches.values_of("remotes"), RemoteAddr).unwrap_or_else(|e| e.exit());
Args {
binary: matches.value_of("openvpn").unwrap().to_owned(),
+ plugin_path: PathBuf::from(matches.value_of("plugin").unwrap()),
config: PathBuf::from(matches.value_of("config").unwrap()),
remotes: remotes,
verbosity: matches.occurrences_of("verbose"),
@@ -48,6 +58,10 @@ fn create_app() -> App<'static, 'static> {
.takes_value(true)
.multiple(true)
.required(true))
+ .arg(Arg::with_name("plugin")
+ .long("plugin")
+ .help("Path to talpid plugin")
+ .default_value(DEFAULT_PLUGIN_PATH))
.arg(Arg::with_name("verbose")
.short("v")
.long("verbose")
diff --git a/talpid_cli/src/main.rs b/talpid_cli/src/main.rs
index ae8be2eed5..9bb7cfdc96 100644
--- a/talpid_cli/src/main.rs
+++ b/talpid_cli/src/main.rs
@@ -49,7 +49,7 @@ fn run() -> Result<()> {
init_logger()?;
let args = cli::parse_args_or_exit();
let command = create_openvpn_command(&args);
- let monitor = OpenVpnMonitor::new(command);
+ let monitor = OpenVpnMonitor::new(command, args.plugin_path);
main_loop(monitor)
}