mirror of
https://github.com/cloudflare/pingora.git
synced 2024-09-20 02:31:35 +02:00
Windows support 1/n: clean up cargo and certain tests
Co-authored-by: Fredrik Enestad <fredrik@enestad.com>
This commit is contained in:
parent
e564cd535a
commit
f3a5a85031
9 changed files with 28 additions and 7 deletions
2
.bleep
2
.bleep
|
@ -1 +1 @@
|
|||
3eb2a9750ec02867bec91a4069796faae8cd860c
|
||||
a5e77a0c20967fd9ff223682be0fc043a6f35514
|
|
@ -35,7 +35,6 @@ http = { workspace = true }
|
|||
log = { workspace = true }
|
||||
h2 = { workspace = true }
|
||||
lru = { workspace = true }
|
||||
nix = "~0.24.3"
|
||||
clap = { version = "3.2.25", features = ["derive"] }
|
||||
once_cell = { workspace = true }
|
||||
serde = { version = "1.0", features = ["derive"] }
|
||||
|
@ -46,7 +45,6 @@ libc = "0.2.70"
|
|||
chrono = { version = "~0.4.31", features = ["alloc"], default-features = false }
|
||||
thread_local = "1.0"
|
||||
prometheus = "0.13"
|
||||
daemonize = "0.5.0"
|
||||
sentry = { version = "0.26", features = [
|
||||
"backtrace",
|
||||
"contexts",
|
||||
|
@ -69,12 +67,21 @@ tokio-test = "0.4"
|
|||
zstd = "0"
|
||||
httpdate = "1"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
daemonize = "0.5.0"
|
||||
nix = "~0.24.3"
|
||||
|
||||
[target.'cfg(windows)'.dependencies]
|
||||
windows-sys = { version = "0.59.0", features = ["Win32_Networking_WinSock"] }
|
||||
|
||||
[dev-dependencies]
|
||||
matches = "0.1"
|
||||
env_logger = "0.9"
|
||||
reqwest = { version = "0.11", features = ["rustls"], default-features = false }
|
||||
hyperlocal = "0.8"
|
||||
hyper = "0.14"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
hyperlocal = "0.8"
|
||||
jemallocator = "0.5"
|
||||
|
||||
[features]
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
mod utils;
|
||||
|
||||
use hyper::Client;
|
||||
#[cfg(unix)]
|
||||
use hyperlocal::{UnixClientExt, Uri};
|
||||
use utils::init;
|
||||
|
||||
|
@ -51,6 +52,7 @@ async fn test_https_http2() {
|
|||
assert_eq!(res.version(), reqwest::Version::HTTP_11);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[cfg(feature = "some_tls")]
|
||||
#[tokio::test]
|
||||
async fn test_uds() {
|
||||
|
|
|
@ -78,6 +78,7 @@ fn entry_point(opt: Option<Opt>) {
|
|||
my_server.bootstrap();
|
||||
|
||||
let mut listeners = Listeners::tcp("0.0.0.0:6145");
|
||||
#[cfg(unix)]
|
||||
listeners.add_uds("/tmp/echo.sock", None);
|
||||
|
||||
let mut tls_settings =
|
||||
|
|
|
@ -27,7 +27,10 @@ use tokio::sync::{oneshot, watch, Notify, OwnedMutexGuard};
|
|||
use super::lru::Lru;
|
||||
|
||||
type GroupKey = u64;
|
||||
#[cfg(unix)]
|
||||
type ID = i32;
|
||||
#[cfg(windows)]
|
||||
type ID = usize;
|
||||
|
||||
/// the metadata of a connection
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -41,7 +41,6 @@ reqwest = { version = "0.11", features = [
|
|||
], default-features = false }
|
||||
tokio-test = "0.4"
|
||||
env_logger = "0.9"
|
||||
hyperlocal = "0.8"
|
||||
hyper = "0.14"
|
||||
tokio-tungstenite = "0.20.1"
|
||||
pingora-limits = { version = "0.3.0", path = "../pingora-limits" }
|
||||
|
@ -52,6 +51,9 @@ serde = { version = "1.0", features = ["derive"] }
|
|||
serde_json = "1.0"
|
||||
serde_yaml = "0.8"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
hyperlocal = "0.8"
|
||||
|
||||
[features]
|
||||
default = ["openssl"]
|
||||
openssl = ["pingora-core/openssl", "pingora-cache/openssl"]
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
mod utils;
|
||||
|
||||
use hyper::{body::HttpBody, header::HeaderValue, Body, Client};
|
||||
#[cfg(unix)]
|
||||
use hyperlocal::{UnixClientExt, Uri};
|
||||
use reqwest::{header, StatusCode};
|
||||
|
||||
|
@ -233,6 +234,7 @@ async fn test_h2_to_h1_upload() {
|
|||
assert_eq!(body, payload);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[tokio::test]
|
||||
async fn test_simple_proxy_uds() {
|
||||
init();
|
||||
|
@ -262,6 +264,7 @@ async fn test_simple_proxy_uds() {
|
|||
assert_eq!(body.as_ref(), b"Hello World!\n");
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[tokio::test]
|
||||
async fn test_simple_proxy_uds_peer() {
|
||||
init();
|
||||
|
|
|
@ -279,6 +279,7 @@ impl ProxyHttp for ExampleProxyHttp {
|
|||
_ctx: &mut Self::CTX,
|
||||
) -> Result<Box<HttpPeer>> {
|
||||
let req = session.req_header();
|
||||
#[cfg(unix)]
|
||||
if req.headers.contains_key("x-uds-peer") {
|
||||
return Ok(Box::new(HttpPeer::new_uds(
|
||||
"/tmp/nginx-test.sock",
|
||||
|
|
|
@ -35,9 +35,7 @@ tokio = { workspace = true, features = ["rt-multi-thread", "signal"] }
|
|||
matches = "0.1"
|
||||
env_logger = "0.9"
|
||||
reqwest = { version = "0.11", features = ["rustls"], default-features = false }
|
||||
hyperlocal = "0.8"
|
||||
hyper = "0.14"
|
||||
jemallocator = "0.5"
|
||||
async-trait = { workspace = true }
|
||||
http = { workspace = true }
|
||||
log = { workspace = true }
|
||||
|
@ -46,6 +44,10 @@ once_cell = { workspace = true }
|
|||
bytes = { workspace = true }
|
||||
regex = "1"
|
||||
|
||||
[target.'cfg(unix)'.dev-dependencies]
|
||||
hyperlocal = "0.8"
|
||||
jemallocator = "0.5"
|
||||
|
||||
[features]
|
||||
default = ["openssl"]
|
||||
openssl = [
|
||||
|
|
Loading…
Reference in a new issue