diff options
| author | Linus Färnstrand <linus@mullvad.net> | 2017-07-07 16:42:25 +0200 |
|---|---|---|
| committer | Linus Färnstrand <linus@mullvad.net> | 2017-07-10 09:53:14 +0200 |
| commit | d35120e6ab15ed5af350fcbbfcd0377d243eb626 (patch) | |
| tree | 4ca89a3ac89d1646376deba738d047f9fbcab98e /mullvad_daemon | |
| parent | 5e82c3b62b7bac95e27f7c7782ceed6379537643 (diff) | |
| download | mullvadvpn-d35120e6ab15ed5af350fcbbfcd0377d243eb626.tar.xz mullvadvpn-d35120e6ab15ed5af350fcbbfcd0377d243eb626.zip | |
Move state structs to own crate for sharing
Diffstat (limited to 'mullvad_daemon')
| -rw-r--r-- | mullvad_daemon/Cargo.toml | 1 | ||||
| -rw-r--r-- | mullvad_daemon/src/main.rs | 4 | ||||
| -rw-r--r-- | mullvad_daemon/src/management_interface.rs | 2 | ||||
| -rw-r--r-- | mullvad_daemon/src/states.rs | 28 |
4 files changed, 4 insertions, 31 deletions
diff --git a/mullvad_daemon/Cargo.toml b/mullvad_daemon/Cargo.toml index 165ecfd735..73c9fe40dd 100644 --- a/mullvad_daemon/Cargo.toml +++ b/mullvad_daemon/Cargo.toml @@ -20,6 +20,7 @@ jsonrpc-ws-server = { git = "https://github.com/paritytech/jsonrpc" } uuid = { version = "0.5", features = ["v4"] } lazy_static = "0.2" +mullvad_types = { path = "../mullvad_types" } talpid_core = { path = "../talpid_core" } talpid_ipc = { path = "../talpid_ipc" } diff --git a/mullvad_daemon/src/main.rs b/mullvad_daemon/src/main.rs index 1b5ab91cdc..51bf264465 100644 --- a/mullvad_daemon/src/main.rs +++ b/mullvad_daemon/src/main.rs @@ -17,16 +17,16 @@ extern crate uuid; #[macro_use] extern crate lazy_static; +extern crate mullvad_types; extern crate talpid_core; extern crate talpid_ipc; mod management_interface; -mod states; mod rpc_info; mod shutdown; use management_interface::{ManagementInterfaceServer, TunnelCommand}; -use states::{DaemonState, SecurityState, TargetState}; +use mullvad_types::states::{DaemonState, SecurityState, TargetState}; use std::io; use std::sync::{Arc, Mutex, mpsc}; diff --git a/mullvad_daemon/src/management_interface.rs b/mullvad_daemon/src/management_interface.rs index 65e6e9b788..ffba3dca0f 100644 --- a/mullvad_daemon/src/management_interface.rs +++ b/mullvad_daemon/src/management_interface.rs @@ -5,9 +5,9 @@ use jsonrpc_core::futures::{BoxFuture, Future, future, sync}; use jsonrpc_macros::pubsub; use jsonrpc_pubsub::{PubSubHandler, PubSubMetadata, Session, SubscriptionId}; use jsonrpc_ws_server; +use mullvad_types::states::{DaemonState, TargetState}; use serde; -use states::{DaemonState, TargetState}; use std::collections::HashMap; use std::collections::hash_map::Entry; diff --git a/mullvad_daemon/src/states.rs b/mullvad_daemon/src/states.rs deleted file mode 100644 index eb7520d36c..0000000000 --- a/mullvad_daemon/src/states.rs +++ /dev/null @@ -1,28 +0,0 @@ -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize)] -pub struct DaemonState { - pub state: SecurityState, - pub target_state: TargetState, -} - -/// Security state of the computer. -/// TODO(linus): There is a difference between lockdown(firewall) and tunnel functionality. The -/// firewall can be set to prevent any leaks but the tunnel is not connected. Then we are secured, -/// but disconnected. The frontend should probably reflect these states in some way. I think it -/// be reasonable to have three states, since unsecured but tunnel is up is probably an invalid -/// state. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize)] -#[serde(rename_all = "snake_case")] -pub enum SecurityState { - Unsecured, - Secured, -} - -/// Represents the state the client strives towards. -/// When in `Secured`, the client should keep the computer from leaking and try to -/// establish a VPN tunnel if it is not up. -#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash, Serialize)] -#[serde(rename_all = "snake_case")] -pub enum TargetState { - Unsecured, - Secured, -} |
