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

net: improve GetIPAddresses() #6

Merged
merged 4 commits into from
Feb 2, 2023
Merged

net: improve GetIPAddresses() #6

merged 4 commits into from
Feb 2, 2023

Conversation

amery
Copy link
Contributor

@amery amery commented Feb 2, 2023

revert usage of netip.ParseAddr() because it doesn't handle cidr properly
and simplify the case where no interfaces are specified

… of type cast"

due to netip.ParseAddr() not handling net.IPNet cases correctly

This reverts commit 955aa80.
@amery amery requested a review from karasz February 2, 2023 17:25
@karasz
Copy link
Collaborator

karasz commented Feb 2, 2023

Unmap() can be applied to all Addrs, in the case of an IPv4 it is a no-op, I guess cheaper than an if . Internally Unmap() checks for Is4In6

@amery
Copy link
Contributor Author

amery commented Feb 2, 2023

as discussed the PR was amended and now it reverts the change to use netip.ParseAddr(), that way we can forget about zones and networks. and it automatically unmaps 4in6 addresses into normal ipv4 ones.

Copy link
Collaborator

@karasz karasz left a comment

Choose a reason for hiding this comment

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

LGTM

@amery amery merged commit 9df1368 into main Feb 2, 2023
@amery amery deleted the pr-amery-net branch February 2, 2023 21:29
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.

None yet

2 participants