aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJake McGinty <me@jake.su>2018-02-14 15:11:36 +0000
committerJake McGinty <me@jake.su>2018-02-14 15:11:36 +0000
commitc67ec520d4c9c8e3273049d8c83550288492b28f (patch)
treef0fdfc72e0226b6336c546e696b4e6db49ecd8fa
parentno need to panic on a Duration error. (diff)
downloadwireguard-rs-c67ec520d4c9c8e3273049d8c83550288492b28f.tar.xz
wireguard-rs-c67ec520d4c9c8e3273049d8c83550288492b28f.zip
clear unused imports
-rw-r--r--src/error.rs2
-rw-r--r--src/interface/config.rs10
-rw-r--r--src/interface/mod.rs11
-rw-r--r--src/interface/peer_server.rs27
-rw-r--r--src/ip_packet.rs3
-rw-r--r--src/main.rs8
-rw-r--r--src/noise.rs4
-rw-r--r--src/protocol/peer.rs18
-rw-r--r--src/router.rs7
-rw-r--r--src/tai64n.rs1
-rw-r--r--src/timer.rs6
-rw-r--r--src/types.rs6
12 files changed, 31 insertions, 72 deletions
diff --git a/src/error.rs b/src/error.rs
index 5e2a624..0cddd08 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -1,4 +1,4 @@
-use failure::Error;
+//use failure::Error;
//#[derive(Debug, Fail)]
//enum WireguardError {
diff --git a/src/interface/config.rs b/src/interface/config.rs
index a0ebfdb..e3505d0 100644
--- a/src/interface/config.rs
+++ b/src/interface/config.rs
@@ -5,20 +5,14 @@
use bytes::BytesMut;
use failure::Error;
-use std;
use std::fs::{create_dir, remove_file};
use std::mem;
use std::iter::Iterator;
use std::path::{Path, PathBuf};
-use std::io;
use std::str;
-use std::net::{SocketAddr, IpAddr};
-use types::{PeerInfo, InterfaceInfo};
-use hex::{FromHex};
+use types::PeerInfo;
+use hex::FromHex;
-use futures::{Future, Stream};
-use futures::unsync::mpsc;
-use tokio_io::{AsyncRead, AsyncWrite};
use tokio_io::codec::{Encoder, Decoder};
#[derive(Debug)]
diff --git a/src/interface/mod.rs b/src/interface/mod.rs
index aa55c29..3925eff 100644
--- a/src/interface/mod.rs
+++ b/src/interface/mod.rs
@@ -2,34 +2,27 @@ mod config;
mod peer_server;
use self::config::{ConfigurationServiceManager, UpdateEvent, Command, ConfigurationCodec};
-use self::peer_server::{PeerServer, PeerServerMessage};
+use self::peer_server::PeerServer;
use router::Router;
use base64;
use hex;
-use noise::Noise;
-use byteorder::{ByteOrder, BigEndian, LittleEndian};
use failure::Error;
use protocol::Peer;
use std::io;
use std::rc::Rc;
use std::cell::RefCell;
use std::collections::HashMap;
-use std::net::{Ipv4Addr, Ipv6Addr, IpAddr, SocketAddr};
-use std::time::Duration;
use types::{InterfaceInfo};
use x25519_dalek as x25519;
use pnet::packet::ipv4::Ipv4Packet;
use futures::{Future, Stream, Sink, future, unsync, sync, stream};
-use tokio_core::reactor::{Core, Handle};
-use tokio_core::net::{UdpSocket, UdpCodec};
+use tokio_core::reactor::Core;
use tokio_utun::{UtunStream, UtunCodec};
use tokio_io::{AsyncRead};
-use tokio_io::codec::{Framed, Encoder, Decoder};
use tokio_uds::{UnixListener};
-use tokio_timer::{Interval, Timer};
pub fn trace_packet(header: &str, packet: &[u8]) {
diff --git a/src/interface/peer_server.rs b/src/interface/peer_server.rs
index a60f4bb..f070a18 100644
--- a/src/interface/peer_server.rs
+++ b/src/interface/peer_server.rs
@@ -1,26 +1,19 @@
-use super::{SharedState, SharedPeer, UtunPacket, trace_packet};
-use consts::{REKEY_TIMEOUT, REKEY_AFTER_TIME, KEEPALIVE_TIMEOUT, MAX_CONTENT_SIZE, TRANSPORT_HEADER_SIZE, TRANSPORT_OVERHEAD};
-use protocol::{Peer, Session, SessionType};
+use super::{SharedState, UtunPacket, trace_packet};
+use consts::{REKEY_TIMEOUT, REKEY_AFTER_TIME, KEEPALIVE_TIMEOUT, MAX_CONTENT_SIZE};
+use protocol::{Peer, SessionType};
use noise::Noise;
use timer::{Timer, TimerMessage};
use std::io;
-use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr};
-use std::time::{Duration, Instant, SystemTime};
-
-use base64;
-use byteorder::{ByteOrder, BigEndian, LittleEndian};
-use failure::{Error, SyncFailure};
-use futures::{self, Async, Future, Stream, Sink, Poll, future, unsync, sync, stream};
-use pnet::packet::ipv4::Ipv4Packet;
-use pnet::packet::ipv6::Ipv6Packet;
-use pnet::packet::ethernet::{EtherTypes, EthernetPacket};
-use socket2::{Socket, Domain, Type, SockAddr, Protocol};
-use snow;
+use std::net::{IpAddr, Ipv6Addr, SocketAddr};
+use std::time::{Duration, Instant};
+
+use byteorder::{ByteOrder, LittleEndian};
+use failure::Error;
+use futures::{self, Async, Future, Stream, Sink, Poll, unsync, stream};
+use socket2::{Socket, Domain, Type, Protocol};
use tokio_core::net::{UdpSocket, UdpCodec, UdpFramed};
use tokio_core::reactor::Handle;
-use tokio_io::codec::Framed;
-use treebitmap::{IpLookupTable, IpLookupTableOps};
pub type PeerServerMessage = (SocketAddr, Vec<u8>);
diff --git a/src/ip_packet.rs b/src/ip_packet.rs
index 5f342b8..d5398dd 100644
--- a/src/ip_packet.rs
+++ b/src/ip_packet.rs
@@ -1,7 +1,6 @@
-use failure::Error;
use pnet::packet::ipv4::Ipv4Packet;
use pnet::packet::ipv6::Ipv6Packet;
-use std::net::{Ipv4Addr, Ipv6Addr, IpAddr, SocketAddr};
+use std::net::IpAddr;
pub enum IpPacket<'a> {
V4(Ipv4Packet<'a>),
diff --git a/src/main.rs b/src/main.rs
index 011838f..a50e73b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -2,10 +2,8 @@
#![feature(option_filter)]
#![feature(try_trait)]
#![feature(test)]
-#![allow(unused_imports)]
#[macro_use] extern crate failure;
-#[macro_use] extern crate futures;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate log;
#[macro_use] extern crate structopt_derive;
@@ -16,6 +14,7 @@ extern crate byteorder;
extern crate bytes;
extern crate daemonize;
extern crate env_logger;
+extern crate futures;
extern crate hex;
extern crate nix;
extern crate pnet;
@@ -46,9 +45,8 @@ mod tai64n;
mod timer;
mod ip_packet;
-use std::path::PathBuf;
-
-use daemonize::Daemonize;
+//use std::path::PathBuf;
+//use daemonize::Daemonize;
use interface::Interface;
use structopt::StructOpt;
diff --git a/src/noise.rs b/src/noise.rs
index b869629..4870f41 100644
--- a/src/noise.rs
+++ b/src/noise.rs
@@ -1,10 +1,8 @@
-use blake2_rfc::blake2s::{Blake2s, blake2s};
+use blake2_rfc::blake2s::blake2s;
use failure::{Error, SyncFailure};
use snow::{NoiseBuilder, Session};
use snow::params::NoiseParams;
-use snow::wrappers::crypto_wrapper::Dh25519;
use subtle;
-use types::{InterfaceInfo, PeerInfo};
lazy_static! {
diff --git a/src/protocol/peer.rs b/src/protocol/peer.rs
index e6f6eda..cf2f7f9 100644
--- a/src/protocol/peer.rs
+++ b/src/protocol/peer.rs
@@ -1,30 +1,18 @@
use anti_replay::AntiReplay;
-use byteorder::{ByteOrder, BigEndian, LittleEndian};
+use byteorder::{ByteOrder, LittleEndian};
use consts::{TRANSPORT_OVERHEAD, TRANSPORT_HEADER_SIZE, MAX_SEGMENT_SIZE, REJECT_AFTER_MESSAGES};
use failure::{Error, SyncFailure};
use noise::Noise;
-use pnet::packet::Packet;
-use pnet::packet::ip::IpNextHeaderProtocols;
-use pnet::packet::ipv4::{self, MutableIpv4Packet};
-use pnet::packet::icmp::{self, MutableIcmpPacket, IcmpTypes, echo_reply, echo_request};
-use std::{self, io, mem};
+use std::{self, mem};
use std::fmt::{self, Debug, Display, Formatter};
-use std::net::{Ipv4Addr, IpAddr, SocketAddr, ToSocketAddrs};
-use std::str::FromStr;
+use std::net::SocketAddr;
use std::time::{SystemTime, Instant, UNIX_EPOCH};
-use std::thread::JoinHandle;
-use base64;
use hex;
use tai64n::TAI64N;
-use time;
use rand::{self, Rng};
use snow;
use types::PeerInfo;
-use futures::{self, Future};
-use tokio_core::reactor::Handle;
-use tokio_core::net::{UdpSocket, UdpCodec};
-
#[derive(Default)]
pub struct Peer {
pub info: PeerInfo,
diff --git a/src/router.rs b/src/router.rs
index e01f80a..252a653 100644
--- a/src/router.rs
+++ b/src/router.rs
@@ -1,11 +1,8 @@
use failure::Error;
-use interface::{SharedPeer, UtunPacket};
-use protocol::Peer;
+use interface::SharedPeer;
use treebitmap::{IpLookupTable, IpLookupTableOps};
-use std::net::{Ipv4Addr, Ipv6Addr, IpAddr, SocketAddr};
+use std::net::{Ipv4Addr, Ipv6Addr, IpAddr};
use ip_packet::IpPacket;
-use pnet::packet::ipv4::Ipv4Packet;
-use pnet::packet::ipv6::Ipv6Packet;
/// The `Router` struct is, as one might expect, the authority for the IP routing table.
pub struct Router {
diff --git a/src/tai64n.rs b/src/tai64n.rs
index 818d57d..bfb4a78 100644
--- a/src/tai64n.rs
+++ b/src/tai64n.rs
@@ -1,5 +1,4 @@
use byteorder::{ByteOrder, BigEndian};
-use std::time::{SystemTime, UNIX_EPOCH};
use std::ops::Deref;
use time;
diff --git a/src/timer.rs b/src/timer.rs
index 7b7c9c7..6d033dd 100644
--- a/src/timer.rs
+++ b/src/timer.rs
@@ -1,12 +1,12 @@
-use failure::Error;
-use futures::{self, Async, Future, Stream, Sink, Poll, future, unsync, sync, stream};
+use futures::{Future, Stream, Sink, Poll, unsync};
use std::time::Duration;
use tokio_core::reactor::Handle;
-use tokio_timer::{self, Interval};
+use tokio_timer;
use interface::SharedPeer;
#[derive(Debug)]
pub enum TimerMessage {
+ // PersistentKeepAlive(SharedPeer, u32),
KeepAlive(SharedPeer, u32),
Rekey(SharedPeer, u32),
}
diff --git a/src/types.rs b/src/types.rs
index 10f6c17..0191ed7 100644
--- a/src/types.rs
+++ b/src/types.rs
@@ -1,8 +1,8 @@
use base64;
-use std::io::{self, Cursor, Read, Write};
-use byteorder::{BigEndian, LittleEndian, WriteBytesExt, ReadBytesExt};
+use std::io::{Cursor, Read, Write};
+use byteorder::{LittleEndian, WriteBytesExt, ReadBytesExt};
use std::fmt::{self, Display, Formatter};
-use std::net::{Ipv4Addr, IpAddr, SocketAddr};
+use std::net::{IpAddr, SocketAddr};
#[derive(Clone, Debug, Default)]
pub struct PeerInfo {