From f6f44784fff5488bb59d563ee7ff7b94c08a48c1 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Sun, 19 May 2024 23:41:31 +0200 Subject: use cargo features to enable/disable protocols for net crate --- net/Cargo.toml | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-) (limited to 'net/Cargo.toml') diff --git a/net/Cargo.toml b/net/Cargo.toml index 304cbb2..717f603 100644 --- a/net/Cargo.toml +++ b/net/Cargo.toml @@ -6,35 +6,49 @@ edition.workspace = true # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [features] -default = ["smol"] +default = ["smol", "all-protocols"] +all-protocols = ["tcp", "tls", "ws", "udp", "unix"] +stream = ["dep:pin-project-lite", "dep:futures-util"] +tcp = ["stream"] +tls = ["dep:rustls-pki-types", "tcp"] +ws = ["dep:async-tungstenite", "tcp"] +udp = [] +unix = ["stream"] smol = [ "karyon_core/smol", - "async-tungstenite/async-std-runtime", - "dep:futures-rustls", + "async-tungstenite?/async-std-runtime", + # TODO: use tls feature + "futures-rustls", ] tokio = [ "karyon_core/tokio", - "async-tungstenite/tokio-runtime", + "async-tungstenite?/tokio-runtime", "dep:tokio", - "dep:tokio-rustls", + # TODO: use tls feature + "tokio-rustls", ] [dependencies] karyon_core = { workspace = true, default-features = false } -pin-project-lite = "0.2.13" async-trait = "0.1.77" log = "0.4.21" bincode = { version = "2.0.0-rc.3", features = ["derive"] } thiserror = "1.0.58" url = "2.5.0" -async-tungstenite = { version = "0.25.0", default-features = false } -asynchronous-codec = "0.7.0" -futures-util = "0.3.30" async-channel = "2.3.0" -rustls-pki-types = "1.7.0" +futures-util = { version = "0.3.30", default-features = false, features = [ + "sink", +], optional = true } +pin-project-lite = { version = "0.2.13", optional = true } + +# websocket deps +async-tungstenite = { version = "0.25.0", default-features = false, optional = true } + +# tls deps +rustls-pki-types = { version = "1.7.0", optional = true } futures-rustls = { version = "0.25.1", optional = true } tokio-rustls = { version = "0.26.0", optional = true } tokio = { version = "1.37.0", features = ["io-util"], optional = true } -- cgit v1.2.3