feat(connector): implement gzipped protobuf support for WASM and fix all warnings

This commit is contained in:
2025-09-09 02:30:16 -07:00
parent e4186a7ec0
commit d97f7507e8
6 changed files with 679 additions and 26 deletions
+24 -14
View File
@@ -1,6 +1,6 @@
[package]
name = "socktop_connector"
version = "0.1.3"
version = "0.1.5"
edition = "2024"
license = "MIT"
description = "WebSocket connector library for socktop agent communication"
@@ -11,33 +11,42 @@ keywords = ["monitoring", "websocket", "metrics", "system"]
categories = ["network-programming", "development-tools"]
documentation = "https://docs.rs/socktop_connector"
[lib]
crate-type = ["cdylib", "rlib"]
# docs.rs specific metadata
[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
[dependencies]
# WebSocket client
tokio-tungstenite = { workspace = true }
tokio = { workspace = true }
futures-util = { workspace = true }
url = { workspace = true }
# WebSocket client - only for non-WASM targets
tokio-tungstenite = { workspace = true, optional = true }
tokio = { workspace = true, optional = true }
futures-util = { workspace = true, optional = true }
url = { workspace = true, optional = true }
# WASM WebSocket support
wasm-bindgen = { version = "0.2", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }
js-sys = { version = "0.3", optional = true }
web-sys = { version = "0.3", features = ["WebSocket", "MessageEvent", "ErrorEvent", "CloseEvent", "BinaryType", "Window", "console"], optional = true }
# TLS support
rustls = { version = "0.23", features = ["ring"], optional = true }
rustls-pemfile = { version = "2.1", optional = true }
# Serialization
# Serialization - always available
serde = { workspace = true }
serde_json = { workspace = true }
# Compression
flate2 = "1.0"
# Compression - only for networking
flate2 = { version = "1.0", optional = true }
# Protobuf
# Protobuf - always available
prost = { workspace = true }
# Error handling
# Error handling - always available
thiserror = "2.0"
[build-dependencies]
@@ -45,6 +54,7 @@ prost-build = "0.13"
protoc-bin-vendored = "3.0"
[features]
default = ["tls"]
tls = ["rustls", "rustls-pemfile"]
wasm = [] # WASM-compatible feature set (no TLS)
default = ["networking", "tls"]
networking = ["tokio-tungstenite", "tokio", "futures-util", "url", "flate2"]
tls = ["networking", "rustls", "rustls-pemfile"]
wasm = ["wasm-bindgen", "wasm-bindgen-futures", "js-sys", "web-sys", "flate2"] # WASM-compatible networking with compression