summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-06-10 14:03:24 +0200
committerLinus Färnstrand <linus@mullvad.net>2017-06-12 08:38:01 +0200
commit4072cacc9d4f140a123c1aed158905e46d29ffc0 (patch)
treeca11d884681c795188a9ad32794147b99a419ea4
parent3ef19119bfd03d0f3d12f8586dfd6a0569972e53 (diff)
downloadmullvadvpn-4072cacc9d4f140a123c1aed158905e46d29ffc0.tar.xz
mullvadvpn-4072cacc9d4f140a123c1aed158905e46d29ffc0.zip
Add daemon states structs
-rw-r--r--mullvad_daemon/src/states.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/mullvad_daemon/src/states.rs b/mullvad_daemon/src/states.rs
new file mode 100644
index 0000000000..e50015c53b
--- /dev/null
+++ b/mullvad_daemon/src/states.rs
@@ -0,0 +1,21 @@
+/// 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, Eq, PartialEq)]
+pub enum TargetState {
+ Unsecured,
+ Secured,
+}