Skip to content

Commit

Permalink
fix: fix allowed ips in windows (#70)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-aleksander authored Sep 23, 2024
1 parent 182d397 commit 7ca032f
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/wgapi_windows.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,15 +114,17 @@ impl WireguardInterfaceApi for WireguardApiWindows {
wireguard_configuration.push_str(format!("\nEndpoint = {}", endpoint).as_str());
}

let allowed_ips = format!(
"\nAllowedIPs = {}",
peer.allowed_ips
.iter()
.map(|v| v.to_string())
.collect::<Vec<String>>()
.join(",")
);
wireguard_configuration.push_str(allowed_ips.as_str());
if !peer.allowed_ips.is_empty() {
let allowed_ips = format!(
"\nAllowedIPs = {}",
peer.allowed_ips
.iter()
.map(|v| v.to_string())
.collect::<Vec<String>>()
.join(",")
);
wireguard_configuration.push_str(allowed_ips.as_str());
}
}

file.write_all(wireguard_configuration.as_bytes())?;
Expand Down

0 comments on commit 7ca032f

Please sign in to comment.