Browse Source

Add a dummy tacd standalone server

Even if the tacd server might be one of the last thing implemented using
ring, it should not block the compilation.
pull/5/head
Rodolphe Breard 6 years ago
parent
commit
d897e015c5
  1. 13
      tacd/src/main.rs
  2. 0
      tacd/src/openssl_server.rs
  3. 10
      tacd/src/standalone_server.rs

13
tacd/src/main.rs

@ -1,3 +1,12 @@
#[cfg(not(feature = "standalone"))]
mod openssl_server;
#[cfg(not(feature = "standalone"))]
use openssl_server::start as server_start;
#[cfg(feature = "standalone")]
mod standalone_server;
#[cfg(feature = "standalone")]
use standalone_server::start as server_start;
use acme_common::crypto::X509Certificate; use acme_common::crypto::X509Certificate;
use acme_common::error::Error; use acme_common::error::Error;
use clap::{App, Arg, ArgMatches}; use clap::{App, Arg, ArgMatches};
@ -5,8 +14,6 @@ use log::{debug, error, info};
use std::fs::File; use std::fs::File;
use std::io::{self, Read}; use std::io::{self, Read};
mod server;
const APP_NAME: &str = env!("CARGO_PKG_NAME"); const APP_NAME: &str = env!("CARGO_PKG_NAME");
const APP_VERSION: &str = env!("CARGO_PKG_VERSION"); const APP_VERSION: &str = env!("CARGO_PKG_VERSION");
const DEFAULT_PID_FILE: &str = "/var/run/admed.pid"; const DEFAULT_PID_FILE: &str = "/var/run/admed.pid";
@ -47,7 +54,7 @@ fn init(cnf: &ArgMatches) -> Result<(), Error> {
let listen_addr = cnf.value_of("listen").unwrap_or(DEFAULT_LISTEN_ADDR); let listen_addr = cnf.value_of("listen").unwrap_or(DEFAULT_LISTEN_ADDR);
let (pk, cert) = X509Certificate::from_acme_ext(&domain, &ext)?; let (pk, cert) = X509Certificate::from_acme_ext(&domain, &ext)?;
info!("Starting {} on {} for {}", APP_NAME, listen_addr, domain); info!("Starting {} on {} for {}", APP_NAME, listen_addr, domain);
server::start(listen_addr, &cert, &pk)?;
server_start(listen_addr, &cert, &pk)?;
Ok(()) Ok(())
} }

0
tacd/src/server.rs → tacd/src/openssl_server.rs

10
tacd/src/standalone_server.rs

@ -0,0 +1,10 @@
use acme_common::crypto::{PrivateKey, X509Certificate};
use acme_common::error::Error;
pub fn start(
listen_addr: &str,
certificate: &X509Certificate,
private_key: &PrivateKey,
) -> Result<(), Error> {
Err("The standalone server is not implemented yet.".into())
}
Loading…
Cancel
Save