3 releases

0.0.3 May 10, 2025
0.0.2 Apr 12, 2025
0.0.1 Mar 17, 2025

#9 in #quinn

Download history 100/week @ 2025-03-15 14/week @ 2025-03-22 1/week @ 2025-04-05 123/week @ 2025-04-12 8/week @ 2025-04-19 1/week @ 2025-05-03 143/week @ 2025-05-10 6/week @ 2025-05-17

150 downloads per month

MIT license

52KB
991 lines

tonic-h3

build License: MIT Crates.io Documentation

Experimental implementation of running tonic grpc on h3, following the proposal: G2-http3-protocol

tonic-h3 is targeted to support all quic transport implementations that integrates with h3. Currently the following are incoporated and tested:

See examples and tests for getting started.

Compatibility with grpc-dotnet with http3 is tested here.

Supporting crates

  • axum-h3 Use axum with h3, used by tonic-h3 server.
  • h3-util Http3 server and client utilities used by axum-h3 and tonic-h3.
  • Other quic wrapping crates to support alternative quic implementations.

tonic examples

Server:

  async fn run_server(endpoint: h3_quinn::quinn::Endpoint) -> Result<(), tonic_h3::Error> {
      let router = tonic::transport::Server::builder()
          .add_service(GreeterServer::new(HelloWorldService {}));
      let acceptor = tonic_h3::quinn::H3QuinnAcceptor::new(endpoint.clone());
      tonic_h3::server::H3Router::from(router)
          .serve(acceptor)
          .await?;
      endpoint.wait_idle().await;
      Ok(())
  }

Client:

  async fn run_client(
      uri: http::Uri,
      client_endpoint: h3_quinn::quinn::Endpoint,
  ) -> Result<(), tonic_h3::Error> {
      let channel = tonic_h3::quinn::new_quinn_h3_channel(uri.clone(), client_endpoint.clone());
      let mut client = crate::greeter_client::GreeterClient::new(channel);
      let request = tonic::Request::new(crate::HelloRequest {
          name: "Tonic".into(),
      });
      let response = client.say_hello(request).await?;
      println!("RESPONSE={:?}", response);
      Ok(())
  }

License

MIT license. See LICENSE.

Dependencies

~8–21MB
~339K SLoC