Add support for multiple endpoint IPs
This commit is contained in:
parent
2b06fff6ea
commit
57623876de
1 changed files with 3 additions and 6 deletions
|
|
@ -169,11 +169,6 @@ fn write_config(
|
|||
config: &WireguardConfig,
|
||||
keys: &WireguardKeyPair,
|
||||
) -> Result<(), anyhow::Error> {
|
||||
let mut endpoint_addrs = config.data.endpoint.to_socket_addrs()?;
|
||||
let endpoint_addr = endpoint_addrs
|
||||
.next()
|
||||
.ok_or_else(|| anyhow::anyhow!("no endpoint address received"))?;
|
||||
debug!("endpoint_addr = {:?}", &endpoint_addr);
|
||||
writeln!(output, "[Interface]")?;
|
||||
writeln!(output, "PrivateKey = {}", &keys.private_key)?;
|
||||
let addresses = config.data.addresses()?;
|
||||
|
|
@ -192,7 +187,9 @@ fn write_config(
|
|||
|
||||
writeln!(output, "[Peer]")?;
|
||||
writeln!(output, "PublicKey = {}", &config.data.public_key)?;
|
||||
writeln!(output, "Endpoint = {}", &endpoint_addr)?;
|
||||
|
||||
let endpoint_addrs = config.data.endpoint.to_socket_addrs()?;
|
||||
write_list(output, "Endpoint = ", endpoint_addrs)?;
|
||||
|
||||
let allowed_ips: &[&str] = if config_opts.no_ipv6 { &["0.0.0.0", "::0"] } else { &["0.0.0.0"] };
|
||||
write_list(output, "AllowedIPs = ", allowed_ips)?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue