diff --git a/talpid-tunnel-config-client/examples/psk-exchange.rs b/talpid-tunnel-config-client/examples/psk-exchange.rs index bbf1e71fc782..aa6223315783 100644 --- a/talpid-tunnel-config-client/examples/psk-exchange.rs +++ b/talpid-tunnel-config-client/examples/psk-exchange.rs @@ -4,7 +4,6 @@ // Usage: ./psk-exchange // e. g. ./psk-exchange 10.64.0.1 NkECLsf+VbZUjve7RVN6sE3NYUcYUmUn8qpFugqbXFk= -use std::net::IpAddr; use talpid_types::net::wireguard::{PrivateKey, PublicKey}; #[tokio::main] @@ -24,7 +23,7 @@ async fn main() { let ephemeral_private_key = PrivateKey::new_from_random(); let ephemeral_peer = talpid_tunnel_config_client::request_ephemeral_peer( - IpAddr::V4(tuncfg_server_ip), + tuncfg_server_ip, public_key, // Parent connection's public key. ephemeral_private_key.public_key(), true, // Whether to negotiate a "PQ-safe" PSK. diff --git a/talpid-tunnel-config-client/src/lib.rs b/talpid-tunnel-config-client/src/lib.rs index 3c6abfd7a244..4172a0023a38 100644 --- a/talpid-tunnel-config-client/src/lib.rs +++ b/talpid-tunnel-config-client/src/lib.rs @@ -1,9 +1,9 @@ use proto::PostQuantumRequestV1; use std::fmt; #[cfg(not(target_os = "ios"))] -use std::net::IpAddr; -#[cfg(not(target_os = "ios"))] use std::net::SocketAddr; +#[cfg(not(target_os = "ios"))] +use std::net::{IpAddr, Ipv4Addr}; use talpid_types::net::wireguard::{PresharedKey, PublicKey}; #[cfg(not(target_os = "ios"))] use tokio::net::TcpSocket; @@ -189,7 +189,7 @@ pub async fn request_ephemeral_peer_with( /// Negotiate a short-lived peer with a PQ-safe PSK or with DAITA enabled. #[cfg(not(target_os = "ios"))] pub async fn request_ephemeral_peer( - service_address: IpAddr, + service_address: Ipv4Addr, parent_pubkey: PublicKey, ephemeral_pubkey: PublicKey, enable_post_quantum: bool, @@ -245,8 +245,9 @@ fn xor_assign(dst: &mut [u8; 32], src: &[u8; 32]) { } #[cfg(not(target_os = "ios"))] -async fn new_client(addr: IpAddr) -> Result { +async fn new_client(addr: Ipv4Addr) -> Result { let endpoint = Endpoint::from_static("tcp://0.0.0.0:0"); + let addr = IpAddr::V4(addr); let conn = endpoint .connect_with_connector(service_fn(move |_| async move { diff --git a/talpid-wireguard/src/lib.rs b/talpid-wireguard/src/lib.rs index 6cc9e0be0d7f..1a7ccffec286 100644 --- a/talpid-wireguard/src/lib.rs +++ b/talpid-wireguard/src/lib.rs @@ -716,7 +716,7 @@ impl WireguardMonitor { let ephemeral = tokio::time::timeout( timeout, talpid_tunnel_config_client::request_ephemeral_peer( - IpAddr::from(config.ipv4_gateway), + config.ipv4_gateway, config.tunnel.private_key.public_key(), wg_psk_pubkey, enable_pq,