[tests] Lint on Linux: the Unix client before the test module, a Target type for the fuzz table, is_multiple_of; rustfmt 1.100 layout of core::pki
This commit is contained in:
@@ -32,8 +32,8 @@ use ring::rand::{SecureRandom, SystemRandom};
|
|||||||
|
|
||||||
pub use domi_pki::{
|
pub use domi_pki::{
|
||||||
CertInfo, DEVICE_DAYS, EkuInfo, INTERMEDIATE_DAYS, INTERMEDIATE_OPENSSL_EXT, KeyPair,
|
CertInfo, DEVICE_DAYS, EkuInfo, INTERMEDIATE_DAYS, INTERMEDIATE_OPENSSL_EXT, KeyPair,
|
||||||
KeyUsageInfo, ORG, ROOT_CN, ROOT_DAYS, SERVER_DAYS, SERVER_RENEW_DAYS, der_to_pem,
|
KeyUsageInfo, ORG, ROOT_CN, ROOT_DAYS, SERVER_DAYS, SERVER_RENEW_DAYS, der_to_pem, match_code,
|
||||||
match_code, openssl_sign_command, sha256_hex,
|
openssl_sign_command, sha256_hex,
|
||||||
};
|
};
|
||||||
|
|
||||||
/// Subject CN of the intermediate. Signers refuse a CSR whose CN does not start with this.
|
/// Subject CN of the intermediate. Signers refuse a CSR whose CN does not start with this.
|
||||||
|
|||||||
@@ -22,8 +22,11 @@ use ianitor_core::edge_config::{EdgeConfig, EdgeTls};
|
|||||||
use ianitor_core::share::{self, LinkSpec, Revocations, ShareId, ShareKey};
|
use ianitor_core::share::{self, LinkSpec, Revocations, ShareId, ShareKey};
|
||||||
use ianitor_core::{SourceFile, load, pki, routes};
|
use ianitor_core::{SourceFile, load, pki, routes};
|
||||||
|
|
||||||
|
/// A target's body.
|
||||||
|
pub type Target = fn(&[u8]);
|
||||||
|
|
||||||
/// Every target, by the name its directories use.
|
/// Every target, by the name its directories use.
|
||||||
pub const TARGETS: &[(&str, fn(&[u8]))] = &[
|
pub const TARGETS: &[(&str, Target)] = &[
|
||||||
("routes", routes_toml),
|
("routes", routes_toml),
|
||||||
("header_rules", header_rules),
|
("header_rules", header_rules),
|
||||||
("share_token", share_token),
|
("share_token", share_token),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ fn from_hex(raw: &[u8]) -> Option<Vec<u8>> {
|
|||||||
.copied()
|
.copied()
|
||||||
.filter(|c| !c.is_ascii_whitespace())
|
.filter(|c| !c.is_ascii_whitespace())
|
||||||
.collect();
|
.collect();
|
||||||
if digits.len() % 2 != 0 {
|
if !digits.len().is_multiple_of(2) {
|
||||||
return None;
|
return None;
|
||||||
}
|
}
|
||||||
digits
|
digits
|
||||||
|
|||||||
+12
-12
@@ -461,6 +461,18 @@ pub async fn https_pipelined(
|
|||||||
pipelined_on(s, reqs, Duration::from_secs(3)).await
|
pipelined_on(s, reqs, Duration::from_secs(3)).await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// One request over a fresh connection to a Unix socket (edge's proxy socket, control's UI
|
||||||
|
/// socket).
|
||||||
|
#[cfg(unix)]
|
||||||
|
pub async fn unix(path: &std::path::Path, req: &Req) -> io::Result<Resp> {
|
||||||
|
tokio::time::timeout(TIMEOUT, async {
|
||||||
|
let s = tokio::net::UnixStream::connect(path).await?;
|
||||||
|
send(s, req).await
|
||||||
|
})
|
||||||
|
.await
|
||||||
|
.map_err(|_| io::Error::new(io::ErrorKind::TimedOut, "request timed out"))?
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod pipeline_tests {
|
mod pipeline_tests {
|
||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
@@ -489,15 +501,3 @@ mod pipeline_tests {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// One request over a fresh connection to a Unix socket (edge's proxy socket, control's UI
|
|
||||||
/// socket).
|
|
||||||
#[cfg(unix)]
|
|
||||||
pub async fn unix(path: &std::path::Path, req: &Req) -> io::Result<Resp> {
|
|
||||||
tokio::time::timeout(TIMEOUT, async {
|
|
||||||
let s = tokio::net::UnixStream::connect(path).await?;
|
|
||||||
send(s, req).await
|
|
||||||
})
|
|
||||||
.await
|
|
||||||
.map_err(|_| io::Error::new(io::ErrorKind::TimedOut, "request timed out"))?
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user