Skip to content

Commit f3dc2cf

Browse files
authored
Merge branch 'grpc:master' into master
2 parents 9900277 + f385add commit f3dc2cf

194 files changed

Lines changed: 5848 additions & 1122 deletions

File tree

Some content is hidden

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

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ MODULE.bazel.lock
3131
.gitignore
3232
bin
3333

34+
# VsCode
35+
.vscode
36+
3437
# OS X
3538
.DS_Store
3639

MODULE.bazel

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ module(
22
name = "grpc-java",
33
compatibility_level = 0,
44
repo_name = "io_grpc_grpc_java",
5-
version = "1.77.0-SNAPSHOT", # CURRENT_GRPC_VERSION
5+
version = "1.78.0-SNAPSHOT", # CURRENT_GRPC_VERSION
66
)
77

88
# GRPC_DEPS_START
@@ -14,7 +14,7 @@ IO_GRPC_GRPC_JAVA_ARTIFACTS = [
1414
"com.google.auto.value:auto-value-annotations:1.11.0",
1515
"com.google.auto.value:auto-value:1.11.0",
1616
"com.google.code.findbugs:jsr305:3.0.2",
17-
"com.google.code.gson:gson:2.11.0",
17+
"com.google.code.gson:gson:2.12.1",
1818
"com.google.errorprone:error_prone_annotations:2.36.0",
1919
"com.google.guava:failureaccess:1.0.1",
2020
"com.google.guava:guava:33.4.8-android",

README.md

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ For a guided tour, take a look at the [quick start
4444
guide](https://grpc.io/docs/languages/java/quickstart) or the more explanatory [gRPC
4545
basics](https://grpc.io/docs/languages/java/basics).
4646

47-
The [examples](https://github.com/grpc/grpc-java/tree/v1.76.0/examples) and the
48-
[Android example](https://github.com/grpc/grpc-java/tree/v1.76.0/examples/android)
47+
The [examples](https://github.com/grpc/grpc-java/tree/v1.77.0/examples) and the
48+
[Android example](https://github.com/grpc/grpc-java/tree/v1.77.0/examples/android)
4949
are standalone projects that showcase the usage of gRPC.
5050

5151
Download
@@ -56,42 +56,42 @@ Download [the JARs][]. Or for Maven with non-Android, add to your `pom.xml`:
5656
<dependency>
5757
<groupId>io.grpc</groupId>
5858
<artifactId>grpc-netty-shaded</artifactId>
59-
<version>1.76.0</version>
59+
<version>1.77.0</version>
6060
<scope>runtime</scope>
6161
</dependency>
6262
<dependency>
6363
<groupId>io.grpc</groupId>
6464
<artifactId>grpc-protobuf</artifactId>
65-
<version>1.76.0</version>
65+
<version>1.77.0</version>
6666
</dependency>
6767
<dependency>
6868
<groupId>io.grpc</groupId>
6969
<artifactId>grpc-stub</artifactId>
70-
<version>1.76.0</version>
70+
<version>1.77.0</version>
7171
</dependency>
7272
```
7373

7474
Or for Gradle with non-Android, add to your dependencies:
7575
```gradle
76-
runtimeOnly 'io.grpc:grpc-netty-shaded:1.76.0'
77-
implementation 'io.grpc:grpc-protobuf:1.76.0'
78-
implementation 'io.grpc:grpc-stub:1.76.0'
76+
runtimeOnly 'io.grpc:grpc-netty-shaded:1.77.0'
77+
implementation 'io.grpc:grpc-protobuf:1.77.0'
78+
implementation 'io.grpc:grpc-stub:1.77.0'
7979
```
8080

8181
For Android client, use `grpc-okhttp` instead of `grpc-netty-shaded` and
8282
`grpc-protobuf-lite` instead of `grpc-protobuf`:
8383
```gradle
84-
implementation 'io.grpc:grpc-okhttp:1.76.0'
85-
implementation 'io.grpc:grpc-protobuf-lite:1.76.0'
86-
implementation 'io.grpc:grpc-stub:1.76.0'
84+
implementation 'io.grpc:grpc-okhttp:1.77.0'
85+
implementation 'io.grpc:grpc-protobuf-lite:1.77.0'
86+
implementation 'io.grpc:grpc-stub:1.77.0'
8787
```
8888

8989
For [Bazel](https://bazel.build), you can either
9090
[use Maven](https://github.com/bazelbuild/rules_jvm_external)
9191
(with the GAVs from above), or use `@io_grpc_grpc_java//api` et al (see below).
9292

9393
[the JARs]:
94-
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.76.0
94+
https://search.maven.org/search?q=g:io.grpc%20AND%20v:1.77.0
9595

9696
Development snapshots are available in [Sonatypes's snapshot
9797
repository](https://central.sonatype.com/repository/maven-snapshots/).
@@ -123,7 +123,7 @@ For protobuf-based codegen integrated with the Maven build system, you can use
123123
<configuration>
124124
<protocArtifact>com.google.protobuf:protoc:3.25.8:exe:${os.detected.classifier}</protocArtifact>
125125
<pluginId>grpc-java</pluginId>
126-
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.76.0:exe:${os.detected.classifier}</pluginArtifact>
126+
<pluginArtifact>io.grpc:protoc-gen-grpc-java:1.77.0:exe:${os.detected.classifier}</pluginArtifact>
127127
</configuration>
128128
<executions>
129129
<execution>
@@ -153,7 +153,7 @@ protobuf {
153153
}
154154
plugins {
155155
grpc {
156-
artifact = 'io.grpc:protoc-gen-grpc-java:1.76.0'
156+
artifact = 'io.grpc:protoc-gen-grpc-java:1.77.0'
157157
}
158158
}
159159
generateProtoTasks {
@@ -186,7 +186,7 @@ protobuf {
186186
}
187187
plugins {
188188
grpc {
189-
artifact = 'io.grpc:protoc-gen-grpc-java:1.76.0'
189+
artifact = 'io.grpc:protoc-gen-grpc-java:1.77.0'
190190
}
191191
}
192192
generateProtoTasks {

alts/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ java_library(
1313
":handshaker_java_proto",
1414
"//api",
1515
"//core:internal",
16-
"//grpclb",
1716
"//netty",
1817
"//stub",
1918
"@com_google_protobuf//:protobuf_java",

alts/build.gradle

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,10 @@ dependencies {
1414
implementation project(':grpc-auth'),
1515
project(':grpc-core'),
1616
project(":grpc-context"), // Override google-auth dependency with our newer version
17-
project(':grpc-grpclb'),
1817
project(':grpc-protobuf'),
1918
project(':grpc-stub'),
2019
libraries.protobuf.java,
2120
libraries.conscrypt,
22-
libraries.guava.jre, // JRE required by protobuf-java-util from grpclb
2321
libraries.google.auth.oauth2Http
2422
def nettyDependency = implementation project(':grpc-netty')
2523

alts/src/main/java/io/grpc/alts/HandshakerServiceChannel.java

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,29 @@
3737
* application will have at most one connection to the handshaker service.
3838
*/
3939
final class HandshakerServiceChannel {
40+
// Port 8080 is necessary for ALTS handshake.
41+
private static final int ALTS_PORT = 8080;
42+
private static final String DEFAULT_TARGET = "metadata.google.internal.:8080";
4043

4144
static final Resource<Channel> SHARED_HANDSHAKER_CHANNEL =
42-
new ChannelResource("metadata.google.internal.:8080");
43-
45+
new ChannelResource(getHandshakerTarget(System.getenv("GCE_METADATA_HOST")));
46+
47+
/**
48+
* Returns handshaker target. When GCE_METADATA_HOST is provided, it might contain port which we
49+
* will discard and use ALTS_PORT instead.
50+
*/
51+
static String getHandshakerTarget(String envValue) {
52+
if (envValue == null || envValue.isEmpty()) {
53+
return DEFAULT_TARGET;
54+
}
55+
String host = envValue;
56+
int portIndex = host.lastIndexOf(':');
57+
if (portIndex != -1) {
58+
host = host.substring(0, portIndex); // Discard port if specified
59+
}
60+
return host + ":" + ALTS_PORT; // Utilize ALTS port in all cases
61+
}
62+
4463
/** Returns a resource of handshaker service channel for testing only. */
4564
static Resource<Channel> getHandshakerChannelForTesting(String handshakerAddress) {
4665
return new ChannelResource(handshakerAddress);

alts/src/main/java/io/grpc/alts/internal/AltsProtocolNegotiator.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
import io.grpc.SecurityLevel;
3131
import io.grpc.Status;
3232
import io.grpc.alts.internal.RpcProtocolVersionsUtil.RpcVersionsCheckResult;
33-
import io.grpc.grpclb.GrpclbConstants;
3433
import io.grpc.internal.ObjectPool;
3534
import io.grpc.netty.GrpcHttp2ConnectionHandler;
3635
import io.grpc.netty.InternalProtocolNegotiator;
@@ -299,9 +298,7 @@ public ChannelHandler newHandler(GrpcHttp2ConnectionHandler grpcHandler) {
299298
isXdsDirectPath = isDirectPathCluster(
300299
grpcHandler.getEagAttributes().get(clusterNameAttrKey));
301300
}
302-
if (grpcHandler.getEagAttributes().get(GrpclbConstants.ATTR_LB_ADDR_AUTHORITY) != null
303-
|| grpcHandler.getEagAttributes().get(GrpclbConstants.ATTR_LB_PROVIDED_BACKEND) != null
304-
|| isXdsDirectPath) {
301+
if (isXdsDirectPath) {
305302
TsiHandshaker handshaker =
306303
handshakerFactory.newHandshaker(grpcHandler.getAuthority(), negotiationLogger);
307304
NettyTsiHandshaker nettyHandshaker = new NettyTsiHandshaker(handshaker);

alts/src/main/java/io/grpc/alts/internal/AltsTsiHandshaker.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public boolean processBytesFromPeer(ByteBuffer bytes) throws GeneralSecurityExce
8080
return true;
8181
}
8282
int remaining = bytes.remaining();
83-
// Call handshaker service to proceess the bytes.
83+
// Call handshaker service to process the bytes.
8484
if (outputFrame == null) {
8585
checkState(!isClient, "Client handshaker should not process any frame at the beginning.");
8686
outputFrame = handshaker.startServerHandshake(bytes);

alts/src/test/java/io/grpc/alts/HandshakerServiceChannelTest.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,24 @@ public void sharedChannel_authority() {
6767
}
6868
}
6969

70+
@Test
71+
public void getHandshakerTarget_nullEnvVar() {
72+
assertThat(HandshakerServiceChannel.getHandshakerTarget(null))
73+
.isEqualTo("metadata.google.internal.:8080");
74+
}
75+
76+
@Test
77+
public void getHandshakerTarget_envVarWithPort() {
78+
assertThat(HandshakerServiceChannel.getHandshakerTarget("169.254.169.254:80"))
79+
.isEqualTo("169.254.169.254:8080");
80+
}
81+
82+
@Test
83+
public void getHandshakerTarget_envVarWithHostOnly() {
84+
assertThat(HandshakerServiceChannel.getHandshakerTarget("169.254.169.254"))
85+
.isEqualTo("169.254.169.254:8080");
86+
}
87+
7088
@Test
7189
public void resource_works() {
7290
Channel channel = resource.create();

alts/src/test/java/io/grpc/alts/internal/GoogleDefaultProtocolNegotiatorTest.java

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import io.grpc.ChannelLogger;
3030
import io.grpc.ChannelLogger.ChannelLogLevel;
3131
import io.grpc.ManagedChannel;
32-
import io.grpc.grpclb.GrpclbConstants;
3332
import io.grpc.inprocess.InProcessChannelBuilder;
3433
import io.grpc.internal.ObjectPool;
3534
import io.grpc.netty.GrpcHttp2ConnectionHandler;
@@ -95,13 +94,6 @@ public void tearDown() {
9594
@Nullable
9695
abstract Attributes.Key<String> getClusterNameAttrKey();
9796

98-
@Test
99-
public void altsHandler_lbProvidedBackend() {
100-
Attributes attrs =
101-
Attributes.newBuilder().set(GrpclbConstants.ATTR_LB_PROVIDED_BACKEND, true).build();
102-
subtest_altsHandler(attrs);
103-
}
104-
10597
@Test
10698
public void tlsHandler_emptyAttributes() {
10799
subtest_tlsHandler(Attributes.EMPTY);

0 commit comments

Comments
 (0)