fix(transport): Update builders to move self (#132)

This commit is contained in:
Juan Alvarez
2019-11-11 15:27:40 +01:00
committed by Lucio Franco
parent 4490812ab4
commit 85ef18f8b7
9 changed files with 144 additions and 112 deletions
+2 -3
View File
@@ -29,14 +29,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let tls_config = ClientTlsConfig::with_rustls()
.ca_certificate(Certificate::from_pem(certs.as_slice()))
.domain_name("pubsub.googleapis.com")
.clone();
.domain_name("pubsub.googleapis.com");
let channel = Channel::from_static(ENDPOINT)
.intercept_headers(move |headers| {
headers.insert("authorization", header_value.clone());
})
.tls_config(&tls_config)
.tls_config(tls_config)
.connect()
.await?;
+2 -3
View File
@@ -12,11 +12,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let tls = ClientTlsConfig::with_rustls()
.ca_certificate(ca)
.domain_name("example.com")
.clone();
.domain_name("example.com");
let channel = Channel::from_static("http://[::1]:50051")
.tls_config(&tls)
.tls_config(tls)
.connect()
.await?;
-1
View File
@@ -60,7 +60,6 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
Server::builder()
.tls_config(ServerTlsConfig::with_rustls().identity(identity))
.clone()
.add_service(pb::server::EchoServer::new(server))
.serve(addr)
.await?;
+2 -3
View File
@@ -16,11 +16,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let tls = ClientTlsConfig::with_rustls()
.domain_name("localhost")
.ca_certificate(server_root_ca_cert)
.identity(client_identity)
.clone();
.identity(client_identity);
let channel = Channel::from_static("http://[::1]:50051")
.tls_config(&tls)
.tls_config(tls)
.connect()
.await?;
+2 -3
View File
@@ -39,11 +39,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let tls = ServerTlsConfig::with_rustls()
.identity(server_identity)
.client_ca_root(client_ca_cert)
.clone();
.client_ca_root(client_ca_cert);
Server::builder()
.tls_config(&tls)
.tls_config(tls)
.add_service(pb::server::EchoServer::new(server))
.serve(addr)
.await?;