summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--mullvad-cli/Cargo.toml1
-rw-r--r--mullvad-cli/build.rs5
-rw-r--r--mullvad-cli/src/cmds/account.rs3
-rw-r--r--mullvad-cli/src/cmds/auto_connect.rs2
-rw-r--r--mullvad-cli/src/cmds/block_when_disconnected.rs2
-rw-r--r--mullvad-cli/src/cmds/connect.rs1
-rw-r--r--mullvad-cli/src/cmds/disconnect.rs2
-rw-r--r--mullvad-cli/src/cmds/lan.rs2
-rw-r--r--mullvad-cli/src/cmds/mod.rs4
-rw-r--r--mullvad-cli/src/cmds/relay.rs2
-rw-r--r--mullvad-cli/src/cmds/status.rs2
-rw-r--r--mullvad-cli/src/cmds/tunnel.rs2
-rw-r--r--mullvad-cli/src/cmds/version.rs1
-rw-r--r--mullvad-cli/src/main.rs17
-rw-r--r--mullvad-ipc-client/Cargo.toml1
-rw-r--r--mullvad-ipc-client/src/lib.rs49
-rw-r--r--mullvad-problem-report/Cargo.toml1
-rw-r--r--mullvad-problem-report/build.rs9
-rw-r--r--mullvad-problem-report/src/main.rs19
-rw-r--r--mullvad-problem-report/src/metadata.rs7
-rw-r--r--mullvad-rpc/Cargo.toml1
-rw-r--r--mullvad-rpc/src/cached_dns_resolver.rs38
-rw-r--r--mullvad-rpc/src/https_client_with_sni.rs33
-rw-r--r--mullvad-rpc/src/lib.rs25
-rw-r--r--mullvad-rpc/src/rest.rs23
-rw-r--r--mullvad-tests/Cargo.toml1
-rw-r--r--mullvad-tests/src/bin/mock_openvpn.rs20
-rw-r--r--mullvad-tests/src/lib.rs40
-rw-r--r--mullvad-tests/src/mock_openvpn/mod.rs10
-rw-r--r--mullvad-tests/tests/account.rs11
-rw-r--r--mullvad-tests/tests/connection.rs17
-rw-r--r--mullvad-tests/tests/startup.rs7
32 files changed, 134 insertions, 224 deletions
diff --git a/mullvad-cli/Cargo.toml b/mullvad-cli/Cargo.toml
index f6376b76d7..b328393d3c 100644
--- a/mullvad-cli/Cargo.toml
+++ b/mullvad-cli/Cargo.toml
@@ -11,6 +11,7 @@ authors = [
]
description = "Manage the Mullvad VPN daemon via a convenient CLI"
license = "GPL-3.0"
+edition = "2018"
[[bin]]
name = "mullvad"
diff --git a/mullvad-cli/build.rs b/mullvad-cli/build.rs
index 3c59e07c65..4c19603b76 100644
--- a/mullvad-cli/build.rs
+++ b/mullvad-cli/build.rs
@@ -1,8 +1,3 @@
-#[cfg(windows)]
-extern crate winapi;
-#[cfg(windows)]
-extern crate winres;
-
use std::{env, fs, path::PathBuf};
fn main() {
diff --git a/mullvad-cli/src/cmds/account.rs b/mullvad-cli/src/cmds/account.rs
index 5ab7180771..c980cca936 100644
--- a/mullvad-cli/src/cmds/account.rs
+++ b/mullvad-cli/src/cmds/account.rs
@@ -1,6 +1,5 @@
use crate::{new_rpc_client, Command, Result};
-use clap::{self, value_t_or_exit};
-
+use clap::value_t_or_exit;
use mullvad_types::account::AccountToken;
pub struct Account;
diff --git a/mullvad-cli/src/cmds/auto_connect.rs b/mullvad-cli/src/cmds/auto_connect.rs
index 98b4b9e323..92a08a0ebf 100644
--- a/mullvad-cli/src/cmds/auto_connect.rs
+++ b/mullvad-cli/src/cmds/auto_connect.rs
@@ -1,5 +1,5 @@
use crate::{new_rpc_client, Command, Result};
-use clap::{self, value_t_or_exit};
+use clap::value_t_or_exit;
pub struct AutoConnect;
diff --git a/mullvad-cli/src/cmds/block_when_disconnected.rs b/mullvad-cli/src/cmds/block_when_disconnected.rs
index 62fb572b5f..8e74a16d1e 100644
--- a/mullvad-cli/src/cmds/block_when_disconnected.rs
+++ b/mullvad-cli/src/cmds/block_when_disconnected.rs
@@ -1,5 +1,5 @@
use crate::{new_rpc_client, Command, Result};
-use clap::{self, value_t_or_exit};
+use clap::value_t_or_exit;
pub struct BlockWhenDisconnected;
diff --git a/mullvad-cli/src/cmds/connect.rs b/mullvad-cli/src/cmds/connect.rs
index 05d2b7de95..d75c1b2195 100644
--- a/mullvad-cli/src/cmds/connect.rs
+++ b/mullvad-cli/src/cmds/connect.rs
@@ -1,5 +1,4 @@
use crate::{new_rpc_client, Command, Result};
-use clap;
use error_chain::ChainedError;
pub struct Connect;
diff --git a/mullvad-cli/src/cmds/disconnect.rs b/mullvad-cli/src/cmds/disconnect.rs
index 68b677e902..5375ad0535 100644
--- a/mullvad-cli/src/cmds/disconnect.rs
+++ b/mullvad-cli/src/cmds/disconnect.rs
@@ -1,6 +1,4 @@
use crate::{new_rpc_client, Command, Result};
-use clap;
-
pub struct Disconnect;
diff --git a/mullvad-cli/src/cmds/lan.rs b/mullvad-cli/src/cmds/lan.rs
index 5840545df8..44efd92f5c 100644
--- a/mullvad-cli/src/cmds/lan.rs
+++ b/mullvad-cli/src/cmds/lan.rs
@@ -1,5 +1,5 @@
use crate::{new_rpc_client, Command, Result};
-use clap::{self, value_t_or_exit};
+use clap::value_t_or_exit;
pub struct Lan;
diff --git a/mullvad-cli/src/cmds/mod.rs b/mullvad-cli/src/cmds/mod.rs
index 0a16b952f4..43e1968065 100644
--- a/mullvad-cli/src/cmds/mod.rs
+++ b/mullvad-cli/src/cmds/mod.rs
@@ -32,8 +32,8 @@ mod version;
pub use self::version::Version;
/// Returns a map of all available subcommands with their name as key.
-pub fn get_commands() -> HashMap<&'static str, Box<Command>> {
- let commands: Vec<Box<Command>> = vec![
+pub fn get_commands() -> HashMap<&'static str, Box<dyn Command>> {
+ let commands: Vec<Box<dyn Command>> = vec![
Box::new(Account),
Box::new(AutoConnect),
Box::new(BlockWhenDisconnected),
diff --git a/mullvad-cli/src/cmds/relay.rs b/mullvad-cli/src/cmds/relay.rs
index 80b74d01ac..058c17976a 100644
--- a/mullvad-cli/src/cmds/relay.rs
+++ b/mullvad-cli/src/cmds/relay.rs
@@ -1,5 +1,5 @@
use crate::{new_rpc_client, Command, Result, ResultExt};
-use clap::{self, value_t};
+use clap::value_t;
use std::str::FromStr;
use mullvad_types::relay_constraints::{
diff --git a/mullvad-cli/src/cmds/status.rs b/mullvad-cli/src/cmds/status.rs
index e9c6da56e8..11b0156edf 100644
--- a/mullvad-cli/src/cmds/status.rs
+++ b/mullvad-cli/src/cmds/status.rs
@@ -1,6 +1,4 @@
use crate::{new_rpc_client, Command, Result};
-use clap;
-
use mullvad_ipc_client::DaemonRpcClient;
use mullvad_types::auth_failed::AuthFailed;
use talpid_types::tunnel::BlockReason;
diff --git a/mullvad-cli/src/cmds/tunnel.rs b/mullvad-cli/src/cmds/tunnel.rs
index 7a45f5274f..a45ae31c17 100644
--- a/mullvad-cli/src/cmds/tunnel.rs
+++ b/mullvad-cli/src/cmds/tunnel.rs
@@ -1,5 +1,5 @@
use crate::{new_rpc_client, Command, Result};
-use clap::{self, value_t};
+use clap::value_t;
use talpid_types::net::{
LocalOpenVpnProxySettings, OpenVpnProxyAuth, OpenVpnProxySettings,
diff --git a/mullvad-cli/src/cmds/version.rs b/mullvad-cli/src/cmds/version.rs
index 065ce4b8ba..b255f98c54 100644
--- a/mullvad-cli/src/cmds/version.rs
+++ b/mullvad-cli/src/cmds/version.rs
@@ -1,5 +1,4 @@
use crate::{new_rpc_client, Command, Result};
-use clap;
pub struct Version;
diff --git a/mullvad-cli/src/main.rs b/mullvad-cli/src/main.rs
index 6a3a547b9c..05b6c89163 100644
--- a/mullvad-cli/src/main.rs
+++ b/mullvad-cli/src/main.rs
@@ -6,26 +6,15 @@
//! 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 clap;
-extern crate env_logger;
-extern crate futures;
#[macro_use]
extern crate error_chain;
-extern crate mullvad_ipc_client;
-extern crate mullvad_paths;
-extern crate mullvad_types;
-extern crate serde;
-extern crate talpid_types;
-
-mod cmds;
use clap::{crate_authors, crate_description, crate_name};
+use error_chain::ChainedError;
use mullvad_ipc_client::{new_standalone_ipc_client, DaemonRpcClient};
+use std::{alloc::System, io};
-use std::alloc::System;
-use std::io;
-
-use error_chain::ChainedError;
+mod cmds;
#[global_allocator]
static GLOBAL: System = System;
diff --git a/mullvad-ipc-client/Cargo.toml b/mullvad-ipc-client/Cargo.toml
index 05f39121e4..3e64338bb0 100644
--- a/mullvad-ipc-client/Cargo.toml
+++ b/mullvad-ipc-client/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Mullvad VPN <admin@mullvad.net>"]
description = "RPC client for Mullvad daemon"
license = "GPL-3.0"
+edition = "2018"
[dependencies]
error-chain = "0.12"
diff --git a/mullvad-ipc-client/src/lib.rs b/mullvad-ipc-client/src/lib.rs
index 7f2c6a17c1..e04f86e4bf 100644
--- a/mullvad-ipc-client/src/lib.rs
+++ b/mullvad-ipc-client/src/lib.rs
@@ -1,39 +1,28 @@
-extern crate log;
#[macro_use]
extern crate error_chain;
-extern crate jsonrpc_client_core;
-extern crate jsonrpc_client_ipc;
-
-extern crate futures;
-extern crate mullvad_paths;
-extern crate mullvad_types;
-extern crate serde;
-extern crate talpid_ipc;
-extern crate talpid_types;
-extern crate tokio;
-extern crate tokio_timer;
-
-use std::path::Path;
-use std::sync::mpsc;
-use std::thread;
-use std::time::Duration;
-
-use mullvad_types::account::{AccountData, AccountToken};
-use mullvad_types::location::GeoIpLocation;
-use mullvad_types::relay_constraints::{RelaySettings, RelaySettingsUpdate};
-use mullvad_types::relay_list::RelayList;
-use mullvad_types::settings::Settings;
-use mullvad_types::version::AppVersionInfo;
+use futures::{
+ stream::{self, Stream},
+ sync::oneshot,
+};
+use jsonrpc_client_core::{Client, ClientHandle, Future};
+use jsonrpc_client_ipc::IpcTransport;
+use mullvad_types::{
+ account::{AccountData, AccountToken},
+ location::GeoIpLocation,
+ relay_constraints::{RelaySettings, RelaySettingsUpdate},
+ relay_list::RelayList,
+ settings::Settings,
+ version::AppVersionInfo,
+};
use serde::{Deserialize, Serialize};
-use talpid_types::net::{OpenVpnProxySettings, TunnelOptions};
-use talpid_types::tunnel::TunnelStateTransition;
+use std::{path::Path, sync::mpsc, thread, time::Duration};
+use talpid_types::{
+ net::{OpenVpnProxySettings, TunnelOptions},
+ tunnel::TunnelStateTransition,
+};
-use futures::stream::{self, Stream};
-use futures::sync::oneshot;
-use jsonrpc_client_core::{Client, ClientHandle, Future};
pub use jsonrpc_client_core::{Error as RpcError, ErrorKind as RpcErrorKind};
-use jsonrpc_client_ipc::IpcTransport;
error_chain! {
errors {
diff --git a/mullvad-problem-report/Cargo.toml b/mullvad-problem-report/Cargo.toml
index 7dd510d4ea..4dbf879370 100644
--- a/mullvad-problem-report/Cargo.toml
+++ b/mullvad-problem-report/Cargo.toml
@@ -11,6 +11,7 @@ authors = [
]
description = "Collect Mullvad VPN logs into a report and send it to support"
license = "GPL-3.0"
+edition = "2018"
[[bin]]
name = "problem-report"
diff --git a/mullvad-problem-report/build.rs b/mullvad-problem-report/build.rs
index e806ed4361..93e8577394 100644
--- a/mullvad-problem-report/build.rs
+++ b/mullvad-problem-report/build.rs
@@ -1,11 +1,4 @@
-use std::env;
-use std::fs;
-use std::path::PathBuf;
-
-#[cfg(windows)]
-extern crate winapi;
-#[cfg(windows)]
-extern crate winres;
+use std::{env, fs, path::PathBuf};
fn main() {
let out_dir = PathBuf::from(env::var_os("OUT_DIR").unwrap());
diff --git a/mullvad-problem-report/src/main.rs b/mullvad-problem-report/src/main.rs
index be288aaf53..6c9fad194a 100644
--- a/mullvad-problem-report/src/main.rs
+++ b/mullvad-problem-report/src/main.rs
@@ -6,25 +6,13 @@
//! 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 clap;
-extern crate dirs;
#[macro_use]
extern crate error_chain;
-extern crate env_logger;
-extern crate lazy_static;
-extern crate regex;
-extern crate tokio_core;
-extern crate uuid;
-
-extern crate mullvad_paths;
-extern crate mullvad_rpc;
use clap::crate_authors;
use error_chain::ChainedError;
use lazy_static::lazy_static;
use regex::Regex;
-use tokio_core::reactor::Core;
-
use std::{
alloc::System,
borrow::Cow,
@@ -35,6 +23,7 @@ use std::{
io::{self, BufWriter, Read, Seek, SeekFrom, Write},
path::{Path, PathBuf},
};
+use tokio_core::reactor::Core;
#[global_allocator]
@@ -343,21 +332,21 @@ impl ProblemReport {
self.redact_custom_strings(&out3).to_string()
}
- fn redact_account_number(input: &str) -> Cow<str> {
+ fn redact_account_number(input: &str) -> Cow<'_, str> {
lazy_static! {
static ref RE: Regex = Regex::new("\\d{16}").unwrap();
}
RE.replace_all(input, "[REDACTED ACCOUNT NUMBER]")
}
- fn redact_home_dir(input: &str) -> Cow<str> {
+ fn redact_home_dir(input: &str) -> Cow<'_, str> {
match dirs::home_dir() {
Some(home) => Cow::from(input.replace(home.to_string_lossy().as_ref(), "~")),
None => Cow::from(input),
}
}
- fn redact_network_info(input: &str) -> Cow<str> {
+ fn redact_network_info(input: &str) -> Cow<'_, str> {
lazy_static! {
static ref RE: Regex = {
let boundary = "[^0-9a-zA-Z.:]";
diff --git a/mullvad-problem-report/src/metadata.rs b/mullvad-problem-report/src/metadata.rs
index cddbe57892..92de1940e1 100644
--- a/mullvad-problem-report/src/metadata.rs
+++ b/mullvad-problem-report/src/metadata.rs
@@ -1,6 +1,5 @@
-use std::collections::HashMap;
-use std::process::Command;
-use uuid;
+use std::{collections::HashMap, process::Command};
+
pub const PRODUCT_VERSION: &str = include_str!(concat!(env!("OUT_DIR"), "/product-version.txt"));
@@ -17,8 +16,6 @@ pub fn collect() -> HashMap<String, String> {
#[cfg(target_os = "linux")]
mod os {
- extern crate rs_release;
-
pub fn version() -> String {
// The OS version information is obtained first from the os-release file. If that
// information is incomplete or unavailable, an attempt is made to obtain the
diff --git a/mullvad-rpc/Cargo.toml b/mullvad-rpc/Cargo.toml
index bb55d9a796..ff9596d10f 100644
--- a/mullvad-rpc/Cargo.toml
+++ b/mullvad-rpc/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Mullvad VPN <admin@mullvad.net>"]
description = "Mullvad VPN RPC clients. Providing an interface to query our infrastructure for information."
license = "GPL-3.0"
+edition = "2018"
[dependencies]
chrono = { version = "0.4", features = ["serde"] }
diff --git a/mullvad-rpc/src/cached_dns_resolver.rs b/mullvad-rpc/src/cached_dns_resolver.rs
index a20c0db973..0b0640af28 100644
--- a/mullvad-rpc/src/cached_dns_resolver.rs
+++ b/mullvad-rpc/src/cached_dns_resolver.rs
@@ -1,13 +1,14 @@
-use log::{debug, info, warn};
-use std::fs::File;
-use std::io::{self, Read, Write};
-use std::net::{IpAddr, ToSocketAddrs};
-use std::path::{Path, PathBuf};
-use std::sync::mpsc;
-use std::thread;
-use std::time::{Duration, SystemTime, UNIX_EPOCH};
-
use error_chain::ChainedError;
+use log::{debug, info, warn};
+use std::{
+ fs::File,
+ io::{self, Read, Write},
+ net::{IpAddr, ToSocketAddrs},
+ path::{Path, PathBuf},
+ sync::mpsc,
+ thread,
+ time::{Duration, SystemTime, UNIX_EPOCH},
+};
static DNS_TIMEOUT: Duration = Duration::from_secs(2);
@@ -217,17 +218,18 @@ impl<R: DnsResolver> CachedDnsResolver<R> {
#[cfg(test)]
mod tests {
- extern crate filetime;
- extern crate tempfile;
-
- use std::fs::{self, File};
- use std::io::{Read, Write};
- use std::sync::atomic::{AtomicBool, Ordering};
- use std::sync::Arc;
+ use std::{
+ fs::{self, File},
+ io::{Read, Write},
+ sync::{
+ atomic::{AtomicBool, Ordering},
+ Arc,
+ },
+ };
- use self::filetime::FileTime;
- use self::tempfile::TempDir;
use super::*;
+ use filetime::FileTime;
+ use tempfile::TempDir;
#[test]
fn uses_previously_cached_address() {
diff --git a/mullvad-rpc/src/https_client_with_sni.rs b/mullvad-rpc/src/https_client_with_sni.rs
index 62dc66df28..3f62372e73 100644
--- a/mullvad-rpc/src/https_client_with_sni.rs
+++ b/mullvad-rpc/src/https_client_with_sni.rs
@@ -1,22 +1,21 @@
-extern crate tokio_openssl;
-extern crate tokio_service;
-
-use std::fmt;
-use std::io;
-use std::path::{Path, PathBuf};
-use std::str;
-use std::sync::Arc;
-
use futures::{Future, Poll};
-use hyper::client::{Client, Connect, HttpConnector};
-use hyper::{Body, Uri};
-pub use hyper_openssl::openssl::error::ErrorStack;
+use hyper::{
+ client::{Client, Connect, HttpConnector},
+ Body, Uri,
+};
use hyper_openssl::openssl::ssl::{SslConnector, SslMethod};
use jsonrpc_client_http::ClientCreator;
+use std::{
+ fmt, io,
+ path::{Path, PathBuf},
+ str,
+ sync::Arc,
+};
use tokio_core::reactor::Handle;
+use tokio_openssl::{SslConnectorExt, SslStream};
+use tokio_service::Service;
-use self::tokio_openssl::{SslConnectorExt, SslStream};
-use self::tokio_service::Service;
+pub use hyper_openssl::openssl::error::ErrorStack;
pub struct HttpsClientWithSni {
sni_hostname: String,
@@ -97,7 +96,7 @@ impl<T> From<(T, SslConnector)> for HttpsConnectorWithSni<T> {
}
impl<T> fmt::Debug for HttpsConnectorWithSni<T> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("HttpsConnectorWithSni").finish()
}
}
@@ -141,7 +140,7 @@ impl<T: Connect> Service for HttpsConnectorWithSni<T> {
}
}
-type BoxedFut<T> = Box<Future<Item = SslStream<T>, Error = io::Error>>;
+type BoxedFut<T> = Box<dyn Future<Item = SslStream<T>, Error = io::Error>>;
/// A Future representing work to connect to a URL, and a TLS handshake.
pub struct HttpsConnecting<T>(BoxedFut<T>);
@@ -157,7 +156,7 @@ impl<T> Future for HttpsConnecting<T> {
}
impl<T> fmt::Debug for HttpsConnecting<T> {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.pad("HttpsConnecting")
}
}
diff --git a/mullvad-rpc/src/lib.rs b/mullvad-rpc/src/lib.rs
index 0d886bfaaa..cd2f287a32 100644
--- a/mullvad-rpc/src/lib.rs
+++ b/mullvad-rpc/src/lib.rs
@@ -6,32 +6,15 @@
//! 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;
-extern crate hyper;
-extern crate hyper_openssl;
-extern crate jsonrpc_client_core;
-extern crate jsonrpc_client_http;
-extern crate lazy_static;
-extern crate log;
-extern crate serde_json;
-extern crate tokio_core;
-
-extern crate mullvad_types;
-use chrono::offset::Utc;
-use chrono::DateTime;
+use chrono::{offset::Utc, DateTime};
use jsonrpc_client_core::{expand_params, jsonrpc_client};
use jsonrpc_client_http::header::Host;
use jsonrpc_client_http::{HttpTransport, HttpTransportBuilder};
use lazy_static::lazy_static;
-use tokio_core::reactor::Handle;
-
-pub use jsonrpc_client_core::{Error, ErrorKind};
-pub use jsonrpc_client_http::{Error as HttpError, HttpHandle};
-
use mullvad_types::{account::AccountToken, relay_list::RelayList, version};
use std::{
collections::HashMap,
@@ -39,6 +22,10 @@ use std::{
path::{Path, PathBuf},
time::Duration,
};
+use tokio_core::reactor::Handle;
+
+pub use jsonrpc_client_core::{Error, ErrorKind};
+pub use jsonrpc_client_http::{Error as HttpError, HttpHandle};
pub mod event_loop;
pub mod rest;
diff --git a/mullvad-rpc/src/rest.rs b/mullvad-rpc/src/rest.rs
index 05665e4fd0..546aec3b14 100644
--- a/mullvad-rpc/src/rest.rs
+++ b/mullvad-rpc/src/rest.rs
@@ -1,17 +1,14 @@
-use std::path::Path;
-
-use futures::sync::{mpsc, oneshot};
-use futures::{future, Future, Stream};
-
-use hyper;
-use hyper::client::Client;
-use hyper::{Request, StatusCode, Uri};
+use crate::HttpsConnectorWithSni;
+use futures::{
+ future,
+ sync::{mpsc, oneshot},
+ Future, Stream,
+};
+use hyper::{client::Client, Request, StatusCode, Uri};
use hyper_openssl::openssl::error::ErrorStack;
-
+use std::path::Path;
use tokio_core::reactor::Handle;
-use crate::HttpsConnectorWithSni;
-
error_chain! {
errors {
/// When the http status code of the response is not 200 OK
@@ -46,7 +43,7 @@ pub fn create_https_client<P: AsRef<Path>>(ca_path: P, handle: &Handle) -> Resul
fn create_request_processing_future<CC: hyper::client::Connect>(
request_rx: RequestReceiver,
client: Client<CC, hyper::Body>,
-) -> Box<Future<Item = (), Error = ()>> {
+) -> Box<dyn Future<Item = (), Error = ()>> {
let f = request_rx.for_each(move |(request, response_tx)| {
log::trace!("Sending request to {}", request.uri());
client
@@ -68,7 +65,7 @@ fn create_request_processing_future<CC: hyper::client::Connect>(
Ok(())
})
});
- Box::new(f) as Box<Future<Item = (), Error = ()>>
+ Box::new(f) as Box<dyn Future<Item = (), Error = ()>>
}
pub fn create_get_request(uri: Uri) -> Request {
diff --git a/mullvad-tests/Cargo.toml b/mullvad-tests/Cargo.toml
index 95aa6bb56f..37ada0d6fd 100644
--- a/mullvad-tests/Cargo.toml
+++ b/mullvad-tests/Cargo.toml
@@ -4,6 +4,7 @@ version = "0.1.0"
authors = ["Mullvad VPN <admin@mullvad.net>"]
description = "Mullvad test specific modules and binaries"
license = "GPL-3.0"
+edition = "2018"
[features]
integration-tests = []
diff --git a/mullvad-tests/src/bin/mock_openvpn.rs b/mullvad-tests/src/bin/mock_openvpn.rs
index cbc5b6caf6..042065d3be 100644
--- a/mullvad-tests/src/bin/mock_openvpn.rs
+++ b/mullvad-tests/src/bin/mock_openvpn.rs
@@ -1,14 +1,14 @@
-extern crate mullvad_tests;
-
-use std::env;
-use std::fs::{self, File};
-use std::io::{self, Read, Write};
-use std::path::PathBuf;
-use std::sync::mpsc;
-use std::thread;
-use std::time::Duration;
-
use mullvad_tests::{watch_event, PathWatcher};
+use std::{
+ env,
+ fs::{self, File},
+ io::{self, Read, Write},
+ path::PathBuf,
+ sync::mpsc,
+ thread,
+ time::Duration,
+};
+
const MAX_EVENT_TIME: Duration = Duration::from_secs(60);
diff --git a/mullvad-tests/src/lib.rs b/mullvad-tests/src/lib.rs
index c9752d5a58..c13c67b6ce 100644
--- a/mullvad-tests/src/lib.rs
+++ b/mullvad-tests/src/lib.rs
@@ -1,40 +1,26 @@
-extern crate duct;
-extern crate jsonrpc_client_core;
-extern crate jsonrpc_client_ipc;
-#[cfg(unix)]
-extern crate libc;
-extern crate mullvad_ipc_client;
-extern crate mullvad_paths;
-extern crate notify;
-extern crate openvpn_plugin;
-extern crate talpid_ipc;
-extern crate tempfile;
-
-extern crate futures;
-extern crate tokio;
-
-pub mod mock_openvpn;
-
-use std::collections::HashMap;
-use std::fs::{self, File};
-use std::path::{Path, PathBuf};
-use std::sync::{mpsc, Arc};
-use std::time::{Duration, Instant};
-use std::{cmp, thread};
-
+use self::mock_openvpn::MOCK_OPENVPN_ARGS_FILE;
+use self::platform_specific::*;
use futures::sync::oneshot;
use jsonrpc_client_core::{Future, Transport};
use jsonrpc_client_ipc::IpcTransport;
use mullvad_ipc_client::{DaemonRpcClient, ResultExt};
use mullvad_paths::resources::API_CA_FILENAME;
use notify::{RawEvent, RecommendedWatcher, RecursiveMode, Watcher};
+use std::{
+ collections::HashMap,
+ fs::{self, File},
+ path::{Path, PathBuf},
+ sync::{mpsc, Arc},
+ time::{Duration, Instant},
+ {cmp, thread},
+};
use tempfile::TempDir;
use tokio::reactor::Handle;
-use self::mock_openvpn::MOCK_OPENVPN_ARGS_FILE;
-use self::platform_specific::*;
+pub use notify::op::{self as watch_event, Op as WatchEvent};
+
-pub use self::notify::op::{self as watch_event, Op as WatchEvent};
+pub mod mock_openvpn;
type Result<T> = ::std::result::Result<T, String>;
diff --git a/mullvad-tests/src/mock_openvpn/mod.rs b/mullvad-tests/src/mock_openvpn/mod.rs
index 56e2514970..9c84496e66 100644
--- a/mullvad-tests/src/mock_openvpn/mod.rs
+++ b/mullvad-tests/src/mock_openvpn/mod.rs
@@ -1,8 +1,10 @@
-pub const MOCK_OPENVPN_ARGS_FILE: &str = "mock_openvpn_args";
+use std::{
+ fs::File,
+ io::{self, BufRead, BufReader},
+ path::Path,
+};
-use std::fs::File;
-use std::io::{self, BufRead, BufReader};
-use std::path::Path;
+pub const MOCK_OPENVPN_ARGS_FILE: &str = "mock_openvpn_args";
pub fn search_openvpn_args<P: AsRef<Path>>(
openvpn_args_file_path: P,
diff --git a/mullvad-tests/tests/account.rs b/mullvad-tests/tests/account.rs
index 35e8baa6cf..16b877bb76 100644
--- a/mullvad-tests/tests/account.rs
+++ b/mullvad-tests/tests/account.rs
@@ -1,13 +1,12 @@
#![cfg(feature = "integration-tests")]
-extern crate mullvad_tests;
-
-use std::fs::File;
-use std::io::{BufRead, BufReader};
-use std::path::Path;
-
use mullvad_tests::mock_openvpn::search_openvpn_args;
use mullvad_tests::{watch_event, DaemonRunner, PathWatcher};
+use std::{
+ fs::File,
+ io::{BufRead, BufReader},
+ path::Path,
+};
#[test]
fn uses_account_token() {
diff --git a/mullvad-tests/tests/connection.rs b/mullvad-tests/tests/connection.rs
index e2b14be965..6556e9753b 100644
--- a/mullvad-tests/tests/connection.rs
+++ b/mullvad-tests/tests/connection.rs
@@ -1,19 +1,12 @@
#![cfg(feature = "integration-tests")]
-extern crate mullvad_ipc_client;
-extern crate mullvad_tests;
-extern crate talpid_types;
-
-use std::fs;
-use std::path::Path;
-use std::sync::mpsc;
-use std::time::Duration;
-
+use mullvad_tests::{
+ mock_openvpn::search_openvpn_args, watch_event, DaemonRunner, MockOpenVpnPluginRpcClient,
+ PathWatcher,
+};
+use std::{fs, path::Path, sync::mpsc, time::Duration};
use talpid_types::tunnel::TunnelStateTransition;
-use mullvad_tests::mock_openvpn::search_openvpn_args;
-use mullvad_tests::{watch_event, DaemonRunner, MockOpenVpnPluginRpcClient, PathWatcher};
-
#[cfg(target_os = "linux")]
const OPENVPN_PLUGIN_NAME: &str = "libtalpid_openvpn_plugin.so";
diff --git a/mullvad-tests/tests/startup.rs b/mullvad-tests/tests/startup.rs
index 3281489b6d..3e6ad205ce 100644
--- a/mullvad-tests/tests/startup.rs
+++ b/mullvad-tests/tests/startup.rs
@@ -1,12 +1,7 @@
#![cfg(feature = "integration-tests")]
-extern crate mullvad_paths;
-extern crate mullvad_tests;
-extern crate talpid_types;
-
-use talpid_types::tunnel::TunnelStateTransition;
-
use mullvad_tests::DaemonRunner;
+use talpid_types::tunnel::TunnelStateTransition;
#[test]
fn starts_in_disconnected_state() {