diff --git a/CHANGELOG.md b/CHANGELOG.md index 52183f0..acff1e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ This project follows [semantic versioning](http://semver.org). - [changed] Updated dependencies - [changed] Changed Rust version to 1.49.0 - [fixed] Added missing peer address propagation +- [fixed] Fixed problem with peer addresses without port ### v2.0.1 (2020-11-07) diff --git a/Cargo.lock b/Cargo.lock index ab39a83..33c8ea8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -376,9 +376,9 @@ checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" [[package]] name = "idna" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" dependencies = [ "matches", "unicode-bidi", @@ -911,9 +911,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "standback" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66a8cff4fa24853fdf6b51f75c6d7f8206d7c75cab4e467bcd7f25c2b1febe0" +checksum = "a2beb4d1860a61f571530b3f855a1b538d0200f7871c63331ecd6f17b1f014f8" dependencies = [ "version_check", ] diff --git a/src/cloud.rs b/src/cloud.rs index 9281f4e..7bcc0eb 100644 --- a/src/cloud.rs +++ b/src/cloud.rs @@ -242,12 +242,8 @@ impl GenericCloud addrs, Err(err) => { @@ -465,7 +461,6 @@ impl GenericCloud, + }, /// Run a websocket proxy #[cfg(feature = "websocket")] @@ -519,7 +523,7 @@ pub enum Command { /// Generate shell completions Completion { /// Shell to create completions for - #[structopt(long)] + #[structopt(long, default_value="bash")] shell: Shell } } diff --git a/src/main.rs b/src/main.rs index 9cdd511..6d59069 100644 --- a/src/main.rs +++ b/src/main.rs @@ -45,7 +45,7 @@ use std::{ use crate::{ cloud::GenericCloud, - config::{Args, Command, Config}, + config::{Args, Command, Config, DEFAULT_PORT}, crypto::Crypto, device::{Device, TunTapDevice, Type}, net::Socket, @@ -185,7 +185,11 @@ fn run(config: Config, socket: S) { }; let mut cloud = GenericCloud::::new(&config, socket, device, port_forwarding, stats_file); - for addr in config.peers { + for mut addr in config.peers { + if addr.find(':').unwrap_or(0) <= addr.find(']').unwrap_or(0) { + // : not present or only in IPv6 address + addr = format!("{}:{}", addr, DEFAULT_PORT) + } try_fail!(cloud.connect(&addr as &str), "Failed to send message to {}: {}", &addr); cloud.add_reconnect_peer(addr); } @@ -239,8 +243,8 @@ fn main() { }); if let Some(cmd) = args.cmd { match cmd { - Command::GenKey => { - let (privkey, pubkey) = Crypto::generate_keypair(args.password.as_deref()); + Command::GenKey { password } => { + let (privkey, pubkey) = Crypto::generate_keypair(password.as_deref()); println!("Private key: {}\nPublic key: {}\n", privkey, pubkey); println!( "Attention: Keep the private key secret and use only the public key on other nodes to establish trust." diff --git a/vpncloud.adoc b/vpncloud.adoc index 4871191..c1f162a 100644 --- a/vpncloud.adoc +++ b/vpncloud.adoc @@ -45,7 +45,10 @@ vpncloud - Peer-to-peer VPN The address on which to listen for data. This can be simply a port number or a full address in form IP:PORT. If the IP is specified as \'\*' or only a port number is given, then the socket will listen on all IPs (v4 and v6), - otherwise the socket will only listen on the given IP. [default: **3210**] + otherwise the socket will only listen on the given IP. + Alternatively, a websocket proxy URL (starting with ws://) can be given + here. Please see the section *WEBSOCKET PROXY* for more info. + [default: **3210**] *-c *, *--peer *, *--connect *:: Address of a peer to connect to. The address should be in the form @@ -62,31 +65,27 @@ vpncloud - Peer-to-peer VPN Do not automatically claim the IP set on the virtual interface (on TUN devices). -*-p *, *--password *:: +*-p *, *--password *:: A password to encrypt the VPN data. This parameter must be set unless a password is given in a config file or a private key is set. See *SECURITY* for more info. *--key *, *--private-key *:: A private key to use for encryption. The key must be given as base62 as - generated by *--genkey*. See *SECURITY* for more info. + generated by *genkey*. See *SECURITY* for more info. *--public-key *:: A public key matching the given private key. The key must be given as base62 - as generated by *--genkey*. This argument is purely optional. See *SECURITY* + as generated by *genkey*. This argument is purely optional. See *SECURITY* for more info. *--trust *, **--trusted-key *:: A public key to trust. Any peer must have a key pair that is trusted by this node, otherwise it will be rejected. The key must be given as base62 as - generated by *--genkey*. This argument can be given multiple times. If it is + generated by *genkey*. This argument can be given multiple times. If it is not set, only the own public key will be trusted. See *SECURITY* for more info. -*--genkey*:: - Generate and print a random key pair and exit. The key pair is printed as - base62 and can be used as private-key, public-key and trusted-key options. - *--algo *, *--algorithm *:: Supported encryption algorithms ("plain", "aes128", "aes256", or "chacha20"). Nodes exchange the supported algorithms and select the one that is fastest on @@ -178,10 +177,12 @@ vpncloud - Peer-to-peer VPN *--statsd-server *:: If set, periodically send statistics on current traffic and some important - events to the given statsd server (host:port). + events to the given statsd server (host:port). + Please see *STATSD SUPPORT* for more info. *--statsd-prefix *:: Sets the prefix to use for all statsd entries. [default: **vpncloud**] + Please see *STATSD SUPPORT* for more info. *--daemon*:: Spawn a background process instead of running the process in the foreground. @@ -196,6 +197,12 @@ vpncloud - Peer-to-peer VPN Disable automatic port forward. If this option is not set, VpnCloud tries to detect a NAT router and automatically add a port forwarding to it. +*--hook