Skip to content

Commit 2a6f0ab

Browse files
LucioFrancoamrhassantottotomaximevtushcrepererum
authored
Merge master -> next (#2267)
* Add From<T> for Response<T> (#1064) Co-authored-by: tottoto <[email protected]> * chore: Add getrandom and wasi crate to cargo-deny skip config (#2169) * chore(examples): Update to rand 0.9 (#2168) * chore(interop): Replace repeat and take with repeat_n (#2170) * Update LICENSE (#2167) * chore(transport): Update url to http crate document (#2173) * chore: Refactor redundant pattern match (#2174) * chore(transport): Remove redundant type reconstruct (#2176) * chore: Update to strum 0.27 (#2180) * feat: optional `SSLKEYLOGFILE` support (#1539) Add a `use_key_log` option to server and client TLS configs that -- when set -- will enable rustls's `SSLKEYLOGFILE` handling. This is helpful when you want to intercept TLS traffic for debugging and is generally supported by many libraries and browsers. Also see: https://wiki.wireshark.org/TLS#using-the-pre-master-secret * chore: Remove html_root_url (#2184) * chore: Remove unused mutability (#2183) * chore: Update generated code (#2222) * chore: Update cargo-deny config (#2210) * chore: Add rustix and linux-raw-sys crate to cargo-deny skip config * chore: Ignore RUSTSEC-2024-0436 * Remove unnecessary mut (#2219) * remove unnecessary mut * remove unnecessary mut for health_reporter --------- Co-authored-by: tottoto <[email protected]> * chore: fix some comments (#2224) Signed-off-by: jimmycathy <[email protected]> Co-authored-by: tottoto <[email protected]> * feat: Allow convert i32 to Code in const context (#2195) * chore: Disable unused tower feature (#2196) * chore(router): Remove unnecessary body type converting (#2214) * chore(server): Use standard library pin macro (#2212) * chore(build): Use idiomatic api (#2211) * feat(tonic): Exclude benches-disabled to remove Apache-2.0 resource (#2204) * chore(ci): Add concurrency group to cancel old ci (#2202) * chore(test): Use library crate in test (#2201) * chore: Remove unused rand crate from dev-dependencies (#2198) * chore: Remove documentation config in manifest (#2193) * chore(test): Remove unnecessary macro_use (#2200) * feat: Add proto header to generated code (#2205) * chore(router): Use upstream poll_ready to implement service (#2215) * feat(router): Use infallible as error type (#2232) * chore: Remove unnecessary license file from private crate (#2203) * chore: update changelog to point to releases (#2235) * chore: fix changelog header * chore(server): Remove import sleep and pending function (#2234) * chore(server): Refactor default http2 keepalive timeout config (#2213) * chore: Remove unnecessary docs.rs config (#2223) * feat(transport): add support for uds, unix domain socket (#2218) * feat(transport): add support for uds, unix domain socket (#2218) Previously the uds support lives as an example in the `example/src/uds` folder. Endpoint is refactored to support multiple endpoint types, including Uri and Uds. The supported unix domain socket URI follows RFC-3986 which is aligned with the gRPC naming convention. - unix:relative_path - unix:///absolute_path References: - https://datatracker.ietf.org/doc/html/rfc3986 - https://github.com/grpc/grpc/blob/master/doc/naming.md * fix feature flag error * fix windows build * fix windows build 2 * fix windows build 3 * fix windows build 4 * fix windows build 5 --------- Co-authored-by: Lucio Franco <[email protected]> * Handle stream error correctly (#2199) Co-authored-by: Lucio Franco <[email protected]> * chore: Remove resolved cargo-deny config (#2230) * Create place for grpc crate and initial contents (#2192) * Create place for grpc crate and initial contents * Cargo.toml fixes * clippy * clippy 2 * 3 * grpc-web: relax bounds for inner service's response body (#2245) * grpc-web: relax bounds for inner service's response body * address feedback * chore(test): Allow clippy::doc_overindented_list_items lint in generated code (#2246) * chore(test): Update to rand 0.9 (#2236) * chore(router): Remove unnecessary type converting (#2237) * chore(ci): Update to nightly-2025-03-27 on udeps ci (#2242) * chore(codegen): Update to protox 0.8 (#2254) * chore(ci): Remove deny job (#2255) Removing the deny ci job it has become more of a pain to manage than actually helpful. * feat: preserve request user-agent (#2250) Co-authored-by: Lucio Franco <[email protected]> * feat(server): Add method to get local addr to TcpIncoming (#2233) * feat: expose Status as a Response extension (#2145) Co-authored-by: Lucio Franco <[email protected]> * chore(server): Remove unnecessary await service ready (#2258) * chore: Use symbolic link for license file (#2241) * chore: Use inline format argument (#2260) * chore: Add `flake.nix` (#2261) * chore: Fix interop test certs (#2262) * chore: Fix interop test certs * fix bash script: * fix: tls config overwrite in endpoint (#2252) * fix: tls config overwrite in endpoint PR #1866 fixed the breaking change introduced in #1731, but resets the TLS config without checking if `tls` is set. This patch resolves the regression and restores expected behaviour. * fix: cargo fmt whitespace check --------- Co-authored-by: vigneshwar.sm <[email protected]> Co-authored-by: Lucio Franco <[email protected]> * chore(tonic-bench): Fix failing bench (#2207) Co-authored-by: Lucio Franco <[email protected]> * feat: expose creation of HealthService and HealthReporter (#2251) * Expose creation of HealthService and HealthReporter * add default impl for HealthReporter * [spr] initial version (#2264) Created using spr 1.3.6-beta.1 * Revert "[spr] initial version (#2264)" (#2265) * chore: Prepare `v0.13.1` release Reviewers: Pull Request: #2266 --------- Signed-off-by: jimmycathy <[email protected]> Co-authored-by: Amr Hassan <[email protected]> Co-authored-by: tottoto <[email protected]> Co-authored-by: Maxim Evtush <[email protected]> Co-authored-by: Marco Neumann <[email protected]> Co-authored-by: DAKAI, TZOU <[email protected]> Co-authored-by: jimmycathy <[email protected]> Co-authored-by: Adam Basfop Cavendish <[email protected]> Co-authored-by: Jakub Łabor <[email protected]> Co-authored-by: Doug Fawley <[email protected]> Co-authored-by: Brandon Williams <[email protected]> Co-authored-by: Darren Bolduc <[email protected]> Co-authored-by: Ferenc Tamás <[email protected]> Co-authored-by: Vigneshwar S <[email protected]> Co-authored-by: vigneshwar.sm <[email protected]> Co-authored-by: Rafael RL <[email protected]> Co-authored-by: Leon Hartley <[email protected]>
1 parent 86815d8 commit 2a6f0ab

File tree

173 files changed

+2958
-7164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+2958
-7164
lines changed

.github/workflows/CI.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ on:
77
merge_group:
88
branches: [ "master" ]
99

10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
1014
env:
1115
RUSTFLAGS: "-D warnings"
1216

@@ -21,14 +25,6 @@ jobs:
2125
components: rustfmt
2226
- run: cargo fmt --all --check
2327

24-
deny:
25-
runs-on: ubuntu-latest
26-
steps:
27-
- uses: actions/checkout@v4
28-
- uses: hecrj/setup-rust-action@v2
29-
- uses: taiki-e/install-action@cargo-deny
30-
- run: cargo deny check
31-
3228
clippy:
3329
runs-on: ubuntu-latest
3430
steps:
@@ -55,7 +51,7 @@ jobs:
5551
- uses: actions/checkout@v4
5652
- uses: dtolnay/rust-toolchain@master
5753
with:
58-
toolchain: nightly-2024-12-01
54+
toolchain: nightly-2025-03-27
5955
- uses: taiki-e/install-action@cargo-hack
6056
- uses: taiki-e/install-action@cargo-udeps
6157
- uses: taiki-e/install-action@protoc
@@ -97,7 +93,7 @@ jobs:
9793
CARGO_RESOLVER_INCOMPATIBLE_RUST_VERSIONS: fallback
9894
- name: Get MSRV from manifest file
9995
id: msrv
100-
run: echo "version=$(yq '.workspace.package.rust-version' Cargo.toml)" >> $GITHUB_OUTPUT
96+
run: echo "version=$(yq '.workspace.package.rust-version' Cargo.toml)" >> "$GITHUB_OUTPUT"
10197
- uses: hecrj/setup-rust-action@v2
10298
with:
10399
rust-version: ${{ steps.msrv.outputs.version }}

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# 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).
2+
13
# [0.12.3](https://github.com/hyperium/tonic/compare/v0.12.2...v0.12.3) (2024-08-29)
24

35
### Features

Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ members = [
88
"tonic-web", # Non-published crates
99
"examples",
1010
"codegen",
11+
"grpc",
1112
"interop", # Tests
1213
"tests/disable_comments",
1314
"tests/included_service",
@@ -40,5 +41,8 @@ missing_docs = "warn"
4041
rust_2018_idioms = "warn"
4142
unreachable_pub = "warn"
4243

44+
[workspace.lints.clippy]
45+
uninlined_format_args = "deny"
46+
4347
[workspace.lints.rustdoc]
4448
broken_intra_doc_links = "deny"

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2020 Lucio Franco
1+
Copyright (c) 2025 Lucio Franco
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

codegen/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ license = "MIT"
55
edition = "2021"
66

77
[dependencies]
8-
protox = "0.7"
8+
protox = "0.8"
99
prettyplease = "0.2"
1010
quote = "1"
1111
syn = "2"

codegen/src/main.rs

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,22 @@ fn codegen(
113113
fn write_fds(fds: &FileDescriptorSet, path: &Path) {
114114
const GENERATED_COMMENT: &str = "// This file is @generated by codegen.";
115115

116+
let mut file_header = String::new();
117+
116118
let mut fds = fds.clone();
119+
120+
for fd in fds.file.iter() {
121+
let Some(source_code_info) = &fd.source_code_info else {
122+
continue;
123+
};
124+
125+
for location in &source_code_info.location {
126+
for comment in &location.leading_detached_comments {
127+
file_header += comment;
128+
}
129+
}
130+
}
131+
117132
for fd in fds.file.iter_mut() {
118133
fd.source_code_info = None;
119134
}
@@ -126,8 +141,23 @@ fn write_fds(fds: &FileDescriptorSet, path: &Path) {
126141
let ast = syn::parse2(tokens).unwrap();
127142
let formatted = prettyplease::unparse(&ast);
128143

129-
let content = format!("{GENERATED_COMMENT}\n{formatted}");
130-
131144
let mut writer = BufWriter::new(File::create(path).unwrap());
132-
writer.write_all(content.as_bytes()).unwrap();
145+
146+
writer.write_all(GENERATED_COMMENT.as_bytes()).unwrap();
147+
writer.write_all(b"\n").unwrap();
148+
149+
if !file_header.is_empty() {
150+
let file_header = comment_out(&file_header);
151+
writer.write_all(file_header.as_bytes()).unwrap();
152+
writer.write_all(b"\n").unwrap();
153+
}
154+
155+
writer.write_all(formatted.as_bytes()).unwrap()
156+
}
157+
158+
fn comment_out(s: &str) -> String {
159+
s.split('\n')
160+
.map(|line| format!("// {line}"))
161+
.collect::<Vec<String>>()
162+
.join("\n")
133163
}

deny.toml

Lines changed: 0 additions & 56 deletions
This file was deleted.

examples/Cargo.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,13 @@ path = "src/tracing/server.rs"
118118
required-features = ["tracing"]
119119

120120
[[bin]]
121-
name = "uds-client"
122-
path = "src/uds/client.rs"
121+
name = "uds-client-standard"
122+
path = "src/uds/client_standard.rs"
123+
required-features = ["uds"]
124+
125+
[[bin]]
126+
name = "uds-client-with-connector"
127+
path = "src/uds/client_with_connector.rs"
123128
required-features = ["uds"]
124129

125130
[[bin]]
@@ -285,7 +290,7 @@ async-stream = { version = "0.3", optional = true }
285290
tokio-stream = { version = "0.1", optional = true }
286291
tokio-util = { version = "0.7.8", optional = true }
287292
tower = { version = "0.5", optional = true }
288-
rand = { version = "0.8", optional = true }
293+
rand = { version = "0.9", optional = true }
289294
serde = { version = "1.0", features = ["derive"], optional = true }
290295
serde_json = { version = "1.0", optional = true }
291296
tracing = { version = "0.1.16", optional = true }

examples/LICENSE

Lines changed: 0 additions & 19 deletions
This file was deleted.

examples/routeguide-tutorial.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -693,8 +693,8 @@ use rand::Rng;
693693

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

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

716716
```rust
717717
fn random_point(rng: &mut ThreadRng) -> Point {
718-
let latitude = (rng.gen_range(0..180) - 90) * 10_000_000;
719-
let longitude = (rng.gen_range(0..360) - 180) * 10_000_000;
718+
let latitude = (rng.random_range(0..180) - 90) * 10_000_000;
719+
let longitude = (rng.random_range(0..360) - 180) * 10_000_000;
720720
Point {
721721
latitude,
722722
longitude,

examples/src/authentication/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2222

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

25-
println!("RESPONSE={:?}", response);
25+
println!("RESPONSE={response:?}");
2626

2727
Ok(())
2828
}

examples/src/autoreload/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3030
let addr = "[::1]:50051".parse().unwrap();
3131
let greeter = MyGreeter::default();
3232

33-
println!("GreeterServer listening on {}", addr);
33+
println!("GreeterServer listening on {addr}");
3434

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

examples/src/blocking/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn main() -> Result<()> {
4747

4848
let response = client.say_hello(request)?;
4949

50-
println!("RESPONSE={:?}", response);
50+
println!("RESPONSE={response:?}");
5151

5252
Ok(())
5353
}

examples/src/cancellation/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2424
}
2525
};
2626

27-
println!("RESPONSE={:?}", response);
27+
println!("RESPONSE={response:?}");
2828

2929
Ok(())
3030
}

examples/src/cancellation/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ impl Greeter for MyGreeter {
3737
Ok(Response::new(reply))
3838
};
3939
let cancellation_future = async move {
40-
println!("Request from {:?} cancelled by client", remote_addr);
40+
println!("Request from {remote_addr:?} cancelled by client");
4141
// If this future is executed it means the request future was dropped,
4242
// so it doesn't actually matter what is returned here
4343
Err(Status::cancelled("Request cancelled by client"))
@@ -74,7 +74,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
7474
let addr = "[::1]:50051".parse().unwrap();
7575
let greeter = MyGreeter::default();
7676

77-
println!("GreeterServer listening on {}", addr);
77+
println!("GreeterServer listening on {addr}");
7878

7979
Server::builder()
8080
.add_service(GreeterServer::new(greeter))

examples/src/codec_buffers/client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2424

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

27-
println!("RESPONSE={:?}", response);
27+
println!("RESPONSE={response:?}");
2828

2929
Ok(())
3030
}

examples/src/codec_buffers/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
4040
let addr = "[::1]:50051".parse().unwrap();
4141
let greeter = MyGreeter::default();
4242

43-
println!("GreeterServer listening on {}", addr);
43+
println!("GreeterServer listening on {addr}");
4444

4545
Server::builder()
4646
.add_service(GreeterServer::new(greeter))

examples/src/compression/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
3131
let addr = "[::1]:50051".parse().unwrap();
3232
let greeter = MyGreeter::default();
3333

34-
println!("GreeterServer listening on {}", addr);
34+
println!("GreeterServer listening on {addr}");
3535

3636
let service = GreeterServer::new(greeter)
3737
.send_compressed(CompressionEncoding::Gzip)

examples/src/dynamic/server.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
7777

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

80-
println!("Grpc server listening on {}", addr);
80+
println!("Grpc server listening on {addr}");
8181

8282
Server::builder()
8383
.add_routes(routes_builder.routes())

examples/src/dynamic_load_balance/client.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,36 +27,36 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
2727
println!("Added first endpoint");
2828
let change = Change::Insert("1", e1);
2929
let res = rx.send(change).await;
30-
println!("{:?}", res);
30+
println!("{res:?}");
3131
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
3232
println!("Added second endpoint");
3333
let change = Change::Insert("2", e2);
3434
let res = rx.send(change).await;
35-
println!("{:?}", res);
35+
println!("{res:?}");
3636
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
3737
println!("Removed first endpoint");
3838
let change = Change::Remove("1");
3939
let res = rx.send(change).await;
40-
println!("{:?}", res);
40+
println!("{res:?}");
4141

4242
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
4343
println!("Removed second endpoint");
4444
let change = Change::Remove("2");
4545
let res = rx.send(change).await;
46-
println!("{:?}", res);
46+
println!("{res:?}");
4747

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

5555
tokio::time::sleep(tokio::time::Duration::from_secs(5)).await;
5656
println!("Removed third endpoint");
5757
let change = Change::Remove("3");
5858
let res = rx.send(change).await;
59-
println!("{:?}", res);
59+
println!("{res:?}");
6060
demo_done.swap(true, SeqCst);
6161
});
6262

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

6969
let rx = client.unary_echo(request);
7070
if let Ok(resp) = timeout(tokio::time::Duration::from_secs(10), rx).await {
71-
println!("RESPONSE={:?}", resp);
71+
println!("RESPONSE={resp:?}");
7272
} else {
7373
println!("did not receive value within 10 secs");
7474
}

0 commit comments

Comments
 (0)