summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2019-01-19 12:39:01 +0100
committerLinus Färnstrand <linus@mullvad.net>2019-01-19 12:39:01 +0100
commit4af49286bd7774e189fe11ae9c0784994141bf35 (patch)
treed4408ece411417070eb69d41689ce538dbb28fc4
parent801612b89a7ea7f093b44c8a7028cde54ac31230 (diff)
parent4600484823c365a19583069984a83078c58403d2 (diff)
downloadmullvadvpn-4af49286bd7774e189fe11ae9c0784994141bf35.tar.xz
mullvadvpn-4af49286bd7774e189fe11ae9c0784994141bf35.zip
Merge branch 'upgrade-jsonrpc-macro-to-rust2018'
-rw-r--r--Cargo.lock52
-rw-r--r--mullvad-daemon/Cargo.toml9
-rw-r--r--mullvad-daemon/build.rs5
-rw-r--r--mullvad-daemon/src/account_history.rs5
-rw-r--r--mullvad-daemon/src/lib.rs23
-rw-r--r--mullvad-daemon/src/logging.rs8
-rw-r--r--mullvad-daemon/src/main.rs11
-rw-r--r--mullvad-daemon/src/shutdown.rs6
-rw-r--r--mullvad-daemon/src/system_service.rs4
-rw-r--r--talpid-core/Cargo.toml5
-rw-r--r--talpid-core/src/lib.rs33
-rw-r--r--talpid-core/src/offline/linux.rs23
-rw-r--r--talpid-core/src/offline/macos.rs13
-rw-r--r--talpid-core/src/offline/mod.rs2
-rw-r--r--talpid-core/src/offline/windows.rs24
-rw-r--r--talpid-core/src/process/openvpn.rs11
-rw-r--r--talpid-core/src/security/linux/dns/mod.rs8
-rw-r--r--talpid-core/src/security/linux/dns/network_manager.rs12
-rw-r--r--talpid-core/src/security/linux/dns/static_resolv_conf.rs13
-rw-r--r--talpid-core/src/security/linux/dns/systemd_resolved.rs14
-rw-r--r--talpid-core/src/security/linux/mod.rs14
-rw-r--r--talpid-core/src/security/macos/dns.rs24
-rw-r--r--talpid-core/src/security/macos/mod.rs7
-rw-r--r--talpid-core/src/security/windows/mod.rs14
-rw-r--r--talpid-core/src/security/windows/system_state.rs2
-rw-r--r--talpid-core/src/tunnel/mod.rs6
-rw-r--r--talpid-core/src/tunnel/openvpn.rs24
-rw-r--r--talpid-core/src/tunnel_state_machine/macros.rs6
-rw-r--r--talpid-ipc/Cargo.toml9
-rw-r--r--talpid-ipc/src/lib.rs11
-rw-r--r--talpid-ipc/tests/ipc-client-server.rs12
31 files changed, 134 insertions, 276 deletions
diff --git a/Cargo.lock b/Cargo.lock
index efc89afafe..e0402856c3 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -718,7 +718,7 @@ dependencies = [
[[package]]
name = "jsonrpc-core"
version = "8.0.2"
-source = "git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux#40344ea49836a6a0040c49c927610608bd3c4a8a"
+source = "git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork#9de0ea1ad4c296465f44f53050d99459ca885157"
dependencies = [
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -730,11 +730,11 @@ dependencies = [
[[package]]
name = "jsonrpc-ipc-server"
version = "8.0.1"
-source = "git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux#40344ea49836a6a0040c49c927610608bd3c4a8a"
+source = "git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork#9de0ea1ad4c296465f44f53050d99459ca885157"
dependencies = [
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
- "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-server-utils 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
+ "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-server-utils 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parity-tokio-ipc 0.1.0 (git+https://github.com/nikvolf/parity-tokio-ipc)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -745,19 +745,19 @@ dependencies = [
[[package]]
name = "jsonrpc-macros"
version = "8.0.1"
-source = "git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux#40344ea49836a6a0040c49c927610608bd3c4a8a"
+source = "git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork#9de0ea1ad4c296465f44f53050d99459ca885157"
dependencies = [
- "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-pubsub 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
+ "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-pubsub 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "jsonrpc-pubsub"
version = "8.0.1"
-source = "git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux#40344ea49836a6a0040c49c927610608bd3c4a8a"
+source = "git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork#9de0ea1ad4c296465f44f53050d99459ca885157"
dependencies = [
- "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
+ "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"parking_lot 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -778,11 +778,11 @@ dependencies = [
[[package]]
name = "jsonrpc-server-utils"
version = "8.0.1"
-source = "git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux#40344ea49836a6a0040c49c927610608bd3c4a8a"
+source = "git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork#9de0ea1ad4c296465f44f53050d99459ca885157"
dependencies = [
"bytes 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"globset 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
+ "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-core 0.1.17 (registry+https://github.com/rust-lang/crates.io-index)",
"tokio-io 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1019,10 +1019,10 @@ dependencies = [
"error-chain 0.12.0 (registry+https://github.com/rust-lang/crates.io-index)",
"fern 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
- "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-ipc-server 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-macros 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-pubsub 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
+ "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-ipc-server 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-macros 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-pubsub 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1819,8 +1819,8 @@ dependencies = [
"hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)",
"ipnetwork 0.13.1 (registry+https://github.com/rust-lang/crates.io-index)",
"iproute2 0.0.2 (git+https://github.com/mullvad/netlink?branch=best-effort-nla-parsing)",
- "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-macros 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
+ "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-macros 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.2.44 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1858,10 +1858,10 @@ dependencies = [
"futures 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)",
"jsonrpc-client-core 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=e9dbdc80)",
"jsonrpc-client-ipc 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=e9dbdc80)",
- "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-ipc-server 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-macros 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
- "jsonrpc-pubsub 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)",
+ "jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-ipc-server 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-macros 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
+ "jsonrpc-pubsub 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)",
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.80 (registry+https://github.com/rust-lang/crates.io-index)",
"serde_json 1.0.32 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -2489,12 +2489,12 @@ dependencies = [
"checksum jsonrpc-client-http 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "2e642eb74423b9dfcb4512fda167148746b76f788a823cd712fadf409f31d302"
"checksum jsonrpc-client-ipc 0.5.0 (git+https://github.com/mullvad/jsonrpc-client-rs?rev=e9dbdc80)" = "<none>"
"checksum jsonrpc-core 8.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "ddf83704f4e79979a424d1082dd2c1e52683058056c9280efa19ac5f6bc9033c"
-"checksum jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)" = "<none>"
-"checksum jsonrpc-ipc-server 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)" = "<none>"
-"checksum jsonrpc-macros 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)" = "<none>"
-"checksum jsonrpc-pubsub 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)" = "<none>"
+"checksum jsonrpc-core 8.0.2 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)" = "<none>"
+"checksum jsonrpc-ipc-server 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)" = "<none>"
+"checksum jsonrpc-macros 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)" = "<none>"
+"checksum jsonrpc-pubsub 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)" = "<none>"
"checksum jsonrpc-server-utils 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "513e981828a4953ea7ddbb64c24d15d4983ecf6900dc1cd36f257d61c27138d5"
-"checksum jsonrpc-server-utils 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=make-ipc-server-concurrent-part-deux)" = "<none>"
+"checksum jsonrpc-server-utils 8.0.1 (git+https://github.com/mullvad/jsonrpc?branch=mullvad-fork)" = "<none>"
"checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d"
"checksum language-tags 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "a91d884b6667cd606bb5a69aa0c99ba811a115fc68915e7056ec08a46e93199a"
"checksum lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "a374c89b9db55895453a74c1e38861d9deec0b01b405a82516e9d5de4820dea1"
diff --git a/mullvad-daemon/Cargo.toml b/mullvad-daemon/Cargo.toml
index 30821aa4d7..91592fc1e8 100644
--- a/mullvad-daemon/Cargo.toml
+++ b/mullvad-daemon/Cargo.toml
@@ -11,6 +11,7 @@ authors = [
]
description = "Mullvad VPN daemon. Runs and controls the VPN tunnels"
license = "GPL-3.0"
+edition = "2018"
[dependencies]
chrono = { version = "0.4", features = ["serde"] }
@@ -22,10 +23,10 @@ serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
log = "0.4"
log-panics = "2.0.0"
-jsonrpc-core = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
-jsonrpc-macros = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
-jsonrpc-pubsub = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
-jsonrpc-ipc-server = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
+jsonrpc-core = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
+jsonrpc-macros = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
+jsonrpc-pubsub = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
+jsonrpc-ipc-server = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
uuid = { version = "0.6", features = ["v4"] }
lazy_static = "1.0"
rand = "0.5"
diff --git a/mullvad-daemon/build.rs b/mullvad-daemon/build.rs
index 39cac1707d..09181c1013 100644
--- a/mullvad-daemon/build.rs
+++ b/mullvad-daemon/build.rs
@@ -1,10 +1,5 @@
use std::{env, fs, path::PathBuf, process::Command};
-#[cfg(windows)]
-extern crate winapi;
-#[cfg(windows)]
-extern crate winres;
-
fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
diff --git a/mullvad-daemon/src/account_history.rs b/mullvad-daemon/src/account_history.rs
index a3820add44..de57b60d3f 100644
--- a/mullvad-daemon/src/account_history.rs
+++ b/mullvad-daemon/src/account_history.rs
@@ -1,13 +1,10 @@
-extern crate serde_json;
-
+use mullvad_types::account::AccountToken;
use std::{
fs::File,
io,
path::{Path, PathBuf},
};
-use mullvad_types::account::AccountToken;
-
error_chain! {
errors {
ReadError(path: PathBuf) {
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs
index d3ae39676a..63dee4e536 100644
--- a/mullvad-daemon/src/lib.rs
+++ b/mullvad-daemon/src/lib.rs
@@ -6,34 +6,11 @@
//! GNU General Public License as published by the Free Software Foundation, either version 3 of
//! the License, or (at your option) any later version.
-extern crate chrono;
#[macro_use]
extern crate error_chain;
-extern crate futures;
-#[cfg(unix)]
-extern crate libc;
-extern crate log;
-
#[macro_use]
extern crate serde;
-extern crate serde_json;
-
-extern crate jsonrpc_core;
-extern crate jsonrpc_ipc_server;
-extern crate jsonrpc_macros;
-extern crate jsonrpc_pubsub;
-extern crate rand;
-extern crate tokio_core;
-extern crate tokio_timer;
-extern crate uuid;
-extern crate mullvad_ipc_client;
-extern crate mullvad_paths;
-extern crate mullvad_rpc;
-extern crate mullvad_types;
-extern crate talpid_core;
-extern crate talpid_ipc;
-extern crate talpid_types;
mod account_history;
mod geoip;
diff --git a/mullvad-daemon/src/logging.rs b/mullvad-daemon/src/logging.rs
index 7005f2f7ea..39f5a2cd59 100644
--- a/mullvad-daemon/src/logging.rs
+++ b/mullvad-daemon/src/logging.rs
@@ -1,14 +1,10 @@
-extern crate fern;
-
-use self::fern::{
+use chrono;
+use fern::{
colors::{Color, ColoredLevelConfig},
Output,
};
-use chrono;
use log;
-
use std::{fmt, io, path::PathBuf};
-
use talpid_core::logging::rotate_log;
error_chain! {
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index dbb526801f..2d71ba45cd 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -6,20 +6,9 @@
//! GNU General Public License as published by the Free Software Foundation, either version 3 of
//! the License, or (at your option) any later version.
-extern crate chrono;
-extern crate clap;
#[macro_use]
extern crate error_chain;
-#[cfg(unix)]
-extern crate libc;
-extern crate log;
-extern crate log_panics;
-extern crate mullvad_daemon;
-extern crate mullvad_paths;
-extern crate talpid_core;
-#[cfg(windows)]
-extern crate windows_service;
use error_chain::ChainedError;
use log::{debug, error, info, warn};
diff --git a/mullvad-daemon/src/shutdown.rs b/mullvad-daemon/src/shutdown.rs
index ed86068d38..05c1e7f1af 100644
--- a/mullvad-daemon/src/shutdown.rs
+++ b/mullvad-daemon/src/shutdown.rs
@@ -2,10 +2,8 @@ error_chain! {}
#[cfg(unix)]
mod platform {
- extern crate simple_signal;
-
- use self::simple_signal::Signal;
use super::Result;
+ use simple_signal::Signal;
pub fn set_shutdown_signal_handler<F>(f: F) -> Result<()>
where
@@ -21,8 +19,6 @@ mod platform {
#[cfg(windows)]
mod platform {
- extern crate ctrlc;
-
use super::{Result, ResultExt};
pub fn set_shutdown_signal_handler<F>(f: F) -> Result<()>
diff --git a/mullvad-daemon/src/system_service.rs b/mullvad-daemon/src/system_service.rs
index 64e49d8e77..bc82944fc9 100644
--- a/mullvad-daemon/src/system_service.rs
+++ b/mullvad-daemon/src/system_service.rs
@@ -1,4 +1,4 @@
-use cli;
+use crate::cli;
use error_chain::ChainedError;
use std::{
env,
@@ -73,7 +73,7 @@ fn run_service() -> Result<()> {
.unwrap();
let config = cli::get_config();
- let result = ::create_daemon(&config).and_then(|daemon| {
+ let result = crate::create_daemon(&config).and_then(|daemon| {
let shutdown_handle = daemon.shutdown_handle();
// Register monitor that translates `ServiceControl` to Daemon events
diff --git a/talpid-core/Cargo.toml b/talpid-core/Cargo.toml
index c9e0f82088..4211b8dbf4 100644
--- a/talpid-core/Cargo.toml
+++ b/talpid-core/Cargo.toml
@@ -4,14 +4,15 @@ version = "0.1.0"
authors = ["Mullvad VPN <admin@mullvad.net>"]
description = "Privacy preserving and secure VPN client library"
license = "GPL-3.0"
+edition = "2018"
[dependencies]
atty = "0.2"
duct = "0.11"
error-chain = "0.12"
futures = "0.1"
-jsonrpc-core = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
-jsonrpc-macros = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
+jsonrpc-core = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
+jsonrpc-macros = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
libc = "0.2.20"
log = "0.4"
diff --git a/talpid-core/src/lib.rs b/talpid-core/src/lib.rs
index c8556ca0ec..437fb2ff6f 100644
--- a/talpid-core/src/lib.rs
+++ b/talpid-core/src/lib.rs
@@ -10,41 +10,8 @@
//! GNU General Public License as published by the Free Software Foundation, either version 3 of
//! the License, or (at your option) any later version.
-extern crate atty;
-extern crate duct;
-extern crate log;
-
#[macro_use]
extern crate error_chain;
-#[cfg(target_os = "linux")]
-extern crate failure;
-extern crate futures;
-#[cfg(unix)]
-extern crate hex;
-#[cfg(unix)]
-extern crate ipnetwork;
-extern crate jsonrpc_core;
-extern crate jsonrpc_macros;
-#[cfg(unix)]
-extern crate lazy_static;
-extern crate libc;
-#[cfg(unix)]
-extern crate nix;
-extern crate shell_escape;
-extern crate tokio_core;
-#[cfg(unix)]
-extern crate tun;
-extern crate uuid;
-#[cfg(target_os = "linux")]
-extern crate which;
-#[cfg(windows)]
-extern crate widestring;
-#[cfg(windows)]
-extern crate winreg;
-
-extern crate openvpn_plugin;
-extern crate talpid_ipc;
-extern crate talpid_types;
#[cfg(windows)]
mod winnet;
diff --git a/talpid-core/src/offline/linux.rs b/talpid-core/src/offline/linux.rs
index cf0daca86a..cc18a48a78 100644
--- a/talpid-core/src/offline/linux.rs
+++ b/talpid-core/src/offline/linux.rs
@@ -1,23 +1,14 @@
-extern crate iproute2;
-extern crate netlink_socket;
-extern crate rtnetlink;
-
-use std::{collections::BTreeSet, thread};
-
+use crate::tunnel_state_machine::TunnelCommand;
use error_chain::ChainedError;
use futures::{future::Either, sync::mpsc::UnboundedSender, Future, Stream};
+use iproute2::Link;
use log::{error, trace, warn};
-
-use self::{
- iproute2::Link,
- netlink_socket::{Protocol, SocketAddr, TokioSocket},
- rtnetlink::{
- LinkFlags, LinkHeader, LinkLayerType, LinkMessage, NetlinkCodec, NetlinkFramed,
- NetlinkMessage, RtnlMessage,
- },
+use netlink_socket::{Protocol, SocketAddr, TokioSocket};
+use rtnetlink::{
+ LinkFlags, LinkHeader, LinkLayerType, LinkMessage, NetlinkCodec, NetlinkFramed, NetlinkMessage,
+ RtnlMessage,
};
-
-use tunnel_state_machine::TunnelCommand;
+use std::{collections::BTreeSet, thread};
error_chain! {
errors {
diff --git a/talpid-core/src/offline/macos.rs b/talpid-core/src/offline/macos.rs
index e55fa376d3..0153357f18 100644
--- a/talpid-core/src/offline/macos.rs
+++ b/talpid-core/src/offline/macos.rs
@@ -1,6 +1,8 @@
-extern crate system_configuration;
-
-use self::system_configuration::{
+use crate::tunnel_state_machine::TunnelCommand;
+use futures::sync::mpsc::UnboundedSender;
+use log::{debug, trace};
+use std::{sync::mpsc, thread};
+use system_configuration::{
core_foundation::{
array::CFArray,
runloop::{kCFRunLoopCommonModes, CFRunLoop},
@@ -8,10 +10,7 @@ use self::system_configuration::{
},
dynamic_store::{SCDynamicStore, SCDynamicStoreBuilder, SCDynamicStoreCallBackContext},
};
-use futures::sync::mpsc::UnboundedSender;
-use log::{debug, trace};
-use std::{sync::mpsc, thread};
-use tunnel_state_machine::TunnelCommand;
+
const PRIMARY_INTERFACE_KEY: &str = "State:/Network/Global/IPv4";
diff --git a/talpid-core/src/offline/mod.rs b/talpid-core/src/offline/mod.rs
index e73de2efc1..00b2544636 100644
--- a/talpid-core/src/offline/mod.rs
+++ b/talpid-core/src/offline/mod.rs
@@ -1,5 +1,5 @@
+use crate::tunnel_state_machine::TunnelCommand;
use futures::sync::mpsc::UnboundedSender;
-use tunnel_state_machine::TunnelCommand;
#[cfg(target_os = "macos")]
#[path = "macos.rs"]
diff --git a/talpid-core/src/offline/windows.rs b/talpid-core/src/offline/windows.rs
index e5dbbaaed2..5a385c61bf 100644
--- a/talpid-core/src/offline/windows.rs
+++ b/talpid-core/src/offline/windows.rs
@@ -6,9 +6,17 @@
//! GNU General Public License as published by the Free Software Foundation, either version 3 of
//! the License, or (at your option) any later version.
-extern crate winapi;
-
-use self::winapi::{
+use crate::tunnel_state_machine::TunnelCommand;
+use futures::sync::mpsc::UnboundedSender;
+use log::debug;
+use std::{
+ ffi::c_void,
+ mem::zeroed,
+ os::windows::io::{IntoRawHandle, RawHandle},
+ ptr, thread,
+ time::Duration,
+};
+use winapi::{
shared::{
basetsd::LONG_PTR,
minwindef::{DWORD, LPARAM, LRESULT, UINT, WPARAM},
@@ -28,16 +36,6 @@ use self::winapi::{
},
},
};
-use futures::sync::mpsc::UnboundedSender;
-use log::debug;
-use std::{
- ffi::c_void,
- mem::zeroed,
- os::windows::io::{IntoRawHandle, RawHandle},
- ptr, thread,
- time::Duration,
-};
-use tunnel_state_machine::TunnelCommand;
const CLASS_NAME: &[u8] = b"S\0T\0A\0T\0I\0C\0\0\0";
const REQUEST_THREAD_SHUTDOWN: UINT = WM_USER + 1;
diff --git a/talpid-core/src/process/openvpn.rs b/talpid-core/src/process/openvpn.rs
index 8197784f0b..104471db2b 100644
--- a/talpid-core/src/process/openvpn.rs
+++ b/talpid-core/src/process/openvpn.rs
@@ -1,18 +1,15 @@
use duct;
-extern crate os_pipe;
use super::stoppable_process::StoppableProcess;
+use atty;
+use os_pipe::{pipe, PipeWriter};
+use shell_escape;
use std::{
ffi::{OsStr, OsString},
- fmt,
+ fmt, io,
path::{Path, PathBuf},
sync::Mutex,
};
-
-use self::os_pipe::{pipe, PipeWriter};
-use atty;
-use shell_escape;
-use std::io;
use talpid_types::net;
static BASE_ARGUMENTS: &[&[&str]] = &[
diff --git a/talpid-core/src/security/linux/dns/mod.rs b/talpid-core/src/security/linux/dns/mod.rs
index 7266e7263b..729dfc2799 100644
--- a/talpid-core/src/security/linux/dns/mod.rs
+++ b/talpid-core/src/security/linux/dns/mod.rs
@@ -1,16 +1,14 @@
-extern crate resolv_conf;
-
mod network_manager;
mod resolvconf;
mod static_resolv_conf;
mod systemd_resolved;
-use std::{env, fmt, net::IpAddr, path::Path};
-
use self::{
network_manager::NetworkManager, resolvconf::Resolvconf, static_resolv_conf::StaticResolvConf,
- systemd_resolved::SystemdResolved,
};
+use std::{env, fmt, net::IpAddr, path::Path};
+use systemd_resolved::SystemdResolved;
+
const RESOLV_CONF_PATH: &str = "/etc/resolv.conf";
diff --git a/talpid-core/src/security/linux/dns/network_manager.rs b/talpid-core/src/security/linux/dns/network_manager.rs
index 118be6e62d..73d49eb1a8 100644
--- a/talpid-core/src/security/linux/dns/network_manager.rs
+++ b/talpid-core/src/security/linux/dns/network_manager.rs
@@ -1,21 +1,17 @@
-extern crate dbus;
-
-use std::{collections::HashMap, net::IpAddr};
-
-use self::dbus::{
+use dbus::{
arg::{RefArg, Variant},
stdintf::*,
BusType,
};
-
+use error_chain::ChainedError;
use std::{
+ collections::HashMap,
fs::File,
io::{BufRead, BufReader},
+ net::IpAddr,
path::Path,
};
-use error_chain::ChainedError;
-
error_chain! {
errors {
NoNetworkManager {
diff --git a/talpid-core/src/security/linux/dns/static_resolv_conf.rs b/talpid-core/src/security/linux/dns/static_resolv_conf.rs
index e8534d3f8d..cea1b1ac2f 100644
--- a/talpid-core/src/security/linux/dns/static_resolv_conf.rs
+++ b/talpid-core/src/security/linux/dns/static_resolv_conf.rs
@@ -1,5 +1,7 @@
-extern crate notify;
-
+use super::RESOLV_CONF_PATH;
+use error_chain::ChainedError;
+use notify::{RecommendedWatcher, RecursiveMode, Watcher};
+use resolv_conf::{Config, ScopedIp};
use std::{
fs, io,
net::IpAddr,
@@ -7,13 +9,6 @@ use std::{
thread,
};
-use self::notify::{RecommendedWatcher, RecursiveMode, Watcher};
-use super::{
- resolv_conf::{Config, ScopedIp},
- RESOLV_CONF_PATH,
-};
-use error_chain::ChainedError;
-
const RESOLV_CONF_BACKUP_PATH: &str = "/etc/resolv.conf.mullvadbackup";
error_chain! {
diff --git a/talpid-core/src/security/linux/dns/systemd_resolved.rs b/talpid-core/src/security/linux/dns/systemd_resolved.rs
index 3d6cd19fd3..f4eac9e486 100644
--- a/talpid-core/src/security/linux/dns/systemd_resolved.rs
+++ b/talpid-core/src/security/linux/dns/systemd_resolved.rs
@@ -1,5 +1,8 @@
-extern crate dbus;
-
+use super::{super::iface_index, RESOLV_CONF_PATH};
+use dbus::{
+ arg::RefArg, stdintf::*, BusType, Interface, Member, Message, MessageItem, MessageItemArray,
+ Signature,
+};
use error_chain::ChainedError;
use lazy_static::lazy_static;
use libc::{AF_INET, AF_INET6};
@@ -9,13 +12,6 @@ use std::{
path::Path,
};
-use self::dbus::{
- arg::RefArg, stdintf::*, BusType, Interface, Member, Message, MessageItem, MessageItemArray,
- Signature,
-};
-
-use super::{super::iface_index, resolv_conf, RESOLV_CONF_PATH};
-
error_chain! {
errors {
diff --git a/talpid-core/src/security/linux/mod.rs b/talpid-core/src/security/linux/mod.rs
index 5cbe786e46..f12bf4a803 100644
--- a/talpid-core/src/security/linux/mod.rs
+++ b/talpid-core/src/security/linux/mod.rs
@@ -1,16 +1,13 @@
-extern crate mnl;
-extern crate nftnl;
-
-use self::nftnl::{
- expr::{self, Verdict},
- nft_expr, nft_expr_bitwise, nft_expr_cmp, nft_expr_ct, nft_expr_meta, nft_expr_payload, Batch,
- Chain, FinalizedBatch, ProtoFamily, Rule, Table,
-};
use super::{NetworkSecurityT, SecurityPolicy};
use crate::tunnel;
use ipnetwork::IpNetwork;
use lazy_static::lazy_static;
use libc;
+use nftnl::{
+ expr::{self, Verdict},
+ nft_expr, nft_expr_bitwise, nft_expr_cmp, nft_expr_ct, nft_expr_meta, nft_expr_payload, Batch,
+ Chain, FinalizedBatch, ProtoFamily, Rule, Table,
+};
use std::{
env,
ffi::CString,
@@ -19,6 +16,7 @@ use std::{
};
use talpid_types::net::{Endpoint, TransportProtocol};
+
mod dns;
pub use self::dns::{DnsMonitor, Error as DnsError};
diff --git a/talpid-core/src/security/macos/dns.rs b/talpid-core/src/security/macos/dns.rs
index 4937ffab03..a1fad021de 100644
--- a/talpid-core/src/security/macos/dns.rs
+++ b/talpid-core/src/security/macos/dns.rs
@@ -1,6 +1,14 @@
-extern crate system_configuration;
-
-use self::system_configuration::{
+use error_chain::ChainedError;
+use log::{debug, trace};
+use std::{
+ collections::HashMap,
+ fmt,
+ net::IpAddr,
+ path::Path,
+ sync::{mpsc, Arc, Mutex},
+ thread,
+};
+use system_configuration::{
core_foundation::{
array::CFArray,
base::{CFType, TCFType, ToVoid},
@@ -12,16 +20,6 @@ use self::system_configuration::{
dynamic_store::{SCDynamicStore, SCDynamicStoreBuilder, SCDynamicStoreCallBackContext},
sys::schema_definitions::kSCPropNetDNSServerAddresses,
};
-use error_chain::ChainedError;
-use log::{debug, trace};
-use std::{
- collections::HashMap,
- fmt,
- net::IpAddr,
- path::Path,
- sync::{mpsc, Arc, Mutex},
- thread,
-};
error_chain! {
errors {
diff --git a/talpid-core/src/security/macos/mod.rs b/talpid-core/src/security/macos/mod.rs
index 135b94f153..b4d300e66f 100644
--- a/talpid-core/src/security/macos/mod.rs
+++ b/talpid-core/src/security/macos/mod.rs
@@ -1,15 +1,12 @@
-extern crate pfctl;
-extern crate tokio_core;
-
-use self::pfctl::FilterRuleAction;
use super::{NetworkSecurityT, SecurityPolicy};
+use pfctl::FilterRuleAction;
use std::{env, net::Ipv4Addr};
use talpid_types::net;
mod dns;
pub use self::dns::{DnsMonitor, Error as DnsError};
-pub use self::pfctl::Error;
+pub use pfctl::Error;
type Result<T> = ::std::result::Result<T, Error>;
diff --git a/talpid-core/src/security/windows/mod.rs b/talpid-core/src/security/windows/mod.rs
index e8125c8b80..1a021d593a 100644
--- a/talpid-core/src/security/windows/mod.rs
+++ b/talpid-core/src/security/windows/mod.rs
@@ -1,13 +1,12 @@
use std::{net::IpAddr, ptr};
+use self::winfw::*;
+use super::{NetworkSecurityT, SecurityPolicy};
+use crate::winnet;
use log::{debug, error, trace};
use talpid_types::net::Endpoint;
use widestring::WideCString;
-use self::winfw::*;
-use super::{NetworkSecurityT, SecurityPolicy};
-use winnet;
-
#[macro_use]
mod ffi;
@@ -144,7 +143,7 @@ impl NetworkSecurity {
&mut self,
endpoint: &Endpoint,
winfw_settings: &WinFwSettings,
- tunnel_metadata: &::tunnel::TunnelMetadata,
+ tunnel_metadata: &crate::tunnel::TunnelMetadata,
) -> Result<()> {
trace!("Applying 'connected' firewall policy");
let ip_str = Self::widestring_ip(&endpoint.address.ip());
@@ -189,12 +188,11 @@ impl NetworkSecurity {
#[allow(non_snake_case)]
mod winfw {
+ use super::{ErrorKind, Result};
+ use crate::winnet;
use libc;
use talpid_types::net::TransportProtocol;
- use super::{ErrorKind, Result};
- use winnet;
-
#[repr(C)]
pub struct WinFwRelay {
pub ip: *const libc::wchar_t,
diff --git a/talpid-core/src/security/windows/system_state.rs b/talpid-core/src/security/windows/system_state.rs
index 55948340d7..f5e1d073dd 100644
--- a/talpid-core/src/security/windows/system_state.rs
+++ b/talpid-core/src/security/windows/system_state.rs
@@ -59,8 +59,6 @@ impl SystemStateWriter {
#[cfg(test)]
mod tests {
- extern crate tempfile;
-
use super::*;
#[test]
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index 8461855954..4011db3e84 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -1,7 +1,7 @@
use std::{
collections::HashMap,
ffi::OsString,
- fs, io,
+ io,
net::IpAddr,
path::{Path, PathBuf},
};
@@ -291,7 +291,7 @@ fn is_ipv6_enabled_in_os() -> bool {
(ipv6_disabled_bits & IPV6_DISABLED_ON_TUNNELS_MASK) == 0
})
.unwrap_or(true);
- let enabled_on_tap = ::winnet::get_tap_interface_ipv6_status().unwrap_or(false);
+ let enabled_on_tap = crate::winnet::get_tap_interface_ipv6_status().unwrap_or(false);
if !globally_enabled {
log::debug!("IPv6 disabled in tunnel interfaces");
@@ -304,7 +304,7 @@ fn is_ipv6_enabled_in_os() -> bool {
}
#[cfg(target_os = "linux")]
{
- fs::read_to_string("/proc/sys/net/ipv6/conf/all/disable_ipv6")
+ std::fs::read_to_string("/proc/sys/net/ipv6/conf/all/disable_ipv6")
.map(|disable_ipv6| disable_ipv6.trim() == "0")
.unwrap_or(false)
}
diff --git a/talpid-core/src/tunnel/openvpn.rs b/talpid-core/src/tunnel/openvpn.rs
index 22cd11ee95..fadb035966 100644
--- a/talpid-core/src/tunnel/openvpn.rs
+++ b/talpid-core/src/tunnel/openvpn.rs
@@ -1,9 +1,13 @@
use super::TunnelEvent;
-use crate::process::{
- openvpn::{OpenVpnCommand, OpenVpnProcHandle},
- stoppable_process::StoppableProcess,
+use crate::{
+ mktemp,
+ process::{
+ openvpn::{OpenVpnCommand, OpenVpnProcHandle},
+ stoppable_process::StoppableProcess,
+ },
};
-use mktemp;
+#[cfg(target_os = "linux")]
+use failure::ResultExt as FailureResultExt;
use std::{
collections::HashMap,
ffi::OsString,
@@ -20,9 +24,6 @@ use std::{
};
use talpid_ipc;
use talpid_types::net::{Endpoint, OpenVpnProxySettings, TunnelOptions};
-
-#[cfg(target_os = "linux")]
-use failure::ResultExt as FailureResultExt;
#[cfg(target_os = "linux")]
use which;
@@ -526,10 +527,11 @@ mod event_server {
#[cfg(test)]
mod tests {
use super::*;
- use std::path::{Path, PathBuf};
-
- use mktemp::TempFile;
- use std::sync::{Arc, Mutex};
+ use crate::mktemp::TempFile;
+ use std::{
+ path::{Path, PathBuf},
+ sync::{Arc, Mutex},
+ };
#[derive(Debug, Default, Clone)]
struct TestOpenVpnBuilder {
diff --git a/talpid-core/src/tunnel_state_machine/macros.rs b/talpid-core/src/tunnel_state_machine/macros.rs
index 9c667e579f..332d518de5 100644
--- a/talpid-core/src/tunnel_state_machine/macros.rs
+++ b/talpid-core/src/tunnel_state_machine/macros.rs
@@ -10,9 +10,9 @@
macro_rules! try_handle_event {
($same_state:expr, $event:expr) => {
match $event {
- Ok(crate::futures::Async::Ready(Some(event))) => Ok(event),
- Ok(crate::futures::Async::Ready(None)) => Err(None),
- Ok(crate::futures::Async::NotReady) => {
+ Ok(futures::Async::Ready(Some(event))) => Ok(event),
+ Ok(futures::Async::Ready(None)) => Err(None),
+ Ok(futures::Async::NotReady) => {
return crate::tunnel_state_machine::EventConsequence::NoEvents($same_state);
}
Err(error) => Err(Some(error)),
diff --git a/talpid-ipc/Cargo.toml b/talpid-ipc/Cargo.toml
index 5800eb2a68..4d639bbb81 100644
--- a/talpid-ipc/Cargo.toml
+++ b/talpid-ipc/Cargo.toml
@@ -4,15 +4,16 @@ version = "0.1.0"
authors = ["Mullvad VPN <admin@mullvad.net>"]
description = "IPC client and server for talpid"
license = "GPL-3.0"
+edition = "2018"
[dependencies]
error-chain = "0.12"
serde = "1.0"
serde_json = "1.0"
log = "0.4"
-jsonrpc-core = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
-jsonrpc-pubsub = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
-jsonrpc-ipc-server = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
+jsonrpc-core = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
+jsonrpc-pubsub = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
+jsonrpc-ipc-server = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
tokio = "0.1"
futures = "0.1"
@@ -22,7 +23,7 @@ jsonrpc-client-ipc = { git = "https://github.com/mullvad/jsonrpc-client-rs", rev
[dev-dependencies]
assert_matches = "1.0"
env_logger = "0.5"
-jsonrpc-macros = { git = "https://github.com/mullvad/jsonrpc", branch = "make-ipc-server-concurrent-part-deux" }
+jsonrpc-macros = { git = "https://github.com/mullvad/jsonrpc", branch = "mullvad-fork" }
uuid = { version = "0.6", features = ["v4"] }
futures = "0.1.23"
tokio = "0.1"
diff --git a/talpid-ipc/src/lib.rs b/talpid-ipc/src/lib.rs
index 772b3a1dd8..a84a982aa7 100644
--- a/talpid-ipc/src/lib.rs
+++ b/talpid-ipc/src/lib.rs
@@ -11,17 +11,6 @@
#[macro_use]
extern crate error_chain;
-extern crate serde;
-extern crate serde_json;
-
-extern crate jsonrpc_core;
-extern crate jsonrpc_ipc_server;
-extern crate jsonrpc_pubsub;
-
-extern crate futures;
-extern crate jsonrpc_client_core;
-extern crate jsonrpc_client_ipc;
-extern crate tokio;
use futures::Future;
use std::thread;
diff --git a/talpid-ipc/tests/ipc-client-server.rs b/talpid-ipc/tests/ipc-client-server.rs
index 5f647d07a2..00caf716f1 100644
--- a/talpid-ipc/tests/ipc-client-server.rs
+++ b/talpid-ipc/tests/ipc-client-server.rs
@@ -1,18 +1,6 @@
// TODO fix these tests on Windows
#![cfg(not(windows))]
-extern crate assert_matches;
-extern crate env_logger;
-extern crate jsonrpc_client_core;
-extern crate jsonrpc_client_ipc;
-extern crate jsonrpc_core;
-extern crate jsonrpc_macros;
-extern crate talpid_ipc;
-extern crate tokio;
-extern crate uuid;
-
-extern crate futures;
-
use assert_matches::assert_matches;
use futures::{sync::oneshot, Future};