Cargo format
This commit is contained in:
parent
9bab810b91
commit
8c0224e983
44 changed files with 1784 additions and 611 deletions
|
|
@ -8,12 +8,15 @@ use symbols::{Action, OwnedSymbolAction, Symbol, SymbolAction, SymbolRunner};
|
|||
|
||||
pub struct TlsKey<'a, C: 'a + CommandRunner> {
|
||||
domain: Cow<'a, str>,
|
||||
command_runner: &'a C
|
||||
command_runner: &'a C,
|
||||
}
|
||||
|
||||
impl<'a, C: CommandRunner> TlsKey<'a, C> {
|
||||
pub fn new(domain: Cow<'a, str>, command_runner: &'a C) -> Self {
|
||||
TlsKey { domain, command_runner }
|
||||
TlsKey {
|
||||
domain,
|
||||
command_runner,
|
||||
}
|
||||
}
|
||||
|
||||
fn get_path(&self) -> String {
|
||||
|
|
@ -37,23 +40,36 @@ impl<'a, C: CommandRunner> Symbol for TlsKey<'a, C> {
|
|||
return Ok(false);
|
||||
}
|
||||
|
||||
let output = try!(self.command_runner.get_output("openssl", &["rsa", "-in", &self.get_path(), "-noout", "-check", "-text"]));
|
||||
let output = try!(self.command_runner.get_output(
|
||||
"openssl",
|
||||
&["rsa", "-in", &self.get_path(), "-noout", "-check", "-text"]
|
||||
));
|
||||
Ok(output.starts_with(&format!("Private-Key: ({} bit)\n", self.get_bytes()).as_bytes()))
|
||||
}
|
||||
|
||||
fn execute(&self) -> Result<(), Box<dyn Error>> {
|
||||
self.command_runner.run_successfully("openssl", &["genrsa", "-out", &self.get_path(), &self.get_bytes().to_string()])
|
||||
self.command_runner.run_successfully(
|
||||
"openssl",
|
||||
&[
|
||||
"genrsa",
|
||||
"-out",
|
||||
&self.get_path(),
|
||||
&self.get_bytes().to_string(),
|
||||
],
|
||||
)
|
||||
}
|
||||
|
||||
fn as_action<'b>(&'b self, runner: &'b dyn SymbolRunner) -> Box<dyn Action + 'b> {
|
||||
Box::new(SymbolAction::new(runner, self))
|
||||
}
|
||||
|
||||
fn into_action<'b>(self: Box<Self>, runner: &'b dyn SymbolRunner) -> Box<dyn Action + 'b> where Self: 'b {
|
||||
fn into_action<'b>(self: Box<Self>, runner: &'b dyn SymbolRunner) -> Box<dyn Action + 'b>
|
||||
where
|
||||
Self: 'b,
|
||||
{
|
||||
Box::new(OwnedSymbolAction::new(runner, *self))
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
}
|
||||
mod test {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue