diff --git a/CHANGELOG.md b/CHANGELOG.md index 783ce32..45594f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,11 @@ This project follows [semantic versioning](http://semver.org). +### UNRELEASED + +- [added] Added more tests +- [changed] Updated dependencies + ### v0.8.0 (2016-11-25) - [added] Support for automatic port forwarding via UPnP @@ -18,6 +23,7 @@ This project follows [semantic versioning](http://semver.org). - [changed] Added timestamps to output - [changed] Using new YAML config instead of old config files (**incompatible**) - [changed] Prefer IPv4 over IPv6 when possible +- [changed] Updated dependencies - [fixed] Fixed documentation of listen parameter - [fixed] Fixed problem with multiple subnets - [fixed] Fixed problem with interrupted poll after suspend to ram diff --git a/Cargo.lock b/Cargo.lock index 0e346cc..78e074c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,12 +13,12 @@ dependencies = [ "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.26 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)", "signal 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "siphasher 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "time 0.1.35 (registry+https://github.com/rust-lang/crates.io-index)", - "yaml-rust 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", + "yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] @@ -107,7 +107,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "hyper" -version = "0.9.12" +version = "0.9.13" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cookie 0.2.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -140,8 +140,8 @@ name = "igd" version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "hyper 0.9.12 (registry+https://github.com/rust-lang/crates.io-index)", - "rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)", + "hyper 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)", + "rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)", "regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)", "xml-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "xmltree 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -237,7 +237,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "rand" -version = "0.3.14" +version = "0.3.15" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.17 (registry+https://github.com/rust-lang/crates.io-index)", @@ -420,7 +420,7 @@ dependencies = [ [[package]] name = "yaml-rust" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" [metadata] @@ -436,7 +436,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum gcc 0.3.38 (registry+https://github.com/rust-lang/crates.io-index)" = "553f11439bdefe755bf366b264820f1da70f3aaf3924e594b886beb9c831bcf5" "checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58" "checksum httparse 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "6a8abece705b1d32c478f49447b3a575cd07f6e362ff12518f2ee2c9b9ced64e" -"checksum hyper 0.9.12 (registry+https://github.com/rust-lang/crates.io-index)" = "d7da01615e9402761faab442396821b57ecb5adb12ac51958561411a82cfdf66" +"checksum hyper 0.9.13 (registry+https://github.com/rust-lang/crates.io-index)" = "86ea0c0ff7e6ef09eff72234800ddb48b6263277936e7ecd6ecd3250345d705f" "checksum idna 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1053236e00ce4f668aeca4a769a09b3bf5a682d802abd6f3cb39374f6b162c11" "checksum igd 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "d75b3c712b68736817ac5c4b730ba29440cdcb1a9fcf6d83bd63a7b5c1f95d92" "checksum kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" @@ -451,7 +451,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum nix 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "7a7bb1da2be7da3cbffda73fc681d509ffd9e665af478d2bee1907cee0bc64b2" "checksum num_cpus 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "8890e6084723d57d0df8d2720b0d60c6ee67d6c93e7169630e4371e88765dcad" "checksum pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)" = "8cee804ecc7eaf201a4a207241472cc870e825206f6c031e3ee2a72fa425f2fa" -"checksum rand 0.3.14 (registry+https://github.com/rust-lang/crates.io-index)" = "2791d88c6defac799c3f20d74f094ca33b9332612d9aef9078519c82e4fe04a5" +"checksum rand 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)" = "022e0636ec2519ddae48154b028864bdce4eaf7d35226ab8e65c611be97b189d" "checksum regex 0.1.80 (registry+https://github.com/rust-lang/crates.io-index)" = "4fd4ace6a8cf7860714a2c2280d6c1f7e6a413486c13298bbc86fd3da019402f" "checksum regex-syntax 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "f9ec002c35e86791825ed294b50008eea9ddfc8def4420124fbc6b08db834957" "checksum rustc-serialize 0.3.21 (registry+https://github.com/rust-lang/crates.io-index)" = "bff9fc1c79f2dec76b253273d07682e94a978bd8f132ded071188122b2af9818" @@ -477,4 +477,4 @@ source = "registry+https://github.com/rust-lang/crates.io-index" "checksum ws2_32-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" "checksum xml-rs 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "65e74b96bd3179209dc70a980da6df843dff09e46eee103a0376c0949257e3ef" "checksum xmltree 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "472a9d37c7c53ab2391161df5b89b1f3bf76dab6ab150d7941ecbdd832282082" -"checksum yaml-rust 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "371cea3a33a58d11dc83c0992fb37e44f651ebdf2df12f9d939f6cb24be2a8fd" +"checksum yaml-rust 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e66366e18dc58b46801afbf2ca7661a9f59cc8c5962c29892b6039b4f86fa992" diff --git a/Cargo.toml b/Cargo.toml index fa4cf37..4e985c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,3 +37,9 @@ bench = [] [profile.release] lto = true + +[profile.dev] +lto = false + +[profile.test] +lto = false diff --git a/src/tests.rs b/src/tests.rs index f975e68..2ca307a 100644 --- a/src/tests.rs +++ b/src/tests.rs @@ -400,7 +400,9 @@ fn config_file() { let config_file = " device_type: tun device_name: vpncloud%d +magic: 0123ABCD ifup: ifconfig $IFNAME 10.0.1.1/16 mtu 1400 up +ifdown: 'true' crypto: aes256 shared_key: mysecret port: 3210 @@ -408,6 +410,7 @@ peers: - remote.machine.foo:3210 - remote.machine.bar:3210 peer_timeout: 1800 +dst_timeout: 300 mode: normal subnets: - 10.0.1.0/24 @@ -420,15 +423,15 @@ pid_file: /run/vpncloud.run device_type: Some(Type::Tun), device_name: Some("vpncloud%d".to_string()), ifup: Some("ifconfig $IFNAME 10.0.1.1/16 mtu 1400 up".to_string()), - ifdown: None, + ifdown: Some("true".to_string()), crypto: Some(CryptoMethod::AES256), shared_key: Some("mysecret".to_string()), - magic: None, + magic: Some("0123ABCD".to_string()), port: Some(3210), peers: Some(vec!["remote.machine.foo:3210".to_string(), "remote.machine.bar:3210".to_string()]), peer_timeout: Some(1800), mode: Some(Mode::Normal), - dst_timeout: None, + dst_timeout: Some(300), subnets: Some(vec!["10.0.1.0/24".to_string()]), port_forwarding: Some(true), user: Some("nobody".to_string()), @@ -444,17 +447,17 @@ fn config_merge() { device_type: Some(Type::Tun), device_name: Some("vpncloud%d".to_string()), ifup: Some("ifconfig $IFNAME 10.0.1.1/16 mtu 1400 up".to_string()), - ifdown: None, + ifdown: Some("true".to_string()), crypto: Some(CryptoMethod::AES256), shared_key: Some("mysecret".to_string()), - magic: None, + magic: Some("0123ABCD".to_string()), port: Some(3210), peers: Some(vec!["remote.machine.foo:3210".to_string(), "remote.machine.bar:3210".to_string()]), peer_timeout: Some(1800), mode: Some(Mode::Normal), - dst_timeout: None, + dst_timeout: Some(300), subnets: Some(vec!["10.0.1.0/24".to_string()]), - port_forwarding: None, + port_forwarding: Some(true), user: Some("nobody".to_string()), group: Some("nogroup".to_string()), pid_file: Some("/run/vpncloud.run".to_string()) @@ -463,12 +466,16 @@ fn config_merge() { device_type: Type::Tun, device_name: "vpncloud%d".to_string(), ifup: Some("ifconfig $IFNAME 10.0.1.1/16 mtu 1400 up".to_string()), + ifdown: Some("true".to_string()), + magic: Some("0123ABCD".to_string()), crypto: CryptoMethod::AES256, shared_key: Some("mysecret".to_string()), port: 3210, peers: vec!["remote.machine.foo:3210".to_string(), "remote.machine.bar:3210".to_string()], peer_timeout: 1800, + dst_timeout: 300, mode: Mode::Normal, + port_forwarding: true, subnets: vec!["10.0.1.0/24".to_string()], user: Some("nobody".to_string()), group: Some("nogroup".to_string()), @@ -478,25 +485,42 @@ fn config_merge() { config.merge_args(Args{ flag_type: Some(Type::Tap), flag_device: Some("vpncloud0".to_string()), - flag_shared_key: None, + flag_ifup: Some("ifconfig $IFNAME 10.0.1.2/16 mtu 1400 up".to_string()), + flag_ifdown: Some("ifconfig $IFNAME down".to_string()), + flag_crypto: Some(CryptoMethod::ChaCha20), + flag_shared_key: Some("anothersecret".to_string()), + flag_magic: Some("hash:mynet".to_string()), + flag_listen: Some(3211), + flag_peer_timeout: Some(1801), + flag_dst_timeout: Some(301), flag_subnet: vec![], flag_connect: vec!["another:3210".to_string()], + flag_no_port_forwarding: true, + flag_daemon: true, + flag_pid_file: Some("/run/vpncloud-mynet.run".to_string()), + flag_user: Some("root".to_string()), + flag_group: Some("root".to_string()), ..Default::default() }); assert_eq!(config, Config{ device_type: Type::Tap, device_name: "vpncloud0".to_string(), - ifup: Some("ifconfig $IFNAME 10.0.1.1/16 mtu 1400 up".to_string()), - crypto: CryptoMethod::AES256, - shared_key: Some("mysecret".to_string()), - port: 3210, + ifup: Some("ifconfig $IFNAME 10.0.1.2/16 mtu 1400 up".to_string()), + ifdown: Some("ifconfig $IFNAME down".to_string()), + magic: Some("hash:mynet".to_string()), + crypto: CryptoMethod::ChaCha20, + shared_key: Some("anothersecret".to_string()), + port: 3211, peers: vec!["remote.machine.foo:3210".to_string(), "remote.machine.bar:3210".to_string(), "another:3210".to_string()], - peer_timeout: 1800, + peer_timeout: 1801, + dst_timeout: 301, mode: Mode::Normal, + port_forwarding: false, subnets: vec!["10.0.1.0/24".to_string()], - user: Some("nobody".to_string()), - group: Some("nogroup".to_string()), - pid_file: Some("/run/vpncloud.run".to_string()), + user: Some("root".to_string()), + group: Some("root".to_string()), + pid_file: Some("/run/vpncloud-mynet.run".to_string()), + daemonize: true, ..Default::default() }); }