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

Explore replacing net.IP with inet.af/netaddr.IP #538

Open
jzelinskie opened this issue Jun 29, 2021 · 2 comments · May be fixed by #567
Open

Explore replacing net.IP with inet.af/netaddr.IP #538

jzelinskie opened this issue Jun 29, 2021 · 2 comments · May be fixed by #567

Comments

@jzelinskie
Copy link
Member

The inet.af/netaddr package is more performant and has methods for determining whether something is "v4/"v4in6"/"v6".
We should see if it's a net win to adopt it.

https://pkg.go.dev/inet.af/netaddr#IP.Is4

@mrd0ll4r
Copy link
Member

Interesting! Definitely worth looking at for all the frontend stuff that constantly checks v4/v6. Maybe also worth for storage, it supports marshalling to/from []byte, so we could just use it as a drop-in replacement for our current "append bytes of the IP". Nice nice...

Maybe it's a net win :D

@jzelinskie
Copy link
Member Author

Bumping this with my current thoughts.
I did this in #540, but netaddr is actually being added to the standard library, so I'll extract into a dedicated PR when Go 1.18 ships.

@jzelinskie jzelinskie linked a pull request Apr 16, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants