summaryrefslogtreecommitdiffstats
path: root/src/main.rs
blob: 9b69f54dc7d1306c5d57d0183a7489c8a0e34548 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#![feature(test)]
#![allow(dead_code)]

extern crate jemallocator;

#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;

// mod config;
mod constants;
mod handshake;
mod router;
mod timers;
mod types;
mod wireguard;

#[cfg(test)]
mod tests {
    use crate::types::tun::Tun;
    use crate::types::{bind, dummy, tun};
    use crate::wireguard::Wireguard;

    use std::thread;
    use std::time::Duration;

    fn init() {
        let _ = env_logger::builder().is_test(true).try_init();
    }

    #[test]
    fn test_pure_wireguard() {
        init();
        let (reader, writer, mtu) = dummy::TunTest::create("name").unwrap();
        let wg: Wireguard<dummy::TunTest, dummy::PairBind> = Wireguard::new(reader, writer, mtu);
        thread::sleep(Duration::from_millis(500));
    }
}

fn main() {}