meta: make clippy happy
parent
e166619883
commit
426916fadd
|
@ -143,13 +143,11 @@ pub fn init_wizard(conf: &ServerConfig, opts: InitializeOpts) -> Result<(), Erro
|
||||||
|
|
||||||
let endpoint: Endpoint = if let Some(endpoint) = opts.external_endpoint {
|
let endpoint: Endpoint = if let Some(endpoint) = opts.external_endpoint {
|
||||||
endpoint
|
endpoint
|
||||||
|
} else if opts.auto_external_endpoint {
|
||||||
|
let ip = publicip::get_any(Preference::Ipv4)?.ok_or("couldn't get external IP")?;
|
||||||
|
SocketAddr::new(ip, 51820).into()
|
||||||
} else {
|
} else {
|
||||||
if opts.auto_external_endpoint {
|
prompts::ask_endpoint()?
|
||||||
let ip = publicip::get_any(Preference::Ipv4)?.ok_or("couldn't get external IP")?;
|
|
||||||
SocketAddr::new(ip, 51820).into()
|
|
||||||
} else {
|
|
||||||
prompts::ask_endpoint()?
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
let listen_port: u16 = if let Some(listen_port) = opts.listen_port {
|
let listen_port: u16 = if let Some(listen_port) = opts.listen_port {
|
||||||
|
|
|
@ -204,7 +204,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
if let Err(e) = initialize::init_wizard(&conf, opts) {
|
if let Err(e) = initialize::init_wizard(&conf, opts) {
|
||||||
println!("{}: {}.", "creation failed".red(), e);
|
println!("{}: {}.", "creation failed".red(), e);
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
Command::Uninstall { interface } => uninstall(&interface, &conf)?,
|
Command::Uninstall { interface } => uninstall(&interface, &conf)?,
|
||||||
Command::Serve { interface } => serve(*interface, &conf).await?,
|
Command::Serve { interface } => serve(*interface, &conf).await?,
|
||||||
Command::AddPeer { interface, args } => add_peer(&interface, &conf, args)?,
|
Command::AddPeer { interface, args } => add_peer(&interface, &conf, args)?,
|
||||||
|
@ -402,8 +402,8 @@ async fn serve(interface: InterfaceName, conf: &ServerConfig) -> Result<(), Erro
|
||||||
|
|
||||||
let context = Context {
|
let context = Context {
|
||||||
db,
|
db,
|
||||||
interface,
|
|
||||||
endpoints,
|
endpoints,
|
||||||
|
interface,
|
||||||
public_key,
|
public_key,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ pub fn ensure_dirs_exist(dirs: &[&Path]) -> Result<(), WrappedIoError> {
|
||||||
for dir in dirs {
|
for dir in dirs {
|
||||||
match fs::create_dir(dir).with_path(dir) {
|
match fs::create_dir(dir).with_path(dir) {
|
||||||
Err(e) if e.kind() != io::ErrorKind::AlreadyExists => {
|
Err(e) if e.kind() != io::ErrorKind::AlreadyExists => {
|
||||||
return Err(e.into());
|
return Err(e);
|
||||||
}
|
}
|
||||||
_ => {
|
_ => {
|
||||||
let target_file = File::open(dir).with_path(dir)?;
|
let target_file = File::open(dir).with_path(dir)?;
|
||||||
|
|
Loading…
Reference in New Issue