Skip to content

Commit f7e6106

Browse files
authored
feat(client): gate native backends behind Cargo features (#1338)
ironrdp (meta crate): - Added: client, client-all, client-sound, client-clipboard, client-rdpdr, client-smartcard, client-gateway, client-dvc-pipe-proxy, client-dvc-com-plugin, and top-level rustls / native-tls (forwarded to ironrdp-client) - Modified: qoi, qoiz now also gate ironrdp-client's codec ironrdp-client: - Added: sound, clipboard, rdpdr, smartcard, gateway, dvc-pipe-proxy, dvc-com-plugin, all; optional subsystem crates are pulled in only via these features - Modified: default no longer forces rustls; rustls / native-tls stay mutually exclusive (exactly one required), and qoi / qoiz now point at ironrdp-connector / ironrdp-session ironrdp-viewer: - Removed: direct ironrdp-client / backend-crate dependencies and qoi / qoiz features - Modified: rustls / native-tls now forward to ironrdp instead of ironrdp-client; pulls client + client-all from the meta crate
1 parent 9d206a3 commit f7e6106

17 files changed

Lines changed: 1073 additions & 527 deletions

File tree

Cargo.lock

Lines changed: 14 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/ironrdp-client/Cargo.toml

Lines changed: 55 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,41 +19,71 @@ doctest = false
1919
test = false
2020

2121
[features]
22-
default = ["rustls"]
23-
rustls = ["ironrdp-tls/rustls", "tokio-tungstenite/rustls-tls-native-roots", "ironrdp-mstsgu/rustls"]
24-
native-tls = ["ironrdp-tls/native-tls", "tokio-tungstenite/native-tls", "ironrdp-mstsgu/native-tls"]
25-
qoi = ["ironrdp/qoi"]
26-
qoiz = ["ironrdp/qoiz"]
22+
default = []
2723

28-
[dependencies]
29-
# Protocols
30-
ironrdp = { path = "../ironrdp", version = "0.16", features = [
31-
"session",
32-
"input",
33-
"graphics",
34-
"dvc",
35-
"svc",
24+
rustls = [
25+
"ironrdp-tls/rustls",
26+
"tokio-tungstenite/rustls-tls-native-roots",
27+
"ironrdp-mstsgu?/rustls",
28+
]
29+
30+
native-tls = [
31+
"ironrdp-tls/native-tls",
32+
"tokio-tungstenite/native-tls",
33+
"ironrdp-mstsgu?/native-tls",
34+
]
35+
36+
sound = ["dep:ironrdp-rdpsnd", "dep:ironrdp-rdpsnd-native"]
37+
clipboard = ["dep:ironrdp-cliprdr", "dep:ironrdp-cliprdr-native"]
38+
rdpdr = ["dep:ironrdp-rdpdr"]
39+
smartcard = ["rdpdr"]
40+
gateway = ["dep:ironrdp-mstsgu"]
41+
qoi = ["ironrdp-connector/qoi", "ironrdp-session/qoi"]
42+
qoiz = ["ironrdp-connector/qoiz", "ironrdp-session/qoiz"]
43+
dvc-pipe-proxy = ["dep:ironrdp-dvc-pipe-proxy"]
44+
dvc-com-plugin = ["dep:ironrdp-dvc-com-plugin"]
45+
46+
all = [
47+
"sound",
48+
"clipboard",
3649
"rdpdr",
37-
"rdpsnd",
38-
"cliprdr",
39-
"displaycontrol",
40-
"connector",
41-
"echo",
42-
] }
50+
"smartcard",
51+
"gateway",
52+
"dvc-pipe-proxy",
53+
"dvc-com-plugin",
54+
]
55+
56+
[dependencies]
57+
# Protocols (core features always on)
4358
ironrdp-core = { path = "../ironrdp-core", version = "0.2", features = ["alloc"] }
44-
ironrdp-rdpsnd-native = { path = "../ironrdp-rdpsnd-native", version = "0.6" }
59+
ironrdp-pdu = { path = "../ironrdp-pdu", version = "0.8" }
60+
ironrdp-svc = { path = "../ironrdp-svc", version = "0.7" }
61+
ironrdp-dvc = { path = "../ironrdp-dvc", version = "0.7" }
62+
ironrdp-connector = { path = "../ironrdp-connector", version = "0.9" }
63+
ironrdp-session = { path = "../ironrdp-session", version = "0.10" }
64+
ironrdp-graphics = { path = "../ironrdp-graphics", version = "0.8" }
65+
ironrdp-displaycontrol = { path = "../ironrdp-displaycontrol", version = "0.7" }
66+
ironrdp-echo = { path = "../ironrdp-echo", version = "0.3" }
4567
ironrdp-tls = { path = "../ironrdp-tls", version = "0.2" }
46-
ironrdp-mstsgu = { path = "../ironrdp-mstsgu" }
4768
ironrdp-tokio = { path = "../ironrdp-tokio", version = "0.9", features = ["reqwest"] }
48-
ironrdp-rdcleanpath.path = "../ironrdp-rdcleanpath"
49-
ironrdp-dvc-pipe-proxy.path = "../ironrdp-dvc-pipe-proxy"
69+
ironrdp-rdcleanpath = { path = "../ironrdp-rdcleanpath" }
70+
71+
# Optional protocol crates (activated by features above)
72+
ironrdp-cliprdr = { path = "../ironrdp-cliprdr", version = "0.6", optional = true }
73+
ironrdp-rdpdr = { path = "../ironrdp-rdpdr", version = "0.6", optional = true }
74+
ironrdp-rdpsnd = { path = "../ironrdp-rdpsnd", version = "0.8", optional = true }
75+
76+
# Optional backend crates (activated by features above)
77+
ironrdp-rdpsnd-native = { path = "../ironrdp-rdpsnd-native", version = "0.6", optional = true }
78+
ironrdp-cliprdr-native = { path = "../ironrdp-cliprdr-native", version = "0.6", optional = true }
79+
ironrdp-mstsgu = { path = "../ironrdp-mstsgu", optional = true }
80+
ironrdp-dvc-pipe-proxy = { path = "../ironrdp-dvc-pipe-proxy", optional = true }
5081

5182
# Logging
5283
tracing = { version = "0.1", features = ["log"] }
5384

5485
# Async, futures
5586
tokio = { version = "1", features = ["macros", "net", "io-util", "sync", "rt", "time"] }
56-
tokio-util = { version = "0.7" }
5787
tokio-tungstenite = "0.29"
5888
transport = { git = "https://github.com/Devolutions/devolutions-gateway", rev = "06e91dfe82751a6502eaf74b6a99663f06f0236d" }
5989
futures-util = { version = "0.3", features = ["sink"] }
@@ -65,7 +95,7 @@ url = "2"
6595
x509-cert = { version = "0.2", default-features = false, features = ["std"] }
6696

6797
[target.'cfg(windows)'.dependencies]
68-
ironrdp-dvc-com-plugin = { path = "../ironrdp-dvc-com-plugin" }
98+
ironrdp-dvc-com-plugin = { path = "../ironrdp-dvc-com-plugin", optional = true }
6999

70100
[lints]
71101
workspace = true
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
use ironrdp_cliprdr::backend::{ClipboardMessage, ClipboardMessageProxy};
2+
use tokio::sync::mpsc;
3+
use tracing::error;
4+
5+
use crate::rdp::RdpInputEvent;
6+
7+
/// Shim that forwards CLIPRDR events into the `RdpInputEvent` channel.
8+
#[derive(Clone, Debug)]
9+
pub(crate) struct ClientClipboardMessageProxy {
10+
tx: mpsc::UnboundedSender<RdpInputEvent>,
11+
}
12+
13+
impl ClientClipboardMessageProxy {
14+
pub(crate) fn new(tx: mpsc::UnboundedSender<RdpInputEvent>) -> Self {
15+
Self { tx }
16+
}
17+
}
18+
19+
impl ClipboardMessageProxy for ClientClipboardMessageProxy {
20+
fn send_clipboard_message(&self, message: ClipboardMessage) {
21+
if self.tx.send(RdpInputEvent::Clipboard(message)).is_err() {
22+
error!("Failed to send clipboard message; receiver is closed");
23+
}
24+
}
25+
}

0 commit comments

Comments
 (0)