diff options
| author | Max Zettlmeißl <max@zettlmeissl.de> | 2024-07-20 06:20:25 +0200 |
|---|---|---|
| committer | Linus Färnstrand <faern@faern.net> | 2024-07-23 13:09:01 +0200 |
| commit | 9d9eb6c49351c8b64898cca1eb26c2197fb7dabd (patch) | |
| tree | dc072b00c4634bd264b02ba833b109296f9152e5 | |
| parent | 527f900375f28433c017f4d5003d9f2f8c45f2f8 (diff) | |
| download | mullvadvpn-9d9eb6c49351c8b64898cca1eb26c2197fb7dabd.tar.xz mullvadvpn-9d9eb6c49351c8b64898cca1eb26c2197fb7dabd.zip | |
Only accept an IPv4 as valid first argument
While `request_ephemeral_peer` accepts a generic `IpAddr`, the
function `new_client` used within forces an `Ipv4Addr`.
In the long run it would be best to change the library to support IPv6
(provided that the tunnel configuration service listens to an IPv6) or
to change the signature of `request_ephemeral_peer` to expect an IPv4.
| -rw-r--r-- | talpid-tunnel-config-client/examples/psk-exchange.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/talpid-tunnel-config-client/examples/psk-exchange.rs b/talpid-tunnel-config-client/examples/psk-exchange.rs index 48643805fc..bbf1e71fc7 100644 --- a/talpid-tunnel-config-client/examples/psk-exchange.rs +++ b/talpid-tunnel-config-client/examples/psk-exchange.rs @@ -10,7 +10,7 @@ use talpid_types::net::wireguard::{PrivateKey, PublicKey}; #[tokio::main] async fn main() { let mut args = std::env::args().skip(1); - let tuncfg_server_ip: IpAddr = args + let tuncfg_server_ip = args .next() .expect("Give tuncfg server IP as first argument") .parse() @@ -24,7 +24,7 @@ async fn main() { let ephemeral_private_key = PrivateKey::new_from_random(); let ephemeral_peer = talpid_tunnel_config_client::request_ephemeral_peer( - tuncfg_server_ip, + IpAddr::V4(tuncfg_server_ip), public_key, // Parent connection's public key. ephemeral_private_key.public_key(), true, // Whether to negotiate a "PQ-safe" PSK. |
