Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
c9c17c7
Add From<T> for Response<T> (#1064)
amrhassan Jan 31, 2025
f4bc1fd
chore: Add getrandom and wasi crate to cargo-deny skip config (#2169)
tottoto Jan 31, 2025
f07abb2
chore(examples): Update to rand 0.9 (#2168)
tottoto Jan 31, 2025
78be69e
chore(interop): Replace repeat and take with repeat_n (#2170)
tottoto Jan 31, 2025
a2769c4
Update LICENSE (#2167)
maximevtush Feb 11, 2025
1a7a61d
chore(transport): Update url to http crate document (#2173)
tottoto Feb 11, 2025
766fa85
chore: Refactor redundant pattern match (#2174)
tottoto Feb 11, 2025
2b7e2c3
chore(transport): Remove redundant type reconstruct (#2176)
tottoto Feb 11, 2025
fc940ce
chore: Update to strum 0.27 (#2180)
tottoto Feb 11, 2025
77cee9c
feat: optional `SSLKEYLOGFILE` support (#1539)
crepererum Mar 1, 2025
8ee85fc
chore: Remove html_root_url (#2184)
tottoto Mar 1, 2025
72b0fd5
chore: Remove unused mutability (#2183)
tottoto Mar 1, 2025
476cb38
chore: Update generated code (#2222)
tottoto Mar 24, 2025
b77e0eb
chore: Update cargo-deny config (#2210)
tottoto Mar 24, 2025
e1fe87c
Remove unnecessary mut (#2219)
dakaizou Mar 24, 2025
9e9ad8a
chore: fix some comments (#2224)
jimmycathy Mar 24, 2025
15e715c
feat: Allow convert i32 to Code in const context (#2195)
tottoto Mar 24, 2025
881dc87
chore: Disable unused tower feature (#2196)
tottoto Mar 24, 2025
8a658cf
chore(router): Remove unnecessary body type converting (#2214)
tottoto Mar 25, 2025
5cf8562
chore(server): Use standard library pin macro (#2212)
tottoto Mar 25, 2025
e0bc029
chore(build): Use idiomatic api (#2211)
tottoto Mar 25, 2025
7da12d4
feat(tonic): Exclude benches-disabled to remove Apache-2.0 resource (…
tottoto Mar 25, 2025
0456310
chore(ci): Add concurrency group to cancel old ci (#2202)
tottoto Mar 25, 2025
b7bc599
chore(test): Use library crate in test (#2201)
tottoto Mar 25, 2025
9910bfa
chore: Remove unused rand crate from dev-dependencies (#2198)
tottoto Mar 25, 2025
082da3f
chore: Remove documentation config in manifest (#2193)
tottoto Mar 25, 2025
7274ce2
chore(test): Remove unnecessary macro_use (#2200)
tottoto Mar 25, 2025
45a0cfe
feat: Add proto header to generated code (#2205)
tottoto Mar 25, 2025
7b4803b
chore(router): Use upstream poll_ready to implement service (#2215)
tottoto Mar 25, 2025
6a34e26
feat(router): Use infallible as error type (#2232)
tottoto Mar 25, 2025
99476a4
chore: Remove unnecessary license file from private crate (#2203)
tottoto Mar 25, 2025
2f76364
chore: update changelog to point to releases (#2235)
LucioFranco Mar 25, 2025
0e6c9cb
chore: fix changelog header
LucioFranco Mar 25, 2025
29fcc7f
chore(server): Remove import sleep and pending function (#2234)
tottoto Mar 25, 2025
e36a168
chore(server): Refactor default http2 keepalive timeout config (#2213)
tottoto Mar 25, 2025
885b38e
chore: Remove unnecessary docs.rs config (#2223)
tottoto Mar 25, 2025
7b2984c
feat(transport): add support for uds, unix domain socket (#2218)
adamcavendish Mar 25, 2025
8be906d
Handle stream error correctly (#2199)
Suficio Mar 25, 2025
7ef5f6f
chore: Remove resolved cargo-deny config (#2230)
tottoto Mar 25, 2025
af5ef5f
Create place for grpc crate and initial contents (#2192)
dfawley Apr 3, 2025
fee9c13
grpc-web: relax bounds for inner service's response body (#2245)
bmwill Apr 5, 2025
457ae30
chore(test): Allow clippy::doc_overindented_list_items lint in genera…
tottoto Apr 7, 2025
5ecc607
chore(test): Update to rand 0.9 (#2236)
tottoto Apr 7, 2025
f04bf29
chore(router): Remove unnecessary type converting (#2237)
tottoto Apr 7, 2025
13b9643
chore(ci): Update to nightly-2025-03-27 on udeps ci (#2242)
tottoto Apr 7, 2025
50253f1
chore(codegen): Update to protox 0.8 (#2254)
tottoto Apr 17, 2025
55e48c0
chore(ci): Remove deny job (#2255)
LucioFranco Apr 23, 2025
e0ea5d0
feat: preserve request user-agent (#2250)
dbolduc Apr 23, 2025
fa413fc
feat(server): Add method to get local addr to TcpIncoming (#2233)
tottoto Apr 23, 2025
09a8c07
feat: expose Status as a Response extension (#2145)
tamasfe Apr 25, 2025
90a500b
chore(server): Remove unnecessary await service ready (#2258)
tottoto Apr 29, 2025
cb6c67f
chore: Use symbolic link for license file (#2241)
tottoto Apr 30, 2025
97001f3
chore: Use inline format argument (#2260)
tottoto May 1, 2025
1c139f3
chore: Add `flake.nix` (#2261)
LucioFranco May 1, 2025
eeac1d3
chore: Fix interop test certs (#2262)
LucioFranco May 1, 2025
67e2ef9
fix: tls config overwrite in endpoint (#2252)
vigneshs-12 May 1, 2025
9669ce4
chore(tonic-bench): Fix failing bench (#2207)
rafaeling May 1, 2025
aa27260
feat: expose creation of HealthService and HealthReporter (#2251)
LeonHartley May 5, 2025
fd60c04
[spr] initial version (#2264)
LucioFranco May 5, 2025
ee6775c
Revert "[spr] initial version (#2264)" (#2265)
LucioFranco May 5, 2025
b303caa
chore: Prepare `v0.13.1` release
LucioFranco May 5, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
merge_group:
branches: [ "master" ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
RUSTFLAGS: "-D warnings"

Expand All @@ -21,14 +25,6 @@ jobs:
components: rustfmt
- run: cargo fmt --all --check

deny:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: hecrj/setup-rust-action@v2
- uses: taiki-e/install-action@cargo-deny
- run: cargo deny check

clippy:
runs-on: ubuntu-latest
steps:
Expand All @@ -55,7 +51,7 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: nightly-2024-12-01
toolchain: nightly-2025-03-27
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-udeps
- uses: taiki-e/install-action@protoc
Expand Down Expand Up @@ -97,7 +93,7 @@ jobs:
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
- name: Get MSRV from manifest file
id: msrv
run: echo "version=$(yq '.workspace.package.rust-version' Cargo.toml)" >> $GITHUB_OUTPUT
run: echo "version=$(yq '.workspace.package.rust-version' Cargo.toml)" >> "$GITHUB_OUTPUT"
- uses: hecrj/setup-rust-action@v2
with:
rust-version: ${{ steps.msrv.outputs.version }}
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# NOTE: ths changelog is no longer used and from version `v0.13.0` onward we will be using github releases and the changes can be found [here](https://github.com/hyperium/tonic/releases).

# [0.12.3](https://github.com/hyperium/tonic/compare/v0.12.2...v0.12.3) (2024-08-29)

### Features
Expand Down
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ members = [
"tonic-web", # Non-published crates
"examples",
"codegen",
"grpc",
"interop", # Tests
"tests/disable_comments",
"tests/included_service",
Expand Down Expand Up @@ -40,5 +41,8 @@ missing_docs = "warn"
rust_2018_idioms = "warn"
unreachable_pub = "warn"

[workspace.lints.clippy]
uninlined_format_args = "deny"

[workspace.lints.rustdoc]
broken_intra_doc_links = "deny"
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2020 Lucio Franco
Copyright (c) 2025 Lucio Franco

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ license = "MIT"
edition = "2021"

[dependencies]
protox = "0.7"
protox = "0.8"
prettyplease = "0.2"
quote = "1"
syn = "2"
Expand Down
36 changes: 33 additions & 3 deletions codegen/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,22 @@ fn codegen(
fn write_fds(fds: &FileDescriptorSet, path: &Path) {
const GENERATED_COMMENT: &str = "// This file is @generated by codegen.";

let mut file_header = String::new();

let mut fds = fds.clone();

for fd in fds.file.iter() {
let Some(source_code_info) = &fd.source_code_info else {
continue;
};

for location in &source_code_info.location {
for comment in &location.leading_detached_comments {
file_header += comment;
}
}
}

for fd in fds.file.iter_mut() {
fd.source_code_info = None;
}
Expand All @@ -126,8 +141,23 @@ fn write_fds(fds: &FileDescriptorSet, path: &Path) {
let ast = syn::parse2(tokens).unwrap();
let formatted = prettyplease::unparse(&ast);

let content = format!("{GENERATED_COMMENT}\n{formatted}");

let mut writer = BufWriter::new(File::create(path).unwrap());
writer.write_all(content.as_bytes()).unwrap();

writer.write_all(GENERATED_COMMENT.as_bytes()).unwrap();
writer.write_all(b"\n").unwrap();

if !file_header.is_empty() {
let file_header = comment_out(&file_header);
writer.write_all(file_header.as_bytes()).unwrap();
writer.write_all(b"\n").unwrap();
}

writer.write_all(formatted.as_bytes()).unwrap()
}

fn comment_out(s: &str) -> String {
s.split('\n')
.map(|line| format!("// {line}"))
.collect::<Vec<String>>()
.join("\n")
}
56 changes: 0 additions & 56 deletions deny.toml

This file was deleted.

11 changes: 8 additions & 3 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,13 @@ path = "src/tracing/server.rs"
required-features = ["tracing"]

[[bin]]
name = "uds-client"
path = "src/uds/client.rs"
name = "uds-client-standard"
path = "src/uds/client_standard.rs"
required-features = ["uds"]

[[bin]]
name = "uds-client-with-connector"
path = "src/uds/client_with_connector.rs"
required-features = ["uds"]

[[bin]]
Expand Down Expand Up @@ -285,7 +290,7 @@ async-stream = { version = "0.3", optional = true }
tokio-stream = { version = "0.1", optional = true }
tokio-util = { version = "0.7.8", optional = true }
tower = { version = "0.5", optional = true }
rand = { version = "0.8", optional = true }
rand = { version = "0.9", optional = true }
serde = { version = "1.0", features = ["derive"], optional = true }
serde_json = { version = "1.0", optional = true }
tracing = { version = "0.1.16", optional = true }
Expand Down
19 changes: 0 additions & 19 deletions examples/LICENSE

This file was deleted.

8 changes: 4 additions & 4 deletions examples/routeguide-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -693,8 +693,8 @@ use rand::Rng;

```rust
async fn run_record_route(client: &mut RouteGuideClient<Channel>) -> Result<(), Box<dyn Error>> {
let mut rng = rand::thread_rng();
let point_count: i32 = rng.gen_range(2..100);
let mut rng = rand::rng();
let point_count: i32 = rng.random_range(2..100);

let mut points = vec![];
for _ in 0..=point_count {
Expand All @@ -715,8 +715,8 @@ async fn run_record_route(client: &mut RouteGuideClient<Channel>) -> Result<(),

```rust
fn random_point(rng: &mut ThreadRng) -> Point {
let latitude = (rng.gen_range(0..180) - 90) * 10_000_000;
let longitude = (rng.gen_range(0..360) - 180) * 10_000_000;
let latitude = (rng.random_range(0..180) - 90) * 10_000_000;
let longitude = (rng.random_range(0..360) - 180) * 10_000_000;
Point {
latitude,
longitude,
Expand Down
2 changes: 1 addition & 1 deletion examples/src/authentication/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let response = client.unary_echo(request).await?;

println!("RESPONSE={:?}", response);
println!("RESPONSE={response:?}");

Ok(())
}
2 changes: 1 addition & 1 deletion examples/src/autoreload/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "[::1]:50051".parse().unwrap();
let greeter = MyGreeter::default();

println!("GreeterServer listening on {}", addr);
println!("GreeterServer listening on {addr}");

let server = Server::builder().add_service(GreeterServer::new(greeter));

Expand Down
2 changes: 1 addition & 1 deletion examples/src/blocking/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn main() -> Result<()> {

let response = client.say_hello(request)?;

println!("RESPONSE={:?}", response);
println!("RESPONSE={response:?}");

Ok(())
}
2 changes: 1 addition & 1 deletion examples/src/cancellation/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
};

println!("RESPONSE={:?}", response);
println!("RESPONSE={response:?}");

Ok(())
}
4 changes: 2 additions & 2 deletions examples/src/cancellation/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Greeter for MyGreeter {
Ok(Response::new(reply))
};
let cancellation_future = async move {
println!("Request from {:?} cancelled by client", remote_addr);
println!("Request from {remote_addr:?} cancelled by client");
// If this future is executed it means the request future was dropped,
// so it doesn't actually matter what is returned here
Err(Status::cancelled("Request cancelled by client"))
Expand Down Expand Up @@ -74,7 +74,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "[::1]:50051".parse().unwrap();
let greeter = MyGreeter::default();

println!("GreeterServer listening on {}", addr);
println!("GreeterServer listening on {addr}");

Server::builder()
.add_service(GreeterServer::new(greeter))
Expand Down
2 changes: 1 addition & 1 deletion examples/src/codec_buffers/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let response = client.say_hello(request).await?;

println!("RESPONSE={:?}", response);
println!("RESPONSE={response:?}");

Ok(())
}
2 changes: 1 addition & 1 deletion examples/src/codec_buffers/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "[::1]:50051".parse().unwrap();
let greeter = MyGreeter::default();

println!("GreeterServer listening on {}", addr);
println!("GreeterServer listening on {addr}");

Server::builder()
.add_service(GreeterServer::new(greeter))
Expand Down
2 changes: 1 addition & 1 deletion examples/src/compression/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
let addr = "[::1]:50051".parse().unwrap();
let greeter = MyGreeter::default();

println!("GreeterServer listening on {}", addr);
println!("GreeterServer listening on {addr}");

let service = GreeterServer::new(greeter)
.send_compressed(CompressionEncoding::Gzip)
Expand Down
2 changes: 1 addition & 1 deletion examples/src/dynamic/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let addr = "[::1]:50051".parse().unwrap();

println!("Grpc server listening on {}", addr);
println!("Grpc server listening on {addr}");

Server::builder()
.add_routes(routes_builder.routes())
Expand Down
14 changes: 7 additions & 7 deletions examples/src/dynamic_load_balance/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,36 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
println!("Added first endpoint");
let change = Change::Insert("1", e1);
let res = rx.send(change).await;
println!("{:?}", res);
println!("{res:?}");
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
println!("Added second endpoint");
let change = Change::Insert("2", e2);
let res = rx.send(change).await;
println!("{:?}", res);
println!("{res:?}");
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
println!("Removed first endpoint");
let change = Change::Remove("1");
let res = rx.send(change).await;
println!("{:?}", res);
println!("{res:?}");

tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
println!("Removed second endpoint");
let change = Change::Remove("2");
let res = rx.send(change).await;
println!("{:?}", res);
println!("{res:?}");

tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
println!("Added third endpoint");
let e3 = Endpoint::from_static("http://[::1]:50051");
let change = Change::Insert("3", e3);
let res = rx.send(change).await;
println!("{:?}", res);
println!("{res:?}");

tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
println!("Removed third endpoint");
let change = Change::Remove("3");
let res = rx.send(change).await;
println!("{:?}", res);
println!("{res:?}");
demo_done.swap(true, SeqCst);
});

Expand All @@ -68,7 +68,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {

let rx = client.unary_echo(request);
if let Ok(resp) = timeout(tokio::time::Duration::from_secs(10), rx).await {
println!("RESPONSE={:?}", resp);
println!("RESPONSE={resp:?}");
} else {
println!("did not receive value within 10 secs");
}
Expand Down
Loading
Loading