Commit Graph
220 Commits
Author SHA1 Message Date
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
Matthew DonougheandLucio Franco 736a537760 add tonic-build to readme (#54) 2019-10-07 21:38:16 -04:00
DomandLucio Franco 412a0bd697 fix(transport): Avoid exit after bad TLS handshake (#51)
* transport: no crash after bad TLS handshake

Prevents the server exiting after a bad TLS handshake / error during
accept(). Instead the connection is dropped and the server continues to
serve new clients.

Previously an error would bubble up from the TLS library (tested with
rustls) and cause hyper to exit with:

	[src/main.rs:85] &e = Error(
		Server,
		Error(
			Accept,
			Custom {
				kind: InvalidData,
				error: CorruptMessage,
			},
		),
	)

* transport: add tracing error for TLS handshake failure

Co-Authored-By: Lucio Franco <[email protected]>
2019-10-07 21:36:37 -04:00
Lucio FrancoandGitHub 01e72d9a95 chore(build): Fix wrong output type used in replace (#50) 2019-10-05 14:18:13 -04:00
Lucio FrancoandGitHub 4e1fcece15 fix(codegen): Use wellknown types from prost-types (#49)
This change introduces the ability to let prost-build
provide the fully qualifed type path for types that
start with `google.protobuf`.
2019-10-05 13:16:09 -04:00
Lucio FrancoandGitHub ed3e7e95a5 fix(codec): Fix buffer decode panic on full (#43)
* fix(codec): Fix buffer decode panic on full

This is a naive fix for the buffer growing beyond capacity
and producing a panic. Ideally we should do a better job
of not having to allocate for new messages by using
a link list.

* fmt
2019-10-04 19:17:41 -04:00
John DonethandLucio Franco bd2b4e0b77 chore(docs): Documentation corrections (#41) 2019-10-04 16:44:43 -04:00
James NugentandLucio Franco 2c5c3a282a fix(transport): Attempt to load RSA private keys in rustls (#39)
Currently, using an RSA key - or indeed any text which is not a
PEM-encoded PKCS8-format key with RusTLS panics with an index-out-of-
range exception.

This commit introduces two new types of `TlsError` which indicate
problems with loading a certificate or private key:

- `CertificateParseError`, indicating that the certificate cannot be
  parsed

- `PrivateKeyParseError`, indicating that the private key cannot be
  parsed.

Additionally, in the case that reading the private key as PKCS8 fails,
we now try loading it as an RSA key before failing.
2019-10-04 11:31:17 -04:00
John DonethandLucio Franco 2b564aeb06 chore(docs): Add documentation for modified tonic-build output directory (#40)
* improve docs for modified OUT_DIR

* rustfmt
2019-10-04 11:26:53 -04:00
John DonethandLucio Franco 0218d58c28 feat(transport): Expose http/2 settings (#28)
* expose http2 settings

* add client http2 options
2019-10-04 10:08:37 -04:00
Kevin ZhangandLucio Franco afa9d9d236 Fix typo in examples readme (#36) 2019-10-03 16:09:39 -04:00
Lucio FrancoandGitHub 4559613c37 feat(codgen): Add default implementations for the generated serve… (#27)
* Rename servce -> server

* Add default impl for server trait
2019-10-02 16:01:44 -04:00
Lucio FrancoandGitHub 2670b349f9 fix(codegen): Fix Empty protobuf type and add unimplemented (#26)
* Add license attribute to tonic-build

* fix(codegen): Fix Empty protobuf type and add unimplemented

* Remove syn full feature
2019-10-01 23:46:54 -04:00
Lucio Franco 2734d3af28 Point tonic to root readme 2019-10-01 22:32:06 -04:00
Lucio Franco c1db64244e Fix spelling of helloworld 2019-10-01 22:15:44 -04:00
Lucio FrancoandGitHub a282b6682d chore(release): Prepare 0.1.0-alpha.1 release (#24) 2019-10-01 22:13:52 -04:00
Lucio FrancoandGitHub 8f80d0f6d1 chore(docs): Update tonic-build docs (#22) 2019-10-01 19:34:45 -04:00
Lucio Franco 09c77d4713 Attempt to make CI work for PRs 2019-10-01 19:27:59 -04:00
Lucio FrancoandGitHub 40973238d6 Add CI workflow (#23)
* Add CI workflow

* Delete interop.yml

* Delete test.yml

* deny warnings

* Fix unused mut
2019-10-01 19:26:17 -04:00
Lucio Franco b8483b92f9 Update logos 2019-10-01 17:53:10 -04:00