Files
tonic/examples
David PedersenandGitHub 352b0f584b feat(tonic): add Request and Response extensions (#642)
Adds `tonic::Extensions` which is a newtype around `http::Extensions`.

Request extensions can be set by interceptors with
`Request::extensions_mut` and retrieved from RPCs with
`Request::extensions`. Extensions can also be set in tower middleware
and will be carried through to the RPC.

Since response extensions cannot be set by interceptors the main use
case is to set them in RPCs and retrieve them in tower middlewares.
Figured that might be useful.

Fixes https://github.com/hyperium/tonic/issues/255
2021-05-13 15:54:20 +02:00
..

Examples

Set of examples that show off the features provided by tonic.

Helloworld

Client

$ cargo run --bin helloworld-client

Server

$ cargo run --bin helloworld-server

RouteGuide

Client

$ cargo run --bin routeguide-client

Server

$ cargo run --bin routeguide-server

Authentication

Client

$ cargo run --bin authentication-client

Server

$ cargo run --bin authentication-server

Load Balance

Client

$ cargo run --bin load-balance-client

Server

$ cargo run --bin load-balance-server

Dynamic Load Balance

Client

$ cargo run --bin dynamic-load-balance-client

Server

$ cargo run --bin dynamic-load-balance-server

TLS (rustls)

Client

$ cargo run --bin tls-client

Server

$ cargo run --bin tls-server

Health Checking

Server

$ cargo run --bin health-server

Server Reflection

Server

$ cargo run --bin reflection-server

Tower Middleware

Server

$ cargo run --bin tower-server

Autoreloading Server

Server

systemfd --no-pid -s http::[::1]:50051 -- cargo watch -x 'run --bin autoreload-server'

Notes:

If you are using the codegen feature, then the following dependencies are required:

The autoload example requires the following crates installed globally: