diff options
Diffstat (limited to 'talpid-openvpn-plugin')
| -rw-r--r-- | talpid-openvpn-plugin/src/lib.rs | 20 | ||||
| -rw-r--r-- | talpid-openvpn-plugin/src/processing.rs | 21 |
2 files changed, 19 insertions, 22 deletions
diff --git a/talpid-openvpn-plugin/src/lib.rs b/talpid-openvpn-plugin/src/lib.rs index 33a9198ecd..db0e3bf41c 100644 --- a/talpid-openvpn-plugin/src/lib.rs +++ b/talpid-openvpn-plugin/src/lib.rs @@ -9,20 +9,20 @@ extern crate env_logger; #[macro_use] extern crate error_chain; -#[macro_use] extern crate log; -#[macro_use] -extern crate jsonrpc_client_core; extern crate futures; +extern crate jsonrpc_client_core; extern crate jsonrpc_client_ipc; -#[macro_use] extern crate openvpn_plugin; extern crate tokio; extern crate tokio_reactor; use error_chain::ChainedError; -use openvpn_plugin::types::{EventResult, OpenVpnPluginEvent}; +use openvpn_plugin::{ + openvpn_plugin, + types::{EventResult, OpenVpnPluginEvent}, +}; use std::collections::HashMap; use std::ffi::CString; use std::sync::Mutex; @@ -77,10 +77,10 @@ fn openvpn_open( _env: HashMap<CString, CString>, ) -> Result<(Vec<OpenVpnPluginEvent>, Mutex<EventProcessor>)> { env_logger::init(); - debug!("Initializing plugin"); + log::debug!("Initializing plugin"); let arguments = parse_args(&args)?; - info!( + log::info!( "Connecting back to talpid core at {}", arguments.ipc_socket_path ); @@ -104,7 +104,7 @@ fn parse_args(args: &[CString]) -> Result<Arguments> { fn openvpn_close(_handle: Mutex<EventProcessor>) { - info!("Unloading plugin"); + log::info!("Unloading plugin"); } fn openvpn_event( @@ -113,7 +113,7 @@ fn openvpn_event( env: HashMap<CString, CString>, handle: &mut Mutex<EventProcessor>, ) -> Result<EventResult> { - debug!("Received event: {:?}", event); + log::debug!("Received event: {:?}", event); let parsed_env = openvpn_plugin::ffi::parse::env_utf8(&env).chain_err(|| ErrorKind::ParseEnvFailed)?; @@ -126,7 +126,7 @@ fn openvpn_event( match result { Ok(()) => Ok(EventResult::Success), Err(e) => { - error!("{}", e.display_chain()); + log::error!("{}", e.display_chain()); Ok(EventResult::Failure) } } diff --git a/talpid-openvpn-plugin/src/processing.rs b/talpid-openvpn-plugin/src/processing.rs index fde658a7f9..5ac6bed8d3 100644 --- a/talpid-openvpn-plugin/src/processing.rs +++ b/talpid-openvpn-plugin/src/processing.rs @@ -1,16 +1,13 @@ -use openvpn_plugin; -use std::collections::HashMap; - extern crate futures; -use jsonrpc_client_core::{Future, Result as ClientResult, Transport}; -use jsonrpc_client_ipc::IpcTransport; - -use tokio::reactor::Handle; -use tokio::runtime::Runtime; - use super::Arguments; -use std::thread; +use jsonrpc_client_core::{ + expand_params, jsonrpc_client, Future, Result as ClientResult, Transport, +}; +use jsonrpc_client_ipc::IpcTransport; +use openvpn_plugin; +use std::{collections::HashMap, thread}; +use tokio::{reactor::Handle, runtime::Runtime}; error_chain! { errors { @@ -34,7 +31,7 @@ pub struct EventProcessor { impl EventProcessor { pub fn new(arguments: Arguments) -> Result<EventProcessor> { - trace!("Creating EventProcessor"); + log::trace!("Creating EventProcessor"); let (start_tx, start_rx) = futures::sync::oneshot::channel(); thread::spawn(move || { let mut rt = Runtime::new().expect("failed to spawn runtime"); @@ -68,7 +65,7 @@ impl EventProcessor { event: openvpn_plugin::types::OpenVpnPluginEvent, env: HashMap<String, String>, ) -> Result<()> { - trace!("Processing \"{:?}\" event", event); + log::trace!("Processing \"{:?}\" event", event); let call_future = self .ipc_client .openvpn_event(event, env) |
