Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/rproxy/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rproxy"
version = "0.0.6"
version = "0.0.7"
edition = "2024"
default-run = "rproxy"

Expand Down
2 changes: 1 addition & 1 deletion crates/rproxy/src/server/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl Metrics {

this.registry.register_with_unit(
"ws_latency_client",
"round-trip-time of websocket pings to backend divided by 2",
"round-trip-time of websocket pings to client divided by 2",
Unit::Other(String::from("nanoseconds")),
this.ws_latency_client.clone(),
);
Expand Down
23 changes: 17 additions & 6 deletions crates/rproxy/src/server/proxy/config/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl ConfigTls {
let mut errs: Vec<ConfigTlsError> = vec![];

let mut cert: Option<Vec<CertificateDer>> = None;
let key: Option<PrivateKeyDer> = None;
let mut key: Option<PrivateKeyDer> = None;

// certificate
{
Expand Down Expand Up @@ -93,6 +93,12 @@ impl ConfigTls {
}

Ok(res) => {
if res.is_empty() {
errs.push(ConfigTlsError::InvalidCertificate {
path: self.certificate.clone(),
err: String::from("the certificate is missing"),
});
}
cert = Some(res);
}
}
Expand Down Expand Up @@ -134,8 +140,7 @@ impl ConfigTls {

let mut reader = Cursor::new(raw);

match rustls_pemfile::certs(&mut reader).collect::<Result<Vec<_>, _>>()
{
match rustls_pemfile::private_key(&mut reader) {
Err(err) => {
errs.push(ConfigTlsError::InvalidKey {
path: self.certificate.clone(),
Expand All @@ -144,7 +149,13 @@ impl ConfigTls {
}

Ok(res) => {
cert = Some(res);
if res.is_none() {
errs.push(ConfigTlsError::InvalidKey {
path: self.certificate.clone(),
err: String::from("the key is missing"),
});
}
key = res;
}
}
}
Expand Down Expand Up @@ -222,7 +233,7 @@ impl ConfigTls {

#[derive(Debug, Clone, Error)]
pub(crate) enum ConfigTlsError {
#[error("invalid tls certificate at '{path}': {err}")]
#[error("invalid tls certificate in '{path}': {err}")]
InvalidCertificate { path: String, err: String },

#[error("invalid tls certificate file '{path}': {err}")]
Expand All @@ -231,7 +242,7 @@ pub(crate) enum ConfigTlsError {
#[error("path to tls certificate is missing")]
MissingCertificate,

#[error("invalid tls key at '{path}': {err}")]
#[error("invalid tls key in '{path}': {err}")]
InvalidKey { path: String, err: String },

#[error("invalid tls key file '{path}': {err}")]
Expand Down
2 changes: 1 addition & 1 deletion crates/rproxy/src/server/proxy/ws/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ where
.ws_latency_client
.get_or_create(&LabelsProxyWs {
proxy: P::name(),
destination: WS_LABEL_BKND,
destination: WS_LABEL_CLNT,
})
.record(
(1000000.0 * (timestamp - pong.timestamp).as_seconds_f64() /
Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ tls:
# TYPE rproxy_ws_latency_backend_nanoseconds gauge
# UNIT rproxy_ws_latency_backend_nanoseconds nanoseconds

# HELP rproxy_ws_latency_client_nanoseconds round-trip-time of websocket pings to backend divided by 2.
# HELP rproxy_ws_latency_client_nanoseconds round-trip-time of websocket pings to client divided by 2.
# TYPE rproxy_ws_latency_client_nanoseconds gauge
# UNIT rproxy_ws_latency_client_nanoseconds nanoseconds

Expand Down