-
Notifications
You must be signed in to change notification settings - Fork 5.5k
upstream: Implement Happy Eyeballs address sorting #18906
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
Merged
RyanTheOptimist
merged 10 commits into
envoyproxy:main
from
RyanTheOptimist:sortAddresses
Nov 16, 2021
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
7c4538c
upstream: Implement Happy Eyeballs address sorting
RyanTheOptimist e03104a
no logging
RyanTheOptimist ef769a6
WIP
RyanTheOptimist 3f3a4ac
Cleanup
RyanTheOptimist 0a3f5da
Format
RyanTheOptimist eb86577
Update source/common/network/happy_eyeballs_connection_impl.h
RyanTheOptimist 0561593
Rewrite sortAddresses to be O(N)
RyanTheOptimist 9c84f2b
format
RyanTheOptimist 8fd62a2
Merge branch 'main' into sortAddresses
RyanTheOptimist 545928d
typo
RyanTheOptimist File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -98,6 +98,14 @@ class HappyEyeballsConnectionImpl : public ClientConnection, | |
| void hashKey(std::vector<uint8_t>& hash_key) const override; | ||
| void dumpState(std::ostream& os, int indent_level) const override; | ||
|
|
||
| // Returns a new vector containing the contents of |address_list| sorted | ||
| // with address families interleaved, as per Section 4 of RFC 8305, Happy | ||
| // Eyeballs v2. It is assumed that the list must already sorted as per | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "list must already BE sorted...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. PTAL? |
||
| // Section 6 of RFC6724, which happens in the DNS implementations (ares_getaddrinfo() | ||
| // and Apple DNS). | ||
| static std::vector<Address::InstanceConstSharedPtr> | ||
| sortAddresses(const std::vector<Address::InstanceConstSharedPtr>& address_list); | ||
|
|
||
| private: | ||
| // ConnectionCallbacks which will be set on an ClientConnection which | ||
| // sends connection events back to the HappyEyeballsConnectionImpl. | ||
|
|
@@ -196,7 +204,7 @@ class HappyEyeballsConnectionImpl : public ClientConnection, | |
| Event::Dispatcher& dispatcher_; | ||
|
|
||
| // List of addresses to attempt to connect to. | ||
| const std::vector<Address::InstanceConstSharedPtr>& address_list_; | ||
| const std::vector<Address::InstanceConstSharedPtr> address_list_; | ||
| // Index of the next address to use. | ||
| size_t next_address_ = 0; | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
food for thought: do we care about making this behavior configurable? i.e., opt-out via config?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm. I'm inclined to say "no", or at least "not unless someone asks for it". Happy Eyeballs itself is already configurable and I can't really imagine why this would be something we'd want to disable if Happy Eyeballs were in use. That being said, if someone ask for it then we could definitely make it configurable. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair. sg!