Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples/features/dualstack: Demonstrate Dual Stack functionality #8098

Merged
merged 4 commits into from
Feb 21, 2025

Conversation

arjan-bal
Copy link
Contributor

@arjan-bal arjan-bal commented Feb 17, 2025

This PR add an example to demonstrate the usage of endpoints. The example demonstrates how a channel chooses b/w IPv4 and IPv6 addresses while connecting to backends. This example closely follows the example in Java.

RELEASE NOTES:

  • examples/features/dualstack: New example demonstrating usage of endpoints and dual-stack functionality.

@arjan-bal arjan-bal added Type: Documentation Documentation or examples Area: Documentation Includes examples and docs. labels Feb 17, 2025
@arjan-bal arjan-bal added this to the 1.71 Release milestone Feb 17, 2025
@arjan-bal arjan-bal requested a review from easwars February 17, 2025 13:23
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.28%. Comparing base (ae2a04f) to head (b985581).
Report is 8 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8098      +/-   ##
==========================================
- Coverage   82.29%   82.28%   -0.01%     
==========================================
  Files         387      387              
  Lines       38967    38942      -25     
==========================================
- Hits        32066    32044      -22     
+ Misses       5586     5582       -4     
- Partials     1315     1316       +1     

see 24 files with indirect coverage changes

@easwars
Copy link
Contributor

easwars commented Feb 18, 2025

Wanted to check with you if the example has to be consistent across languages (before starting to review this)?

@easwars easwars assigned arjan-bal and unassigned easwars Feb 18, 2025
@arjan-bal arjan-bal changed the title examples/features/customloadbalancer: Demonstrate Dual Stack functionality examples/features/dualstack: Demonstrate Dual Stack functionality Feb 20, 2025
@arjan-bal
Copy link
Contributor Author

Wanted to check with you if the example has to be consistent across languages (before starting to review this)?

Changed the PR. Added a new example that closely follows Java's example instead of changing the custombalancer example. Other languages don't have dualstack examples becaue their resolver API is not public.

@arjan-bal arjan-bal assigned easwars and unassigned arjan-bal Feb 20, 2025
Copy link
Contributor

@easwars easwars left a comment

Choose a reason for hiding this comment

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

LGTM modulo minor nits


The dualstack example uses a custom name resolver that provides both IPv4 and
IPv6 localhost endpoints for each of 3 server instances. The client will first
use the default name resolver and load balancers which will only connect tot he
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: s/tot he/ to the/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

1. `127.0.0.1:50050`: Listening only on the IPv4 loopback address.
1. `[::1]:50051`: Listening only on the IPv6 loopback address.

The server response will include the include their serving port and address type
Copy link
Contributor

Choose a reason for hiding this comment

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

Delete the spurious include here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

// Since the IPv6 address comes first in the resolver list, it will be
// given higher priority.
fmt.Sprintf("[::1]:%d", port1),
// Server 1 is listening only on the IPv4 loopback address.
Copy link
Contributor

Choose a reason for hiding this comment

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

Server 2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed the comment.

@easwars easwars assigned arjan-bal and unassigned easwars Feb 20, 2025
@arjan-bal arjan-bal merged commit 65c6718 into grpc:master Feb 21, 2025
15 checks passed
arjan-bal added a commit to arjan-bal/grpc-go that referenced this pull request Feb 21, 2025
@arjan-bal arjan-bal deleted the dualstack-example branch February 21, 2025 06:49
purnesh42H pushed a commit to purnesh42H/grpc-go that referenced this pull request Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Documentation Includes examples and docs. Type: Documentation Documentation or examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants