WASM compatibility update

Related to: Usage as a lib #8

1.  feature gating of TLS and other features not supported with WASM.
2. updated documentation.
3. creation of AI slop WASM example for verification.
This commit is contained in:
2025-09-08 12:28:44 -07:00
parent 06cd6d0c82
commit f59c28d966
13 changed files with 900 additions and 53 deletions
+16 -7
View File
@@ -3,20 +3,29 @@
use flate2::bufread::GzDecoder;
use futures_util::{SinkExt, StreamExt};
use prost::Message as _;
use rustls::client::danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier};
use rustls::pki_types::{CertificateDer, ServerName, UnixTime};
use rustls::{ClientConfig, RootCertStore};
use rustls::{DigitallySignedStruct, SignatureScheme};
use rustls_pemfile::Item;
use std::io::Read;
use std::{fs::File, io::BufReader, sync::Arc};
use tokio::net::TcpStream;
use tokio_tungstenite::{
Connector, MaybeTlsStream, WebSocketStream, connect_async, connect_async_tls_with_config,
MaybeTlsStream, WebSocketStream, connect_async,
tungstenite::Message, tungstenite::client::IntoClientRequest,
};
use url::Url;
#[cfg(feature = "tls")]
use rustls::client::danger::{HandshakeSignatureValid, ServerCertVerified, ServerCertVerifier};
#[cfg(feature = "tls")]
use rustls::pki_types::{CertificateDer, ServerName, UnixTime};
#[cfg(feature = "tls")]
use rustls::{ClientConfig, RootCertStore};
#[cfg(feature = "tls")]
use rustls::{DigitallySignedStruct, SignatureScheme};
#[cfg(feature = "tls")]
use rustls_pemfile::Item;
#[cfg(feature = "tls")]
use std::{fs::File, io::BufReader, sync::Arc};
#[cfg(feature = "tls")]
use tokio_tungstenite::{Connector, connect_async_tls_with_config};
use crate::error::{ConnectorError, Result};
use crate::types::{AgentRequest, AgentResponse, DiskInfo, Metrics, ProcessInfo, ProcessesPayload};
+4 -1
View File
@@ -146,8 +146,11 @@ pub mod types;
pub use connector::{
ConnectorConfig, SocktopConnector, WsStream, connect_to_socktop_agent,
connect_to_socktop_agent_with_config, connect_to_socktop_agent_with_tls,
connect_to_socktop_agent_with_config,
};
#[cfg(feature = "tls")]
pub use connector::connect_to_socktop_agent_with_tls;
pub use error::{ConnectorError, Result};
pub use types::{
AgentRequest, AgentResponse, DiskInfo, GpuInfo, Metrics, NetworkInfo, ProcessInfo,