Commit Graph

111 Commits

Author SHA1 Message Date
tottoto 076a81ce6e chore(examples): Update to listenfd 1.0 (#1168) 2022-11-29 14:00:20 -05:00
f82488c499 chore: Fix type in routeguide (#1136) 2022-11-07 10:58:11 -05:00
Francesco Guardiani a98d719fb4 feat(web): Removed Cors impl and replaced with tower-http's CorsLayer (#1123)
Fix #1122, see the issue for more details.

Signed-off-by: slinkydeveloper <francescoguard@gmail.com>
2022-10-31 13:56:36 -04:00
Masakazu Muraoka 2d66a0aa30 Update helloworld-tutorial.md (#1057)
grpcurl command have been run successfully with modifieded like above.
2022-08-15 10:33:01 -04:00
Opisthoteuthis agassizii fb840583d3 chore(docs): Update docs to mention new protoc requirements in tonic >= 0.8.0 (#1050) 2022-08-09 09:31:03 -07:00
Lucio Franco ec359ba35f chore: Prepare 0.8 release (#1044) 2022-07-29 16:45:57 -04:00
Lucio Franco 10f6d2f1a9 feat: Add Grpc::with_origin for clients (#1017) 2022-06-20 09:36:51 -04:00
Marcus Griep a585a72293 feat!: remove codegen dependency on compression feature (#1004) 2022-06-13 17:48:27 -04:00
Joseph LeBlanc ec9ee61925 Small wording change for newbie-friendly clarity (#995) 2022-05-20 13:01:52 -04:00
Brandon Williams de2e4ac077 feat(build): Better support for custom codecs (#999)
BREAKING CHANGE: `CODEC_PATH` moved from const to fn
2022-05-05 12:52:03 -04:00
Lucio Franco 6857c834c2 chore: Fix rustls server example (#997) 2022-05-04 15:34:37 -04:00
Adam Chalmers edc5a0d88d feat: Add TryFrom implementations for MetadataValue (#990)
Co-authored-by: Adam Chalmers <adamschalmers@gmail.com>
2022-05-02 13:38:42 -04:00
cui fliter 6d95473877 chore: fix some typos (#984)
Signed-off-by: cuishuang <imcusg@gmail.com>
2022-04-28 01:37:12 +02:00
David Pedersen 13b55df1d0 chore: update tower-http (#985)
* Update tower-http

* one more update
2022-04-27 15:14:55 +02:00
Lucio Franco 03fb09ccb8 chore: Add rustls examples (#968) 2022-04-07 14:24:04 -04:00
Lucio Franco 808c417cbd chore: Prepare 0.10 release (#954) 2022-03-31 17:05:54 -04:00
Jesse Szwedko c78274e3fe feat: Update prost to 0.10 (#948) 2022-03-30 10:43:06 -04:00
Sylwester Rąpała 01e5be5080 Add example of detecting client drops in bidirectional streams on server side (#931) 2022-03-03 11:50:43 -05:00
Lucio Franco a359539a22 chore: Update mock example (#926) 2022-02-24 09:28:53 -05:00
Sylwester Rąpała c9e78c4d65 chore: Fulfill MIT license requirments (#916) 2022-02-18 13:56:47 -05:00
Anthony Green dee2ab52ff feat(transport): add unix socket support in server (#861) 2022-02-14 15:00:58 -05:00
Matthias Vogelgesang d6c0fc112b feat(build): use prettyplease to format output (#890) (#904) 2022-02-10 13:20:52 -05:00
tottoto 366d888a4b chore: Fix clippy lints (#881) 2022-01-12 16:32:40 -05:00
tottoto daf406dd2b chore: Update tracing-subscriber to 0.3 (#873) 2021-12-30 09:53:02 +01:00
Jimmy 16321c279f docs: fix typo in the streaming example. (#871) 2021-12-25 00:03:20 +01:00
David Pedersen 101f2f76d4 chore: revert to 2018 edition (#847)
Fixes https://github.com/hyperium/tonic/issues/843
2021-12-07 09:49:07 +01:00
Mfon Eti-mfon c62f382e3c chore(examples): fix wording in helloworld tutorial (#836)
closes #835
2021-11-11 16:49:45 +01:00
Cezar Mathe 8508f369c2 fix(examples): Fix autoreload example (#798) (#818) 2021-11-01 18:29:44 -04:00
Lucio Franco 2fe7131a23 chore: Prepare 0.6.0 release (#811) 2021-10-25 10:25:56 -04:00
Lucio Franco 23c1392fb7 fix(tonic): Remove Sync requirement for streams (#804) 2021-10-24 21:48:05 -04:00
Lucio Franco 1f3df8db9e chore: Upgrade to 2021 edition (#808) 2021-10-24 21:12:20 -04:00
Lucio Franco bbcacd0625 chore: Fix routeguide example warning (#807) 2021-10-22 11:17:04 -04:00
Eliza Weisman 09805ece45 feat: Update prost and friends to 0.9 (#791) 2021-10-19 10:59:28 -04:00
Lucio Franco 4604042934 Add streaming example w/ client disconnect (#782) 2021-10-07 17:04:26 -04:00
Jerboas86 ddab65ede9 docs: fix typo (#760)
in in <--> in
2021-09-08 18:43:10 +02:00
David Pedersen 4e578b5046 doc(tonic): add more interceptor examples (#736)
Some have asked how to use the new `Interceptor` trait to create named
interceptors. This updates the client example to show how to do that.
2021-08-09 16:42:15 +02:00
Yotam Ofek 8c8f4d1251 feat(tonic): add Interceptor trait (#713)
* Expose `Interceptor` trait.

* Revert changes to public API surface.

* Rename types, add deprecated alias for old names.
2021-07-27 11:11:51 -04:00
David Pedersen 4b0ece6d28 chore: fix clippy lints (#707) 2021-07-09 18:23:55 +02:00
David Pedersen 5aa8ae1fec feat(examples): add grpc-web example (#710)
Creates a server using tonic-web and a client that uses a regular
`hyper::Client` and issues a regular HTTP/1.1 request.
2021-07-09 18:02:43 +02:00
Lucio Franco 040e3a4811 chore: Prepare v0.5 release (#706)
* bump tonic version to 0.5

* Update changelog for 0.5

* Update CHANGELOG.md

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>

* address comments

Co-authored-by: David Pedersen <david.pdrsn@gmail.com>
2021-07-08 15:53:14 -04:00
David Pedersen acdb3273bb chore: update prost, and related crates, to 0.8 (#703)
* chore: update prost, and related crates, to 0.8

Updates prost, prost-derive, prost-build, and prost-types to 0.8.

* Update the last few places
2021-07-08 15:02:02 -04:00
Conner Bryan a948a8f884 feat(build): support adding attributes to clients and servers (#684) 2021-07-08 15:01:28 -04:00
Lucio Franco 2346d99f6e example: Add mocked io example (#677)
* example: Add mocked io example

* fix mock example

* Remove uniex bound for mock impl
2021-07-08 10:45:04 -04:00
David Pedersen 0583cff80f feat(codec): compression support (#692)
* Initial compression support

* Support configuring compression on `Server`

* Minor clean up

* Test that compression is actually happening

* Clean up some todos

* channels compressing requests

* Move compression to be on the codecs

* Test sending compressed request to server that doesn't support it

* Clean up a bit

* Compress server streams

* Compress client streams

* Bidirectional streaming compression

* Handle receiving unsupported encoding

* Clean up

* Add note to future self

* Support disabling compression for individual responses

* Add docs

* Add compression examples

* Disable compression behind feature flag

* Add some docs

* Make flate2 optional dependency

* Fix docs wording

* Format

* Reply with which encodings are supported

* Convert tests to use mocked io

* Fix lints

* Use separate counters

* Don't make a long stream

* Address review feedback
2021-07-02 11:25:03 -04:00
David Pedersen e5e311853b feat(transport): provide generic access to connect info (#647) 2021-05-28 13:27:37 +02:00
David Pedersen 4d2667d1cb feat(tonic): make it easier to add tower middleware to servers (#651) 2021-05-19 09:19:58 +02:00
David Pedersen 4dda4cbcca feat(tonic): Use BoxBody from http-body crate (#622)
As of `http-body` 0.4.1 its has had a `BoxBody` type similar to
`tonic::body::BoxBody`. It also has `Empty` and `Body::map_{data,err}`.

That means all the custom body things we had in tonic can basically be
replaced with that.

Note that this is a breaking change so we should merge this next time we
decide to ship a breaking release.

The breaking changes are:

- `tonic::body::Body` has been removed. I think its fine for users to
depend directly on `http-body` if they need this trait.
- `tonic::body::BoxBody` is now just a type alias for
`http_body::combinators::BoxBody<Bytes, Status>`. So the methods it
previously had are gone. The replacements are
  - `tonic::body::Body::new` -> `http_body::Body::boxed`
  - `tonic::body::Body::map_from` -> `http_body::Body::map_data` and
  `http_body::Body::map_err` depending on which part you want to map.
  - `tonic::body::Body::empty` -> `http_body::Empty`

Additionally a `Sync` bound has been added to a few methods. I actually
don't think this is a breaking change because the old
`tonic::body::Body` trait had `Sync` as a supertrait meaning the `Sync`
requirement was already there.

Fixes https://github.com/hyperium/tonic/issues/557
2021-05-18 10:41:21 +02:00
JaydenElliott f613386d95 doc(examples): fixed grammar (#646) 2021-05-14 07:35:15 +02:00
David Pedersen 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
David Pedersen 4a917a32f0 fix(examples): Fix tower examples (#624)
Doing

```rust
let clone = self.inner.clone();
Box::pin(async move {
    let response = clone.call(request).await?;
    Ok(response)
})
```

If `self.inner` is (or contains) a `tower::buffer::Buffer` might panic.

That is because cloning a `Buffer` drops the permit that was acquired in
`poll_ready`, meaning it is no longer ready and panic in `call`.

The solution is to use `mem::replace` to take the ready service and pass
that into the async block.

Fixes https://github.com/hyperium/tonic/issues/545
2021-05-07 09:45:35 +02:00