Skip to content

Implement IPAddress.to_canonical()#287

Merged
jstasiak merged 1 commit intomasterfrom
to_canonical
Dec 15, 2023
Merged

Implement IPAddress.to_canonical()#287
jstasiak merged 1 commit intomasterfrom
to_canonical

Conversation

@jstasiak
Copy link
Contributor

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)")

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)")
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (af40cfb) 85.47% compared to head (5c523f2) 85.53%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #287      +/-   ##
==========================================
+ Coverage   85.47%   85.53%   +0.05%     
==========================================
  Files          48       48              
  Lines        4579     4583       +4     
  Branches      805      806       +1     
==========================================
+ Hits         3914     3920       +6     
+ Misses        482      478       -4     
- Partials      183      185       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jstasiak jstasiak merged commit e03247e into master Dec 15, 2023
@jstasiak jstasiak deleted the to_canonical branch December 15, 2023 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants