Skip to content
This repository was archived by the owner on Sep 26, 2023. It is now read-only.

Update InstantiatingGrpcChannelProvider to be tolerant of ipv6 addresses#768

Merged
BenWhitehead merged 4 commits intogoogleapis:masterfrom
BenWhitehead:ipv6-fix
Aug 20, 2019
Merged

Update InstantiatingGrpcChannelProvider to be tolerant of ipv6 addresses#768
BenWhitehead merged 4 commits intogoogleapis:masterfrom
BenWhitehead:ipv6-fix

Conversation

@BenWhitehead
Copy link
Copy Markdown
Contributor

No description provided.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Aug 1, 2019
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 1, 2019

Codecov Report

Merging #768 into master will increase coverage by 0.23%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #768      +/-   ##
============================================
+ Coverage     78.15%   78.38%   +0.23%     
- Complexity     1101     1106       +5     
============================================
  Files           198      198              
  Lines          4833     4886      +53     
  Branches        383      385       +2     
============================================
+ Hits           3777     3830      +53     
- Misses          886      887       +1     
+ Partials        170      169       -1
Impacted Files Coverage Δ Complexity Δ
...api/gax/grpc/InstantiatingGrpcChannelProvider.java 78.23% <100%> (ø) 36 <2> (ø) ⬇️
...va/com/google/api/gax/batching/v2/BatcherImpl.java
...m/google/api/gax/batching/v2/BatchingSettings.java
.../google/api/gax/batching/BatchingCallSettings.java 96.15% <0%> (ø) 5% <0%> (?)
.../java/com/google/api/gax/batching/BatcherImpl.java 97.9% <0%> (ø) 15% <0%> (?)
.../com/google/api/gax/batching/BatchingSettings.java 85.71% <0%> (+4.76%) 2% <0%> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fd5740a...67339e9. Read the comment docs.

Copy link
Copy Markdown
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to set the endpoint to an ipv6 ip address without a port?

@chingor13 chingor13 requested review from vam-google and removed request for garrettjonesgoogle August 1, 2019 16:59
new GrpcMetadataHandlerInterceptor();

int colon = endpoint.indexOf(':');
int colon = endpoint.lastIndexOf(':');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like in case if there is no port at all, this code will try to treat the last segment of ipv6 as port number. For example in
2001:db8:85a3:8d3:1319:8a2e:370:7348
7348 becomes a port number.

I understand that it is unlikely case, but please consider handling it (i.e. add proper logic for both ipv4 and ipv6 cases, also colon is porbably a bad name here ans it should clearly indicate that we are searching for a port here).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The usage of port below (1 and 2) explicitly necessitates a port being provided as part of endpoint since there is no form of default port handling due to not having scheme be part of endpoint. All tests defined in the corresponding test class always specify hostname:port.

I think if we wanted to update this class to support connections without port specified it'd be a lot more work than this.

@BenWhitehead
Copy link
Copy Markdown
Contributor Author

It is currently not possible to pass in an endpoint without a port defined.

In fact, there is an existing test testEndpointNoPort that expects an IllegalArgumentException in the case no port is specified.

@BenWhitehead
Copy link
Copy Markdown
Contributor Author

@chingor13 Can you review this again?

Copy link
Copy Markdown
Contributor

@chingor13 chingor13 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we add documentation that the endpoint must follow [host]:[port]? We can add similar documentation to the google-cloud-core options that expose endpoint override.

We should also still investigate ManagedChannelBuilder.forTarget(String) but that can be done separately.

@BenWhitehead
Copy link
Copy Markdown
Contributor Author

@chingor13 I've added the requested javadocs. If everything looks good, I'll rebase-squash this and we can merge it afterward.

@BenWhitehead BenWhitehead merged commit aa01bfc into googleapis:master Aug 20, 2019
@BenWhitehead BenWhitehead deleted the ipv6-fix branch August 20, 2019 02:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants