[edge] Proxy: Pingora data plane with SNI certs, forward-auth, header rules, health checks, ACME

This commit is contained in:
2026-11-07 14:57:36 +01:00
parent 4fe041082d
commit 17e1df8320
24 changed files with 2316 additions and 123 deletions
+19 -8
View File
@@ -12,7 +12,11 @@ use std::time::{Duration, Instant};
/// A port on 127.0.0.1 that was free a moment ago.
pub fn free_port() -> u16 {
std::net::TcpListener::bind("127.0.0.1:0").unwrap().local_addr().unwrap().port()
std::net::TcpListener::bind("127.0.0.1:0")
.unwrap()
.local_addr()
.unwrap()
.port()
}
pub fn local(port: u16) -> SocketAddr {
@@ -70,12 +74,17 @@ impl Drop for TempDir {
/// Locate an external tool: `$IANITOR_<NAME>_BIN`, then `$PATH`.
pub fn find_binary(name: &str) -> Option<PathBuf> {
let var = format!("IANITOR_{}_BIN", name.to_ascii_uppercase().replace('-', "_"));
let var = format!(
"IANITOR_{}_BIN",
name.to_ascii_uppercase().replace('-', "_")
);
if let Some(p) = std::env::var_os(&var) {
return Some(PathBuf::from(p));
}
let path = std::env::var_os("PATH")?;
std::env::split_paths(&path).map(|d| d.join(name)).find(|p| p.is_file())
std::env::split_paths(&path)
.map(|d| d.join(name))
.find(|p| p.is_file())
}
/// Like [`find_binary`], but a missing tool fails the test, unless `IANITOR_ALLOW_SKIP=1`,
@@ -87,11 +96,13 @@ pub fn require_binary(name: &str) -> Option<PathBuf> {
eprintln!("SKIPPED: `{name}` not found (IANITOR_ALLOW_SKIP=1)");
None
}
None => panic!(
"`{name}` is needed for this test but was not found on PATH (or ${}). \
In WSL: nix profile add nixpkgs#{name}. Set IANITOR_ALLOW_SKIP=1 to skip instead.",
format!("IANITOR_{}_BIN", name.to_ascii_uppercase().replace('-', "_"))
),
None => {
let var = format!("IANITOR_{}_BIN", name.to_ascii_uppercase().replace('-', "_"));
panic!(
"`{name}` is needed for this test but was not found on PATH (or ${var}). \
In WSL: nix profile add nixpkgs#{name}. Set IANITOR_ALLOW_SKIP=1 to skip instead."
)
}
}
}