mirror of
https://github.com/rosenpass/rosenpass.git
synced 2026-02-27 22:13:12 -08:00
chore: cargo fmt
This commit is contained in:
@@ -5,7 +5,7 @@ use std::process::Command;
|
|||||||
use std::thread;
|
use std::thread;
|
||||||
|
|
||||||
use anyhow::{bail, ensure, Context};
|
use anyhow::{bail, ensure, Context};
|
||||||
use clap::{Parser, Subcommand, ArgGroup};
|
use clap::{ArgGroup, Parser, Subcommand};
|
||||||
use command_fds::{CommandFdExt, FdMapping};
|
use command_fds::{CommandFdExt, FdMapping};
|
||||||
use log::{error, info};
|
use log::{error, info};
|
||||||
use rustix::fd::AsRawFd;
|
use rustix::fd::AsRawFd;
|
||||||
@@ -16,8 +16,8 @@ use rosenpass_ciphers::kem::StaticKem;
|
|||||||
use rosenpass_secret_memory::file::StoreSecret;
|
use rosenpass_secret_memory::file::StoreSecret;
|
||||||
use rosenpass_secret_memory::Public;
|
use rosenpass_secret_memory::Public;
|
||||||
use rosenpass_util::b64::b64_reader;
|
use rosenpass_util::b64::b64_reader;
|
||||||
use rosenpass_util::file::{LoadValue, LoadValueB64};
|
|
||||||
use rosenpass_util::fd::claim_fd;
|
use rosenpass_util::fd::claim_fd;
|
||||||
|
use rosenpass_util::file::{LoadValue, LoadValueB64};
|
||||||
|
|
||||||
use crate::app_server;
|
use crate::app_server;
|
||||||
use crate::app_server::AppServer;
|
use crate::app_server::AppServer;
|
||||||
@@ -25,7 +25,6 @@ use crate::protocol::{SPk, SSk, SymKey};
|
|||||||
|
|
||||||
use super::config;
|
use super::config;
|
||||||
|
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
#[command(author, version, about)]
|
#[command(author, version, about)]
|
||||||
#[clap(group(
|
#[clap(group(
|
||||||
@@ -155,7 +154,10 @@ impl Cli {
|
|||||||
println!(include_str!(env!("ROSENPASS_MAN")));
|
println!(include_str!(env!("ROSENPASS_MAN")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Cli { command: GenConfig { config_file, force }, .. } => {
|
Cli {
|
||||||
|
command: GenConfig { config_file, force },
|
||||||
|
..
|
||||||
|
} => {
|
||||||
ensure!(
|
ensure!(
|
||||||
force || !config_file.exists(),
|
force || !config_file.exists(),
|
||||||
"config file {config_file:?} already exists"
|
"config file {config_file:?} already exists"
|
||||||
@@ -165,7 +167,10 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated - use gen-keys instead
|
// Deprecated - use gen-keys instead
|
||||||
Cli { command: Keygen { args }, .. } => {
|
Cli {
|
||||||
|
command: Keygen { args },
|
||||||
|
..
|
||||||
|
} => {
|
||||||
log::warn!("The 'keygen' command is deprecated. Please use the 'gen-keys' command instead.");
|
log::warn!("The 'keygen' command is deprecated. Please use the 'gen-keys' command instead.");
|
||||||
|
|
||||||
let mut public_key: Option<PathBuf> = None;
|
let mut public_key: Option<PathBuf> = None;
|
||||||
@@ -199,7 +204,8 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Cli {
|
Cli {
|
||||||
command: GenKeys {
|
command:
|
||||||
|
GenKeys {
|
||||||
config_file,
|
config_file,
|
||||||
public_key,
|
public_key,
|
||||||
secret_key,
|
secret_key,
|
||||||
@@ -260,13 +266,14 @@ impl Cli {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ref cli @ Cli {
|
ref cli @ Cli {
|
||||||
command: Exchange {
|
command:
|
||||||
|
Exchange {
|
||||||
ref first_arg,
|
ref first_arg,
|
||||||
ref rest_of_args,
|
ref rest_of_args,
|
||||||
ref config_file,
|
ref config_file,
|
||||||
},
|
},
|
||||||
..
|
..
|
||||||
}=> {
|
} => {
|
||||||
let mut args = Vec::new();
|
let mut args = Vec::new();
|
||||||
args.push(first_arg.clone());
|
args.push(first_arg.clone());
|
||||||
args.extend_from_slice(&rest_of_args[..]);
|
args.extend_from_slice(&rest_of_args[..]);
|
||||||
@@ -280,7 +287,10 @@ impl Cli {
|
|||||||
Self::event_loop(&cli, &config)?;
|
Self::event_loop(&cli, &config)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
Cli { command: Validate { config_files }, .. } => {
|
Cli {
|
||||||
|
command: Validate { config_files },
|
||||||
|
..
|
||||||
|
} => {
|
||||||
for file in config_files {
|
for file in config_files {
|
||||||
match config::Rosenpass::load(&file) {
|
match config::Rosenpass::load(&file) {
|
||||||
Ok(config) => {
|
Ok(config) => {
|
||||||
@@ -366,7 +376,11 @@ impl Cli {
|
|||||||
for cfg_peer in config.peers.iter().by_ref() {
|
for cfg_peer in config.peers.iter().by_ref() {
|
||||||
srv.add_peer(
|
srv.add_peer(
|
||||||
// psk, pk, outfile, outwg, tx_addr
|
// psk, pk, outfile, outwg, tx_addr
|
||||||
cfg_peer.pre_shared_key.as_ref().map(SymKey::load_b64).transpose()?,
|
cfg_peer
|
||||||
|
.pre_shared_key
|
||||||
|
.as_ref()
|
||||||
|
.map(SymKey::load_b64)
|
||||||
|
.transpose()?,
|
||||||
SPk::load(&cfg_peer.public_key)?,
|
SPk::load(&cfg_peer.public_key)?,
|
||||||
cfg_peer.key_out.clone(),
|
cfg_peer.key_out.clone(),
|
||||||
cfg_peer
|
cfg_peer
|
||||||
|
|||||||
Reference in New Issue
Block a user