generated from PlexSheep/rs-base
automatic cargo CI changes
This commit is contained in:
parent
670a4bd192
commit
9f9ea39e58
|
@ -6,11 +6,11 @@ use clap::Parser;
|
||||||
use clap_verbosity_flag::{InfoLevel, Verbosity};
|
use clap_verbosity_flag::{InfoLevel, Verbosity};
|
||||||
|
|
||||||
/// short about section displayed in help
|
/// short about section displayed in help
|
||||||
const ABOUT_ROOT: &'static str = r##"
|
const ABOUT_ROOT: &str = r##"
|
||||||
Let your hosts play ping pong over the network
|
Let your hosts play ping pong over the network
|
||||||
"##;
|
"##;
|
||||||
/// longer about section displayed in help, is combined with [the short help](ABOUT_ROOT)
|
/// longer about section displayed in help, is combined with [the short help](ABOUT_ROOT)
|
||||||
static LONG_ABOUT_ROOT: &'static str = r##"
|
static LONG_ABOUT_ROOT: &str = r##"
|
||||||
|
|
||||||
Connect to a ping pong server and periodically send a ping. The server will reply with a pong.
|
Connect to a ping pong server and periodically send a ping. The server will reply with a pong.
|
||||||
That's it really. You can also host your own netpong server (server feature).
|
That's it really. You can also host your own netpong server (server feature).
|
||||||
|
@ -86,6 +86,6 @@ impl Cli {
|
||||||
.build()
|
.build()
|
||||||
.expect("could not initialize Logger");
|
.expect("could not initialize Logger");
|
||||||
}
|
}
|
||||||
return cli;
|
cli
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ pub mod conf;
|
||||||
pub fn decode(buf: &[u8]) -> Result<String, Utf8Error> {
|
pub fn decode(buf: &[u8]) -> Result<String, Utf8Error> {
|
||||||
Ok(match std::str::from_utf8(buf) {
|
Ok(match std::str::from_utf8(buf) {
|
||||||
Ok(s) => s.to_string(),
|
Ok(s) => s.to_string(),
|
||||||
Err(err) => return Err(err.into()),
|
Err(err) => return Err(err),
|
||||||
}
|
}
|
||||||
.trim_matches(char::from(0))
|
.trim_matches(char::from(0))
|
||||||
.to_string())
|
.to_string())
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
|
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
use libpt::log::*;
|
use libpt::log::*;
|
||||||
use tokio;
|
|
||||||
|
|
||||||
mod client;
|
mod client;
|
||||||
mod common;
|
mod common;
|
||||||
|
|
|
@ -109,10 +109,10 @@ impl Server {
|
||||||
error!("the server needs a key!");
|
error!("the server needs a key!");
|
||||||
return Err(std::io::ErrorKind::InvalidInput.into());
|
return Err(std::io::ErrorKind::InvalidInput.into());
|
||||||
}
|
}
|
||||||
let key = private_key(&mut std::io::BufReader::new(File::open(
|
|
||||||
|
private_key(&mut std::io::BufReader::new(File::open(
|
||||||
cfg.key.clone().unwrap(),
|
cfg.key.clone().unwrap(),
|
||||||
)?));
|
)?))
|
||||||
return key;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn load_certs(cfg: Config) -> std::io::Result<Vec<CertificateDer<'static>>> {
|
fn load_certs(cfg: Config) -> std::io::Result<Vec<CertificateDer<'static>>> {
|
||||||
|
@ -121,18 +121,18 @@ impl Server {
|
||||||
return Err(std::io::ErrorKind::InvalidInput.into());
|
return Err(std::io::ErrorKind::InvalidInput.into());
|
||||||
}
|
}
|
||||||
match certs(&mut std::io::BufReader::new(File::open(
|
match certs(&mut std::io::BufReader::new(File::open(
|
||||||
&cfg.certs.clone().unwrap(),
|
cfg.certs.clone().unwrap(),
|
||||||
)?))
|
)?))
|
||||||
.collect::<std::io::Result<Vec<CertificateDer<'static>>>>()
|
.collect::<std::io::Result<Vec<CertificateDer<'static>>>>()
|
||||||
{
|
{
|
||||||
Ok(v) if !v.is_empty() => Ok(v),
|
Ok(v) if !v.is_empty() => Ok(v),
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
error!("no certs found in provided file {:?}", cfg.certs);
|
error!("no certs found in provided file {:?}", cfg.certs);
|
||||||
return Err(std::io::ErrorKind::InvalidInput.into());
|
Err(std::io::ErrorKind::InvalidInput.into())
|
||||||
}
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
error!("could not load certs: {err:?}");
|
error!("could not load certs: {err:?}");
|
||||||
return Err(err);
|
Err(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue