Skip to content

Commit

Permalink
Remove plugins support.
Browse files Browse the repository at this point in the history
(they were never stabilized and bloat up Cargo.lock,
inviting spurious warnings from dependabot and other things).
  • Loading branch information
vi committed May 9, 2024
1 parent e289e9f commit e556b8f
Show file tree
Hide file tree
Showing 12 changed files with 11 additions and 1,392 deletions.
704 changes: 10 additions & 694 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ argon2 = { version = "0.4.0", optional = true }
prometheus = { version = "0.13.0", optional = true, default-features = false }
prometheus-metric-storage = { version = "0.5.0", optional = true }
flate2 = {version = "1", optional = true}
libloading = {version="0.7.3", optional = true}
wasmtime = { version = "1.0.0", default-features = false, features = ["memory-init-cow"], optional = true }

# Rust 1.30.1 compat:
#cfg-if="=0.1.9"
Expand Down Expand Up @@ -94,9 +92,6 @@ vendored_openssl = ["openssl-sys/vendored"]
crypto_peer = ["chacha20poly1305","argon2"]
prometheus_peer=["prometheus","prometheus-metric-storage"]
compression=["flate2"]
native_plugins=["libloading"]
wasm_plugins=["wasmtime"]
wasm_compiler=["wasmtime/cranelift", "wasmtime/parallel-compilation"]

[target.'arm-linux-androideabi'.dependencies]
openssl-sys = { version="0.9", features=[], optional=true }
Expand Down
18 changes: 0 additions & 18 deletions src/all_peers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,24 +116,6 @@ macro_rules! list_of_all_specifier_classes {

$your_macro!($crate::trivial_peer::ExitOnSpecificByteClass);

#[cfg(feature = "native_plugins")]
$your_macro!($crate::transform_peer::NativeTransformAClass);
#[cfg(feature = "native_plugins")]
$your_macro!($crate::transform_peer::NativeTransformBClass);
#[cfg(feature = "native_plugins")]
$your_macro!($crate::transform_peer::NativeTransformCClass);
#[cfg(feature = "native_plugins")]
$your_macro!($crate::transform_peer::NativeTransformDClass);

#[cfg(feature = "wasm_plugins")]
$your_macro!($crate::wasm_transform_peer::WasmTransformAClass);
#[cfg(feature = "wasm_plugins")]
$your_macro!($crate::wasm_transform_peer::WasmTransformBClass);
#[cfg(feature = "wasm_plugins")]
$your_macro!($crate::wasm_transform_peer::WasmTransformCClass);
#[cfg(feature = "wasm_plugins")]
$your_macro!($crate::wasm_transform_peer::WasmTransformDClass);

$your_macro!($crate::reconnect_peer::WaitForDataClass);
};
}
6 changes: 0 additions & 6 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,12 +207,6 @@ pub mod crypto_peer;
#[cfg(feature = "prometheus_peer")]
pub mod prometheus_peer;

#[cfg(feature = "native_plugins")]
pub mod transform_peer;

#[cfg(feature = "wasm_plugins")]
pub mod wasm_transform_peer;

pub mod specparse;

pub type PeerOverlay = Rc<dyn Fn(Peer, L2rUser) -> BoxedNewPeerFuture>;
Expand Down
45 changes: 1 addition & 44 deletions src/lints.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg_attr(feature="cargo-clippy", allow(collapsible_if,needless_pass_by_value))]

use super::{Options, Result, SpecifierClass, SpecifierStack, WebsocatConfiguration2};
use super::specifier::{SpecifierNode};
use super::specifier::SpecifierNode;
use std::rc::Rc;
use std::str::FromStr;
use std::ops::Not;
Expand Down Expand Up @@ -653,47 +653,6 @@ impl WebsocatConfiguration2 {
}
Ok(())
}
#[cfg(feature="native_plugins")]
fn l_plugins(&mut self, _on_warning: &OnWarning) -> Result<()> {
if self.contains_class("NativeTransformAClass") && self.opts.native_transform_a.is_none() {
return Err("--native-plugin-a must be specified to use `native_plugin_transform_a:`")?;
}
if self.contains_class("NativeTransformBClass") && self.opts.native_transform_b.is_none() {
return Err("--native-plugin-b must be specified to use `native_plugin_transform_b:`")?;
}
if self.contains_class("NativeTransformCClass") && self.opts.native_transform_c.is_none() {
return Err("--native-plugin-c must be specified to use `native_plugin_transform_c:`")?;
}
if self.contains_class("NativeTransformDClass") && self.opts.native_transform_d.is_none() {
return Err("--native-plugin-d must be specified to use `native_plugin_transform_d:`")?;
}
Ok(())
}
#[cfg(not(feature="native_plugins"))]
fn l_plugins(&mut self, _on_warning: &OnWarning) -> Result<()> {
Ok(())
}

#[cfg(feature="wasm_plugins")]
fn l_wasm(&mut self, _on_warning: &OnWarning) -> Result<()> {
if self.contains_class("WasmTransformAClass") && self.opts.wasm_transform_a.is_none() {
return Err("--wasm-plugin-a must be specified to use `wasm_plugin_transform_a:`")?;
}
if self.contains_class("WasmTransformBClass") && self.opts.wasm_transform_b.is_none() {
return Err("--wasm-plugin-b must be specified to use `wasm_plugin_transform_b:`")?;
}
if self.contains_class("WasmTransformCClass") && self.opts.wasm_transform_c.is_none() {
return Err("--wasm-plugin-c must be specified to use `wasm_plugin_transform_c:`")?;
}
if self.contains_class("WasmTransformDClass") && self.opts.wasm_transform_d.is_none() {
return Err("--wasm-plugin-d must be specified to use `wasm_plugin_transform_d:`")?;
}
Ok(())
}
#[cfg(not(feature="wasm_plugins"))]
fn l_wasm(&mut self, _on_warning: &OnWarning) -> Result<()> {
Ok(())
}

fn l_autoreconn_reuse(&mut self, _on_warning: &OnWarning) -> Result<()> {
if self.s1.autotoreconn_misuse() || self.s2.autotoreconn_misuse() {
Expand Down Expand Up @@ -726,8 +685,6 @@ impl WebsocatConfiguration2 {
self.l_crypto(&on_warning)?;
self.l_sizelimits(&on_warning)?;
self.l_compress(&on_warning)?;
self.l_plugins(&on_warning)?;
self.l_wasm(&on_warning)?;
self.l_autoreconn_reuse(&on_warning)?;

// TODO: UDP connect oneshot mode
Expand Down
62 changes: 0 additions & 62 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -607,50 +607,6 @@ struct Opt {
#[structopt(long = "uncompress-gzip")]
pub uncompress_gzip: bool,

/// [A] Load specified symbol from specified native library and use it for `native_plugin_transform_a`.
/// Format is `symbol@library_file`. If `symbol@` is omitted, `websocat_transform` is implied.
#[cfg(feature = "native_plugins")]
#[structopt(long = "native-plugin-a", parse(try_from_str = "websocat::transform_peer::load_symbol"))]
pub native_transform_a: Option<websocat::transform_peer::Sym>,

/// [A] Load specified symbol from specified native library and use it for `native_plugin_transform_b`.
#[cfg(feature = "native_plugins")]
#[structopt(long = "native-plugin-b", parse(try_from_str = "websocat::transform_peer::load_symbol"))]
pub native_transform_b: Option<websocat::transform_peer::Sym>,

/// [A] Load specified symbol from specified native library and use it for `native_plugin_transform_c`.
#[cfg(feature = "native_plugins")]
#[structopt(long = "native-plugin-c", parse(try_from_str = "websocat::transform_peer::load_symbol"))]
pub native_transform_c: Option<websocat::transform_peer::Sym>,

/// [A] Load specified symbol from specified native library and use it for `native_plugin_transform_d`.
#[cfg(feature = "native_plugins")]
#[structopt(long = "native-plugin-d", parse(try_from_str = "websocat::transform_peer::load_symbol"))]
pub native_transform_d: Option<websocat::transform_peer::Sym>,

/// [A] Load specified symbol from specified wasm module and use it for `wasm_plugin_transform_a:`.
/// Format is `symbol@library_file`. If `symbol@` is omitted, `websocat_transform` is implied.
/// The wasm module should also have `malloc` and `free` functions exposed.
/// Prepend `library_file` with `!` to load serialized cwasm produced by `wasmtime compile` instead of compining the module in Websocat.
#[cfg(feature = "wasm_plugins")]
#[structopt(long = "wasm-plugin-a", parse(try_from_str = "websocat::wasm_transform_peer::load_symbol"))]
pub wasm_transform_a: Option<websocat::wasm_transform_peer::Handle>,

/// [A] Load specified symbol from specified wasm module and use it for `wasm_plugin_transform_b:`.
#[cfg(feature = "wasm_plugins")]
#[structopt(long = "wasm-plugin-b", parse(try_from_str = "websocat::wasm_transform_peer::load_symbol"))]
pub wasm_transform_b: Option<websocat::wasm_transform_peer::Handle>,

/// [A] Load specified symbol from specified wasm module and use it for `wasm_plugin_transform_c:`.
#[cfg(feature = "wasm_plugins")]
#[structopt(long = "wasm-plugin-c", parse(try_from_str = "websocat::wasm_transform_peer::load_symbol"))]
pub wasm_transform_c: Option<websocat::wasm_transform_peer::Handle>,

/// [A] Load specified symbol from specified wasm module and use it for `wasm_plugin_transform_d:`.
#[cfg(feature = "wasm_plugins")]
#[structopt(long = "wasm-plugin-d", parse(try_from_str = "websocat::wasm_transform_peer::load_symbol"))]
pub wasm_transform_d: Option<websocat::wasm_transform_peer::Handle>,

/// [A] Omit `jsonrpc` field when using `--jsonrpc`, e.g. for Chromium
#[structopt(long = "jsonrpc-omit-jsonrpc")]
pub jsonrpc_omit_jsonrpc: bool,
Expand Down Expand Up @@ -995,24 +951,6 @@ fn run() -> Result<()> {
prometheus
}
}
#[cfg(feature = "native_plugins")]
{
opts! {
native_transform_a
native_transform_b
native_transform_c
native_transform_d
}
}
#[cfg(feature = "wasm_plugins")]
{
opts! {
wasm_transform_a
wasm_transform_b
wasm_transform_c
wasm_transform_d
}
}
};

if let Some(x) = cmd.useragent {
Expand Down
18 changes: 0 additions & 18 deletions src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,24 +131,6 @@ pub struct Options {
pub uncompress_zlib: bool,
pub uncompress_gzip: bool,

#[cfg(feature = "native_plugins")]
pub native_transform_a : Option<crate::transform_peer::Sym>,
#[cfg(feature = "native_plugins")]
pub native_transform_b : Option<crate::transform_peer::Sym>,
#[cfg(feature = "native_plugins")]
pub native_transform_c : Option<crate::transform_peer::Sym>,
#[cfg(feature = "native_plugins")]
pub native_transform_d : Option<crate::transform_peer::Sym>,

#[cfg(feature = "wasm_plugins")]
pub wasm_transform_a : Option<crate::wasm_transform_peer::Handle>,
#[cfg(feature = "wasm_plugins")]
pub wasm_transform_b : Option<crate::wasm_transform_peer::Handle>,
#[cfg(feature = "wasm_plugins")]
pub wasm_transform_c : Option<crate::wasm_transform_peer::Handle>,
#[cfg(feature = "wasm_plugins")]
pub wasm_transform_d : Option<crate::wasm_transform_peer::Handle>,

pub jsonrpc_omit_jsonrpc: bool,
pub inhibit_pongs: Option<usize>,
pub max_sent_pings: Option<usize>,
Expand Down
Loading

0 comments on commit e556b8f

Please sign in to comment.