-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
Add convenience method for handling ipv4-mapped addresses by canonicalizing them #87708
Merged
Conversation
This file contains 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
…them This simplifies checking common properties in an address-family-agnostic way since since rust-lang#86335 commits to not checking IPv4 semantics of IPv4-mapped addresses in the `Ipv6Addr` property methods.
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
the
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
label
Aug 2, 2021
the8472
added
the
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
label
Aug 2, 2021
the8472
changed the title
Add convenience for handling ipv4-mapped addresses by canonicalizing them
Add convenience method for handling ipv4-mapped addresses by canonicalizing them
Aug 2, 2021
dtolnay
approved these changes
Aug 2, 2021
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.
Nice!
@bors r+ |
📌 Commit a5cdff3 has been approved by |
bors
added
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
Aug 2, 2021
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Aug 3, 2021
Add convenience method for handling ipv4-mapped addresses by canonicalizing them This simplifies checking common properties in an address-family-agnostic way since rust-lang#86335 commits to not checking IPv4 semantics of IPv4-mapped addresses in the `Ipv6Addr` property methods.
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this pull request
Aug 3, 2021
Add convenience method for handling ipv4-mapped addresses by canonicalizing them This simplifies checking common properties in an address-family-agnostic way since rust-lang#86335 commits to not checking IPv4 semantics of IPv4-mapped addresses in the `Ipv6Addr` property methods.
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Aug 3, 2021
Rollup of 8 pull requests Successful merges: - rust-lang#87645 (Properly find owner of closure in THIR unsafeck) - rust-lang#87646 (Fix a parser ICE on invalid `fn` body) - rust-lang#87652 (Validate that naked functions are never inlined) - rust-lang#87685 (Write docs for SyncOnceCell From and Default impl) - rust-lang#87693 (Add `aarch64-apple-ios-sim` as a possible target to the manifest) - rust-lang#87708 (Add convenience method for handling ipv4-mapped addresses by canonicalizing them) - rust-lang#87711 (Correct typo) - rust-lang#87716 (Allow generic SIMD array element type) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Oct 15, 2023
Stabilize `{IpAddr, Ipv6Addr}::to_canonical` Make `IpAddr::to_canonical` and `IpV6Addr::to_canonical` stable (+const), as well as const stabilize `Ipv6Addr::to_ipv4_mapped`. Newly stable API: ```rust impl IpAddr { // Newly stable under `ip_to_canonical` const fn to_canonical(&self) -> IpAddr; } impl Ipv6Addr { // Newly stable under `ip_to_canonical` const fn to_canonical(&self) -> IpAddr; // Already stable, this makes it const stable under // `const_ipv6_to_ipv4_mapped` const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> } ``` These stabilize a subset of the following tracking issues: - rust-lang#27709 - rust-lang#76205 Stabilization of all methods under the `ip` gate was attempted once at rust-lang#66584 then again at rust-lang#76098. These were not successful because there are still unknowns about `is_documentation` `is_benchmarking` and similar; `to_canonical` is much more straightforward. I have looked and could not find any known issues with `to_canonical`. These were added in 2021 in rust-lang#87708 cc implementor `@the8472` r? libs-api `@rustbot` label +T-libs-api +needs-fcp
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this pull request
Oct 16, 2023
Stabilize `{IpAddr, Ipv6Addr}::to_canonical` Make `IpAddr::to_canonical` and `IpV6Addr::to_canonical` stable (+const), as well as const stabilize `Ipv6Addr::to_ipv4_mapped`. Newly stable API: ```rust impl IpAddr { // Newly stable under `ip_to_canonical` const fn to_canonical(&self) -> IpAddr; } impl Ipv6Addr { // Newly stable under `ip_to_canonical` const fn to_canonical(&self) -> IpAddr; // Already stable, this makes it const stable under // `const_ipv6_to_ipv4_mapped` const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> } ``` These stabilize a subset of the following tracking issues: - rust-lang#27709 - rust-lang#76205 Stabilization of all methods under the `ip` gate was attempted once at rust-lang#66584 then again at rust-lang#76098. These were not successful because there are still unknowns about `is_documentation` `is_benchmarking` and similar; `to_canonical` is much more straightforward. I have looked and could not find any known issues with `to_canonical`. These were added in 2021 in rust-lang#87708 cc implementor ``@the8472`` r? libs-api ``@rustbot`` label +T-libs-api +needs-fcp
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 16, 2023
Rollup merge of rust-lang#115955 - tgross35:ip-to-canonical, r=dtolnay Stabilize `{IpAddr, Ipv6Addr}::to_canonical` Make `IpAddr::to_canonical` and `IpV6Addr::to_canonical` stable (+const), as well as const stabilize `Ipv6Addr::to_ipv4_mapped`. Newly stable API: ```rust impl IpAddr { // Newly stable under `ip_to_canonical` const fn to_canonical(&self) -> IpAddr; } impl Ipv6Addr { // Newly stable under `ip_to_canonical` const fn to_canonical(&self) -> IpAddr; // Already stable, this makes it const stable under // `const_ipv6_to_ipv4_mapped` const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr> } ``` These stabilize a subset of the following tracking issues: - rust-lang#27709 - rust-lang#76205 Stabilization of all methods under the `ip` gate was attempted once at rust-lang#66584 then again at rust-lang#76098. These were not successful because there are still unknowns about `is_documentation` `is_benchmarking` and similar; `to_canonical` is much more straightforward. I have looked and could not find any known issues with `to_canonical`. These were added in 2021 in rust-lang#87708 cc implementor ``@the8472`` r? libs-api ``@rustbot`` label +T-libs-api +needs-fcp
jstasiak
added a commit
to netaddr/netaddr
that referenced
this pull request
Dec 15, 2023
This is one of the pieces missing to have a good IPv4-mapped IPv6 address handling story. Following Rust's IpAddr::to_canonical() design[1][2][3] which seems sensible to me (except that ours is simpler as we don't have separate types for IPv4 and IPv6 addresses – yet). Also, relying on doctests[4] to test this feature – no need to make things more difficult than they need to be. [1] https://doc.rust-lang.org/std/net/enum.IpAddr.html#method.to_canonical [2] https://doc.rust-lang.org/std/net/struct.Ipv6Addr.html#method.to_canonical [3] rust-lang/rust#87708 [4] 3290b50 ("Make pytest run doctests (#280)")
jstasiak
added a commit
to netaddr/netaddr
that referenced
this pull request
Dec 15, 2023
This is one of the pieces missing to have a good IPv4-mapped IPv6 address handling story. Following Rust's IpAddr::to_canonical() design[1][2][3] which seems sensible to me (except that ours is simpler as we don't have separate types for IPv4 and IPv6 addresses – yet). Also, relying on doctests[4] to test this feature – no need to make things more difficult than they need to be. [1] https://doc.rust-lang.org/std/net/enum.IpAddr.html#method.to_canonical [2] https://doc.rust-lang.org/std/net/struct.Ipv6Addr.html#method.to_canonical [3] rust-lang/rust#87708 [4] 3290b50 ("Make pytest run doctests (#280)")
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
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.
This simplifies checking common properties in an address-family-agnostic
way since #86335 commits to not checking IPv4 semantics
of IPv4-mapped addresses in the
Ipv6Addr
property methods.