diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2018-01-18 14:26:52 +0100 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2018-01-18 14:26:52 +0100 |
| commit | 83e6c88894aa285e47d0b236299efcdf586cb1c3 (patch) | |
| tree | 5a579c6e1b741a6c903ec187d1bd2ea54c5feda4 | |
| parent | b9fb88ef05d839c924b3a958e0f374047c0f0e0b (diff) | |
| parent | 6a48df14bc2e6a17adc5e8d8a3d38216bceb6f56 (diff) | |
| download | mullvadvpn-83e6c88894aa285e47d0b236299efcdf586cb1c3.tar.xz mullvadvpn-83e6c88894aa285e47d0b236299efcdf586cb1c3.zip | |
Merge branch 'add-resource-flag'
| -rw-r--r-- | CHANGELOG.md | 2 | ||||
| -rw-r--r-- | README.md | 2 | ||||
| -rw-r--r-- | mullvad-daemon/src/cli.rs | 12 | ||||
| -rw-r--r-- | mullvad-daemon/src/main.rs | 8 |
4 files changed, 19 insertions, 5 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index fa60a301b5..98fc001bb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/). ### Added - Uses the https://am.i.mullvad.net/ service to figure out location and public IP of the device. The app then shows this information in the unsecured state. +- Argument to the daemon, `--resource-dir <path>`, that allows customizing where it will look for + needed resource files. ### Fixed - Fixed bug where problem report tool would redact some things in the logs which were not IPv6 @@ -36,7 +36,7 @@ homebrew: 1. Run the backend daemon debug binary with verbose logging to the terminal with: ``` - sudo ./target/debug/mullvad-daemon -vv + sudo ./target/debug/mullvad-daemon -vv --resource-dir dist-assets/ ``` It must run as root since it it modifies the firewall and sets up virtual network interfaces etc. diff --git a/mullvad-daemon/src/cli.rs b/mullvad-daemon/src/cli.rs index b4f7506692..676337bcb3 100644 --- a/mullvad-daemon/src/cli.rs +++ b/mullvad-daemon/src/cli.rs @@ -7,6 +7,7 @@ pub struct Config { pub log_level: log::LogLevelFilter, pub log_file: Option<PathBuf>, pub tunnel_log_file: Option<PathBuf>, + pub resource_dir: Option<PathBuf>, } pub fn get_config() -> Config { @@ -20,11 +21,13 @@ pub fn get_config() -> Config { }; let log_file = matches.value_of_os("log_file").map(PathBuf::from); let tunnel_log_file = matches.value_of_os("tunnel_log_file").map(PathBuf::from); + let resource_dir = matches.value_of_os("resource_dir").map(PathBuf::from); Config { log_level, log_file, tunnel_log_file, + resource_dir, } } @@ -43,12 +46,21 @@ fn create_app() -> App<'static, 'static> { Arg::with_name("log_file") .long("log") .takes_value(true) + .value_name("PATH") .help("Activates file logging to the given path"), ) .arg( Arg::with_name("tunnel_log_file") .long("tunnel-log") .takes_value(true) + .value_name("PATH") .help("Save log from tunnel implementation process to this file path"), ) + .arg( + Arg::with_name("resource_dir") + .long("resource-dir") + .takes_value(true) + .value_name("DIR") + .help("Uses the given directory to read needed resources, such as certificates."), + ) } diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs index 0668d09b6e..561c0c0b52 100644 --- a/mullvad-daemon/src/main.rs +++ b/mullvad-daemon/src/main.rs @@ -202,9 +202,7 @@ struct Daemon { } impl Daemon { - pub fn new(tunnel_log: Option<PathBuf>) -> Result<Self> { - let resource_dir = get_resource_dir(); - + pub fn new(tunnel_log: Option<PathBuf>, resource_dir: PathBuf) -> Result<Self> { let (rpc_handle, http_handle, tokio_remote) = mullvad_rpc::event_loop::create(|core| { let handle = core.handle(); @@ -754,7 +752,9 @@ fn run() -> Result<()> { init_logger(config.log_level, config.log_file.as_ref())?; log_version(); - let daemon = Daemon::new(config.tunnel_log_file).chain_err(|| "Unable to initialize daemon")?; + let resource_dir = config.resource_dir.unwrap_or_else(|| get_resource_dir()); + let daemon = Daemon::new(config.tunnel_log_file, resource_dir) + .chain_err(|| "Unable to initialize daemon")?; let shutdown_handle = daemon.shutdown_handle(); shutdown::set_shutdown_signal_handler(move || shutdown_handle.shutdown()) |
