feat: Add gRPC interceptors (#232)

This change introduces proper gRPC interceptors that are avilable
regardless of the transport used. Each codegen service now produces an
additional method called `with_interceptor` that accepts a
`Interceptor`.

All examples have been updated to use this new style and interop has a
custom `tower::Service` middleware to echo the headers. There is also a
new `interceptor` example that shows basic usage.

BREAKING CHANGE: removed `interceptor_fn` and `intercep_headers_fn` from `transport` in favor of using `tonic::Interceptor`.
This commit is contained in:
Lucio Franco
2020-01-13 21:26:08 -05:00
committed by GitHub
parent 0fa2bf1cea
commit eba7ec7b32
25 changed files with 456 additions and 273 deletions
+1 -2
View File
@@ -5,11 +5,10 @@ pub mod hello_world {
}
use hello_world::{greeter_client::GreeterClient, HelloRequest};
use http::Uri;
use std::convert::TryFrom;
#[cfg(unix)]
use tokio::net::UnixStream;
use tonic::transport::Endpoint;
use tonic::transport::{Endpoint, Uri};
use tower::service_fn;
#[cfg(unix)]