Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cargo features "client" and "server" #23

Merged
merged 1 commit into from Jul 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions .travis.yml
Expand Up @@ -15,6 +15,8 @@ matrix:
script:
- cargo test
- cargo test --features early-data
- cargo test ---no-default-features --features client
- cargo test ---no-default-features --features server
- cd examples/server
- cargo check
- cd ../../examples/client
Expand Down
15 changes: 13 additions & 2 deletions Cargo.toml
Expand Up @@ -18,13 +18,24 @@ appveyor = { repository = "async-std/async-tls" }
[dependencies]
futures = "0.3.4"
rustls = "0.17.0"
webpki = "0.21.2"
webpki-roots = "0.19.0"
webpki = { version = "0.21.2", optional = true }
webpki-roots = { version = "0.19.0", optional = true }

[features]
default = ["client", "server"]
client = ["webpki", "webpki-roots"]
early-data = []
server = []

[dev-dependencies]
lazy_static = "1"
futures-util = "0.3"
async-std = { version = "1.0", features = ["unstable"] }

[[test]]
name = "test"
required-features = ["client", "server"]

[[test]]
name = "google"
required-features = ["client"]
9 changes: 7 additions & 2 deletions src/lib.rs
Expand Up @@ -2,16 +2,21 @@

#![deny(unsafe_code)]

#[cfg(feature = "server")]
mod acceptor;
#[cfg(feature = "client")]
pub mod client;
mod common;
#[cfg(feature = "client")]
mod connector;
mod rusttls;
#[cfg(feature = "server")]
pub mod server;

#[cfg(feature = "server")]
pub use acceptor::{Accept, TlsAcceptor};
#[cfg(feature = "client")]
pub use connector::{Connect, TlsConnector};

#[cfg(feature = "early-data")]
#[cfg(test)]
#[cfg(all(test, feature = "client", feature = "early-data"))]
mod test_0rtt;
2 changes: 1 addition & 1 deletion src/rusttls/stream.rs
Expand Up @@ -257,6 +257,6 @@ impl<'a, IO: AsyncRead + AsyncWrite + Unpin, S: Session> AsyncWrite for Stream<'
}
}

#[cfg(test)]
#[cfg(all(test, feature = "client"))]
#[path = "test_stream.rs"]
mod test_stream;