Skip to content

Commit

Permalink
put client behind feature flag
Browse files Browse the repository at this point in the history
  • Loading branch information
divagant-martian committed Nov 8, 2024
1 parent 291c681 commit 26dfa9f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
3 changes: 2 additions & 1 deletion iroh-relay/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ mainline = "2.0.1"
duct = "0.13.6"

[features]
default = ["metrics", "discovery-pkarr-dht", "server"]
default = ["metrics", "discovery-pkarr-dht", "server", "client"]
server = [
"dep:tokio-rustls-acme",
"dep:axum",
Expand All @@ -132,6 +132,7 @@ metrics = ["iroh-metrics/metrics", "server"]
test-utils = []
discovery-local-network = ["dep:swarm-discovery"]
discovery-pkarr-dht = ["pkarr/dht", "dep:genawaiter"]
client = []

[[bin]]
name = "iroh-relay"
Expand Down
12 changes: 6 additions & 6 deletions iroh-relay/src/client/streams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub enum MaybeTlsStreamReader {
tokio::io::ReadHalf<tokio_rustls::client::TlsStream<ProxyStream>>,
>,
),
#[cfg(test)]
#[cfg(all(test, feature = "server"))]
Mem(tokio::io::ReadHalf<tokio::io::DuplexStream>),
}

Expand All @@ -45,7 +45,7 @@ impl AsyncRead for MaybeTlsStreamReader {
pub enum MaybeTlsStreamWriter {
Raw(tokio::io::WriteHalf<ProxyStream>),
Tls(tokio::io::WriteHalf<tokio_rustls::client::TlsStream<ProxyStream>>),
#[cfg(test)]
#[cfg(all(test, feature = "server"))]
Mem(tokio::io::WriteHalf<tokio::io::DuplexStream>),
}

Expand All @@ -58,7 +58,7 @@ impl AsyncWrite for MaybeTlsStreamWriter {
match &mut *self {
Self::Raw(stream) => Pin::new(stream).poll_write(cx, buf),
Self::Tls(stream) => Pin::new(stream).poll_write(cx, buf),
#[cfg(test)]
#[cfg(all(test, feature = "server"))]
Self::Mem(stream) => Pin::new(stream).poll_write(cx, buf),
}
}
Expand All @@ -70,7 +70,7 @@ impl AsyncWrite for MaybeTlsStreamWriter {
match &mut *self {
Self::Raw(stream) => Pin::new(stream).poll_flush(cx),
Self::Tls(stream) => Pin::new(stream).poll_flush(cx),
#[cfg(test)]
#[cfg(all(test, feature = "server"))]
Self::Mem(stream) => Pin::new(stream).poll_flush(cx),
}
}
Expand All @@ -82,7 +82,7 @@ impl AsyncWrite for MaybeTlsStreamWriter {
match &mut *self {
Self::Raw(stream) => Pin::new(stream).poll_shutdown(cx),
Self::Tls(stream) => Pin::new(stream).poll_shutdown(cx),
#[cfg(test)]
#[cfg(all(test, feature = "server"))]
Self::Mem(stream) => Pin::new(stream).poll_shutdown(cx),
}
}
Expand All @@ -95,7 +95,7 @@ impl AsyncWrite for MaybeTlsStreamWriter {
match &mut *self {
Self::Raw(stream) => Pin::new(stream).poll_write_vectored(cx, bufs),
Self::Tls(stream) => Pin::new(stream).poll_write_vectored(cx, bufs),
#[cfg(test)]
#[cfg(all(test, feature = "server"))]
Self::Mem(stream) => Pin::new(stream).poll_write_vectored(cx, bufs),
}
}
Expand Down
2 changes: 1 addition & 1 deletion iroh-relay/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

#![deny(missing_docs, rustdoc::broken_intra_doc_links)]

#[cfg(feature = "client")]
pub mod client;
pub mod defaults;
pub mod http;
// mod map;
pub mod protos;
#[cfg(feature = "server")]
#[cfg_attr(iroh_docsrs, doc(cfg(feature = "server")))]
Expand Down

0 comments on commit 26dfa9f

Please sign in to comment.