fix(transport): Remove support for OpenSSL (#141)
BREAKING CHANGE: Remove support for OpenSSL within the transport.
This commit is contained in:
committed by
Lucio Franco
parent
c63c107560
commit
85060500f3
@@ -6,11 +6,6 @@ edition = "2018"
|
||||
publish = false
|
||||
license = "MIT"
|
||||
|
||||
[features]
|
||||
default = ["tonic"]
|
||||
tls_openssl = ["tonic", "tonic/tls", "tonic/openssl"]
|
||||
tls_rustls = ["tonic", "tonic/tls", "tonic/rustls"]
|
||||
|
||||
[[bin]]
|
||||
name = "client"
|
||||
path = "src/bin/client.rs"
|
||||
@@ -21,7 +16,7 @@ path = "src/bin/server.rs"
|
||||
|
||||
[dependencies]
|
||||
tokio = "=0.2.0-alpha.6"
|
||||
tonic = { path = "../tonic", optional = true }
|
||||
tonic = { path = "../tonic", features = ["tls"] }
|
||||
prost = "0.5"
|
||||
prost-derive = "0.5"
|
||||
bytes = "0.4"
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::time::Duration;
|
||||
use structopt::{clap::arg_enum, StructOpt};
|
||||
use tonic::transport::Endpoint;
|
||||
#[cfg(any(feature = "tls_rustls", feature = "tls_openssl"))]
|
||||
use tonic::transport::{Certificate, ClientTlsConfig};
|
||||
use tonic_interop::client;
|
||||
|
||||
@@ -33,32 +32,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||
.concurrency_limit(30);
|
||||
|
||||
if matches.use_tls {
|
||||
#[cfg(not(any(feature = "tls_rustls", feature = "tls_openssl")))]
|
||||
{
|
||||
panic!("No TLS library feature selected");
|
||||
}
|
||||
|
||||
#[cfg(feature = "tls_rustls")]
|
||||
{
|
||||
let pem = tokio::fs::read("tonic-interop/data/ca.pem").await?;
|
||||
let ca = Certificate::from_pem(pem);
|
||||
endpoint = endpoint.tls_config(
|
||||
ClientTlsConfig::with_rustls()
|
||||
.ca_certificate(ca)
|
||||
.domain_name("foo.test.google.fr"),
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(feature = "tls_openssl")]
|
||||
{
|
||||
let pem = tokio::fs::read("tonic-interop/data/ca.pem").await?;
|
||||
let ca = Certificate::from_pem(pem);
|
||||
endpoint = endpoint.tls_config(
|
||||
ClientTlsConfig::with_openssl()
|
||||
.ca_certificate(ca)
|
||||
.domain_name("foo.test.google.fr"),
|
||||
);
|
||||
}
|
||||
let pem = tokio::fs::read("tonic-interop/data/ca.pem").await?;
|
||||
let ca = Certificate::from_pem(pem);
|
||||
endpoint = endpoint.tls_config(
|
||||
ClientTlsConfig::with_rustls()
|
||||
.ca_certificate(ca)
|
||||
.domain_name("foo.test.google.fr"),
|
||||
);
|
||||
}
|
||||
|
||||
let channel = endpoint.connect().await?;
|
||||
|
||||
@@ -3,7 +3,6 @@ use structopt::StructOpt;
|
||||
use tonic::body::BoxBody;
|
||||
use tonic::client::GrpcService;
|
||||
use tonic::transport::Server;
|
||||
#[cfg(any(feature = "tls_rustls", feature = "tls_openssl"))]
|
||||
use tonic::transport::{Identity, ServerTlsConfig};
|
||||
use tonic_interop::{server, MergeTrailers};
|
||||
|
||||
@@ -50,28 +49,11 @@ async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
|
||||
});
|
||||
|
||||
if matches.use_tls {
|
||||
#[cfg(not(any(feature = "tls_rustls", feature = "tls_openssl")))]
|
||||
{
|
||||
panic!("No TLS library feature selected");
|
||||
}
|
||||
let cert = tokio::fs::read("tonic-interop/data/server1.pem").await?;
|
||||
let key = tokio::fs::read("tonic-interop/data/server1.key").await?;
|
||||
let identity = Identity::from_pem(cert, key);
|
||||
|
||||
#[cfg(feature = "tls_rustls")]
|
||||
{
|
||||
let cert = tokio::fs::read("tonic-interop/data/server1.pem").await?;
|
||||
let key = tokio::fs::read("tonic-interop/data/server1.key").await?;
|
||||
let identity = Identity::from_pem(cert, key);
|
||||
|
||||
builder = builder.tls_config(ServerTlsConfig::with_rustls().identity(identity));
|
||||
}
|
||||
|
||||
#[cfg(feature = "tls_openssl")]
|
||||
{
|
||||
let cert = tokio::fs::read("tonic-interop/data/server1.pem").await?;
|
||||
let key = tokio::fs::read("tonic-interop/data/server1.key").await?;
|
||||
let identity = Identity::from_pem(cert, key);
|
||||
|
||||
builder = builder.tls_config(ServerTlsConfig::with_openssl().identity(identity));
|
||||
}
|
||||
builder = builder.tls_config(ServerTlsConfig::with_rustls().identity(identity));
|
||||
}
|
||||
|
||||
let test_service = server::TestServiceServer::new(server::TestService::default());
|
||||
|
||||
@@ -15,15 +15,8 @@ case "$OSTYPE" in
|
||||
esac
|
||||
|
||||
ARG="${1:-""}"
|
||||
TLS_PROVIDER="${2:-""}"
|
||||
|
||||
if [[ -n "${TLS_PROVIDER}" ]] ; then
|
||||
FEATURES="--features ${TLS_PROVIDER}"
|
||||
else
|
||||
FEATURES=
|
||||
fi
|
||||
|
||||
(cd tonic-interop && cargo build --bins ${FEATURES})
|
||||
(cd tonic-interop && cargo build --bins)
|
||||
|
||||
SERVER="tonic-interop/bin/server_${OS}_amd64${EXT}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user