Switch from native-tls to rustls for WebSocket TLS

- Removes OpenSSL dependency entirely
- Uses pure Rust TLS implementation (rustls)
- Simplifies Docker build (no OpenSSL packages needed)
- Fixes Alpine musl build compatibility issues
This commit is contained in:
Graham McIntire 2026-01-16 17:43:53 -06:00
parent df9780a087
commit 570a37ffc0
No known key found for this signature in database
3 changed files with 16 additions and 5 deletions

View file

@ -7,7 +7,7 @@ edition = "2021"
snmp = "0.2"
ureq = { version = "2.10", features = ["json"] }
tokio = { version = "1", features = ["rt-multi-thread", "macros", "sync", "time", "net"] }
tokio-tungstenite = { version = "0.21", features = ["native-tls"] }
tokio-tungstenite = { version = "0.21", features = ["rustls-tls-webpki-roots"] }
futures = "0.3"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"

View file

@ -7,7 +7,7 @@ ARG TARGETPLATFORM
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache musl-dev protobuf-dev openssl-dev openssl-libs-static
RUN apk add --no-cache musl-dev protobuf-dev
# Determine Rust target based on platform and add it
RUN case "$TARGETPLATFORM" in \

View file

@ -30,7 +30,10 @@ fn get_version() -> String {
}
// Fallback: Try short commit hash only
if let Ok(output) = Command::new("git").args(["rev-parse", "--short", "HEAD"]).output() {
if let Ok(output) = Command::new("git")
.args(["rev-parse", "--short", "HEAD"])
.output()
{
if output.status.success() {
let commit = String::from_utf8_lossy(&output.stdout).trim().to_string();
return format!("{}.{}", env!("CARGO_PKG_VERSION"), commit);
@ -56,10 +59,18 @@ fn parse_git_describe(desc: &str) -> Option<String> {
let commit_count = parts[0];
let hash = parts[1].strip_prefix('g').unwrap_or(parts[1]);
let version = format!("{}.{}.{}", base, commit_count, hash);
return Some(if dirty { format!("{}-modified", version) } else { version });
return Some(if dirty {
format!("{}-modified", version)
} else {
version
});
}
}
// No commits after tag, just use the tag
Some(if dirty { format!("{}-modified", desc) } else { desc.to_string() })
Some(if dirty {
format!("{}-modified", desc)
} else {
desc.to_string()
})
}