Add -4/--no-ipv6 option
This commit is contained in:
parent
b2e4cc4398
commit
aecfa365a0
1 changed files with 6 additions and 1 deletions
|
|
@ -29,6 +29,9 @@ struct ConfigOpts {
|
||||||
|
|
||||||
#[clap(short, long)]
|
#[clap(short, long)]
|
||||||
no_dns: bool,
|
no_dns: bool,
|
||||||
|
|
||||||
|
#[clap(short='4', long)]
|
||||||
|
no_ipv6: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clap, Debug)]
|
#[derive(Clap, Debug)]
|
||||||
|
|
@ -168,8 +171,10 @@ fn write_config(
|
||||||
writeln!(output, "PrivateKey = {}", &keys.private_key)?;
|
writeln!(output, "PrivateKey = {}", &keys.private_key)?;
|
||||||
writeln!(output, "Address = {}", &config.data.address)?;
|
writeln!(output, "Address = {}", &config.data.address)?;
|
||||||
if !config_opts.no_dns {
|
if !config_opts.no_dns {
|
||||||
|
let dns_addrs = config.data.dns()?;
|
||||||
|
let allowed_dns_addrs = dns_addrs.iter().filter(|addr| addr.is_ipv4() || !config_opts.no_ipv6);
|
||||||
write!(output, "DNS = ")?;
|
write!(output, "DNS = ")?;
|
||||||
write_list(output, config.data.dns()?)?;
|
write_list(output, allowed_dns_addrs)?;
|
||||||
}
|
}
|
||||||
writeln!(output)?;
|
writeln!(output)?;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue