Skip to content

Commit

Permalink
Only accept an IPv4 as valid first argument
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
maxz authored and faern committed Jul 23, 2024
1 parent 527f900 commit 9d9eb6c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions talpid-tunnel-config-client/examples/psk-exchange.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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.
Expand Down

0 comments on commit 9d9eb6c

Please sign in to comment.