Commit Graph
239 Commits
Author SHA1 Message Date
Juan AlvarezandLucio Franco f9502dfd7e fix: Sanitize custom metadata (#138) 2019-11-15 13:44:19 +01:00
Juan AlvarezandLucio Franco 997241c43f feat: Add Status constructors (#137)
Co-Authored-By: Lucio Franco <[email protected]>
2019-11-15 13:32:34 +01:00
James NugentandLucio Franco 85060500f3 fix(transport): Remove support for OpenSSL (#141)
BREAKING CHANGE: Remove support for OpenSSL within the transport.
2019-11-15 13:30:42 +01:00
Nicholas BishopandLucio Franco c63c107560 fix(docs): typo in lib.rs (#142) 2019-11-14 23:34:07 +01:00
Jake ShadleandJames Nugent fbd91c3773 chore(build): Add cargo-deny CI workflow and configuration 2019-11-14 18:59:04 +02:00
Juan AlvarezandLucio Franco 85ef18f8b7 fix(transport): Update builders to move self (#132) 2019-11-11 15:27:40 +01:00
James NugentandGitHub 4490812ab4 Clarify what the Interop (Rustls) task is doing during CI (#131) 2019-11-10 18:08:59 +01:00
Lucio FrancoandGitHub 5fe21f3b24 chore: Prepare alpha.6 release (#130) 2019-11-10 17:40:51 +01:00
James NugentandLucio Franco 79996f7c93 Allow selection of TLS library in Interop tests (#129) 2019-11-10 17:28:03 +01:00
Lucio FrancoandGitHub 23e7695800 fix(transport): Load balance connecting panic (#128)
Closes #127
2019-11-10 16:28:05 +01:00
James NugentandLucio Franco b2c1d2e2b7 Add Windows build for interop crate (#126)
* Update rust interop test binaries to v1.25.1

* Add Windows build for interop crate
2019-11-10 12:15:39 +01:00
James NugentandLucio Franco ed53be5779 Use rustls for interop tests (#125)
* Use rustls for interop tests

This commit changes the interop tests to use rustls instead of openssl.
Apparently in the past there was some issue with this, but it seems to
work OK to me.

* Use certificates with larger key sizes for interop

This commit switches out the certificates used for testing interop to be
based on 4096-bit RSA keys, allowing rustls to be used for the interop
testing instead of OpenSSL.

The keys are generated using Terraform, although the state file is not
committed. A README.md is added to the data directory that explains how
to use Terraform to rotate the test certificates if this is ever
desirable.

This is desirable in order that none of the crates which `cargo build
--all` will build have the `openssl` feature, which should allow Tonic
to build on Windows with no issues.
2019-11-09 17:00:23 +00:00
James NugentandLucio Franco ac0e333b39 feat(transport): Add system root anchors for TLS (#114)
As per #101, it is sometimes desirable to use standard web PKI roots for
gRPC clients. This commit adds a method to ClientTlsConfig to add the
trust roots from the system certificate store:

- OpenSSL uses `openssl-probe` to search the system for roots.
- Rustls uses `rustls-native-certs` to load the system roots.

Enabling the `openssl-roots` or `rustls-roots` feature for `tonic` in
`Cargo.toml` will add system roots by default when configuring a gRPC
client.
2019-11-09 16:30:44 +00:00
James SteeleandLucio Franco b02b4b238b fix(build): Prevent duplicated client/server generated code (#121)
* fix(build): Prevent duplicated client/server generated code

The tonic-build process collects up RPC services as they are provided by
prost, before writing them out as part of the finalization step for a
given protocol buffer package.

In the case of imported protocol buffer packages, there may be RPC
services included by import in addition to those in the top-level
package. Therefore it is necessary to make sure each set of
client/server services gathered by tonic-build is cleared after the
finalization process for a given protocol buffer package, otherwise they
will be incorrectly aggregated as the generation process proceeds
through the subsequent packages.

* Test case for duplicated client/server generated code

A simple test case that will fail to build without a fix to prevent
RPC services being duplicated into inappropriate modules (that related
to particular protocol buffer packages).

* Additional test case for included_service

Introduces an additional case that captures making sure services defined
before including a package with additional services doesn't
incidentially clear such precursor services from the including package.

* Fix unnecessary newline to keep `cargo fmt` happy
2019-11-09 15:45:22 +00:00
James NugentandLucio Franco 4d4dbdf074 Use Stable Rust in CI (#124) 2019-11-09 10:03:49 +00:00
Juan AlvarezandLucio Franco 3809f18dc6 update to stable toolchain (#122)
* update to stable toolchain

* remove toolchan note from routeguide
2019-11-09 09:54:18 +00:00
dominiquelefevreandLucio Franco 029950904a feat(transport): Enable TCP_NODELAY. (#120)
The combination of the Nagle algorithm on a client, and delayed ack on a server
can introduce up to 200ms latency if a small gRPC messages is sent with multiple
writes.

Enable TCP_NODELAY to make sure that neither client, nor server buffer their
messages for too long when exchaning small requests.
2019-11-06 10:55:39 -05:00
Lucio FrancoandGitHub 23f648b517 chore(docs): Add docs about Channel multiplexing (#113)
Signed-off-by: Lucio Franco <[email protected]>
2019-11-03 20:05:21 -05:00
Koki KatoandLucio Franco 0f5059a5ee chore(tutorials): Add another .await after client connect call (#112) 2019-11-02 12:15:45 -04:00
Juan AlvarezandLucio Franco 46bb2bf2a4 fix error in routeguide tutorial (#111) 2019-11-01 19:46:08 -04:00
WilcovandLucio Franco c9b7523a5b chore(tutorials): Add .await after client connect call (#109)
Both tutorials were missing .await on the client connect call, causing the compiler to issue errors.
Thanks for alce#6260 on the #tonic-users discord channel for providing the answer.
2019-10-31 17:54:21 -04:00
Lucio FrancoandGitHub 3a39b1e7c8 chore: Prepare alpha.5 release (#108)
Signed-off-by: Lucio Franco <[email protected]>
2019-10-31 14:26:35 -04:00
Lucio FrancoandGitHub 5c2f4dba32 feat(transport): Change channel connect to be async (#107)
This makes it so you can check if the initial connection
is established. Before this we used reconnect which would
lazily attempt to connect. So if you were trying to connect
to a non existant Server you wouldn't find out until after
you attempted your first RPC. This simplifies everything
by allowing you connect before creating the RPC client.

BREAKING CHANGE: `Endpoint::channel` was removed in favor of
an async `Endpoint::connect`.
2019-10-31 14:09:40 -04:00
108bad0d86 chore: Add cargo-hack to check features (#105)
* chore: Add `cargo-hack` to check features

Signed-off-by: Lucio Franco <[email protected]>

* Update .github/workflows/CI.yml

Co-Authored-By: Taiki Endo <[email protected]>
2019-10-31 12:19:52 -04:00
Lucio FrancoandGitHub 3ce61d9860 fix(codec): Enforce encoders/decoders are Sync (#84)
Closes #81
2019-10-30 15:00:31 -04:00
Lucio FrancoandGitHub 5b4f4689a2 feat(transport): Add service multiplexing/routing (#99)
* feat(transport): Add service multiplexing/routing

This change introduces a new "router" built on top of
`transport::Server` that allows one to run multiple
gRPC services on the same socket.

```rust
Server::builder()
    .add_service(greeter)
    .add_service(echo)
    .serve(addr)
    .await?;
```

There is also a new `multiplex` example showcasing
server side service multiplexing and client side
service multiplexing.

BREAKING CHANGES: `Server::serve` is now crate private
and all services must be added via `Server::add_service`.
Codegen also returns just a `Service` now instead of a
`MakeService` pair.

Closes #29

Signed-off-by: Lucio Franco [email protected]
2019-10-29 16:32:04 -04:00
Lucio FrancoandGitHub a17049f1f7 fix(codec): Remove custom content-type (#104)
This removes custom content-types in favor of
just using `application/grpc`. There is some
confusion around the specification but most
grpc implementations ignore the `+` and
anything after.
2019-10-29 16:12:41 -04:00
Juan AlvarezandLucio Franco 4bb087b5ff feat: Add IntoRequest and IntoStreamingRequest traits (#66) 2019-10-29 16:09:08 -04:00
Matt ConwayandLucio Franco af5754bd43 chore(docs): Bump tonic versions in tutorials (#96) 2019-10-26 22:44:01 -04:00
Daniel PrilikandLucio Franco eea3c0f99a fix(build): Fix missing argument in generate_connect (#95) 2019-10-23 17:46:40 -04:00
Lucio FrancoandGitHub 77fc74038f chore: Prepare alpha.4 release (#91)
* chore: Prepare alpha.4 release

* Update changelog
2019-10-23 15:09:49 -04:00
Lucio FrancoandGitHub 1dbde95d84 fix(build): Fix service and rpc name conflict (#92)
Closes #89
2019-10-23 15:01:04 -04:00
Matt ConwayandLucio Franco 50424a66ef Fix small spelling mistakes (#88) 2019-10-23 14:35:17 -04:00
hugecheeseandLucio Franco 580aa41bd0 chore(docs): Fix missing space in contributing.md (#87) 2019-10-23 11:33:53 -04:00
Lucio FrancoandGitHub 18c20a9c0d chore(readme): Remove readme examples (#79)
* chore(readme): Remove readme examples

This swaps out the readme example to use instead a link to the
routeguide tutorial.

* Add helloworld tutorial
2019-10-23 10:13:14 -04:00
Matt ConwayandLucio Franco 8ebedcde2f chore(docs): Add helloworld tutorial (#80) 2019-10-22 19:03:39 -04:00
John DouglasandLucio Franco 9b0613a16d chore: Add initial benchmarks (#53) 2019-10-22 18:24:25 -04:00
James NugentandLucio Franco 335a373a40 feat(transport): Add support client mTLS (#77)
This commit adds a simple API for specifying the TLS certificate a GRPC
client will present (via the same `Identity` wrapper as a server cert is
configured). It also adds an API to specify which CA certificate client
TLS certificates will be validated against for servers.
2019-10-22 17:00:08 -04:00
Phillip CloudandLucio Franco 9079e0f66b fix(codec): Properly decode partial DATA frames (#83) 2019-10-21 20:01:00 -04:00
Juan AlvarezandLucio Franco 5d0a795554 feat(docs): Add routeguide tutorial (#21) 2019-10-18 18:02:48 -04:00
Phillip CloudandLucio Franco 62101039ce Add rustfmt.toml with edition=2018 (#74)
* Ignore all target/ directories

* Add rustfmt.toml with an edition
2019-10-18 17:30:20 -04:00
James NugentandLucio Franco 2a4bdb24f6 fix(transport): Rename server tls config method (#73)
BREAKING CHANGE: `rustls_client_config` for the server has been renamed to `rustls_server_config`.
2019-10-18 17:28:25 -04:00
George HahnandLucio Franco 51ce0b9463 Suggestion: Add edition to example Cargo.toml snippet (#78) 2019-10-17 17:07:54 -04:00
Juan AlvarezandLucio Franco 7eda823c9c fix(client): Use Stream instead of TrySteam for client calls (#61) 2019-10-10 11:39:35 -04:00
Lucio FrancoandGitHub 8cddf8a12c chore: Prepare 0.1.0-alpha.3 release (#65) 2019-10-09 17:27:15 -04:00
Phillip CloudandLucio Franco 8ecfd2fc73 chore(transport): Bump hyper and http-body versions (#64) 2019-10-09 17:12:50 -04:00
Adam JacobandLucio Franco 06ff619944 feat(build): Expose prost-build type_attributes and field_attribu… (#60)
* chore: Add tags to .gitignore

When generating ctags/universal-ctags, a 'tags' file is generated. This
commit adds any generted 'tags' file to .gitignore.

* feat(build): Expose type_attribute and field_attribute

This commit exposes the `type_attribute` and `field_attribute`
configuration settings from Prost. These are useful to tweak/extend the
generated types.

For example:

```
tonic_build::configure()
    .out_dir(tmp)
    .format(false)
    .type_attribute(".", "#[derive(Serialize, Deserialize)]")
    .type_attribute(".", "#[serde(rename_all = \"camelCase\")]")
    .field_attribute("in", "#[serde(rename = \"in\")]")
    .compile(&["tests/protos/wellknown.proto"], &["tests/protos"])
    .unwrap();
```

Would add the serde `Serialize` and `Deserialize` traits, while renaming
all the fields to camelCase, and having serde keep fields named `in`
named `in`, rather than Prost's `in_`, to every type generated by Prost.
2019-10-08 18:11:42 -04:00
James NugentandLucio Franco 8db3961491 feat(transport): Expose more granular control of TLS configuration (#48)
This commit reworks TLS configuration of both servers and endpoints in
order to provide a more flexible API. We now add options to configure
the selected TLS library using the appropriate 'native' configuration
structures, as well as retaining the existing simplier interface which
is compatible with both.

The new API can also be easily extended to support simple interfaces for
configuring mTLS and a range of other options without creating sprawl
in the builders for `Server` and `Endpoint`.
2019-10-08 11:49:05 -04:00
Lucio FrancoandGitHub 4628ff0258 chore: Prepare 0.1.0-alpha.2 release (#58)
Signed-off-by: Lucio Franco <[email protected]>
2019-10-07 22:01:59 -04:00
BradyBromleyandLucio Franco d13a7b3617 Fixed punctuation in README.md (#55) 2019-10-07 21:56:16 -04:00