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

Include latest foundation release fixes in p2p #639

Conversation

ziogaschr
Copy link
Member

No description provided.

fjl added 2 commits June 7, 2024 11:30
…,p2p/discover,p2p/discover/v5wire,p2p/enode,p2p/netutil,p2p: p2p: use netip.Addr where possible (#29891)

enode.Node was recently changed to store a cache of endpoint information. The IP address in the cache is a netip.Addr. I chose that type over net.IP because it is just better. netip.Addr is meant to be used as a value type. Copying it does not allocate, it can be compared with ==, and can be used as a map key.

This PR changes most uses of Node.IP() into Node.IPAddr(), which returns the cached value directly without allocating.
While there are still some public APIs left where net.IP is used, I have converted all code used internally by p2p/discover to the new types. So this does change some public Go API, but hopefully not APIs any external code actually uses.

There weren't supposed to be any semantic differences resulting from this refactoring, however it does introduce one: In package p2p/netutil we treated the 0.0.0.0/8 network (addresses 0.x.y.z) as LAN, but netip.Addr.IsPrivate() doesn't. The treatment of this particular IP address range is controversial, with some software supporting it and others not. IANA lists it as special-purpose and invalid as a destination for a long time, so I don't know why I put it into the LAN list. It has now been marked as special in p2p/netutil as well.
Fixes an issue where discovery responses were not recognized.
@ziogaschr ziogaschr requested review from diega and meowsbits June 7, 2024 08:37
@diega diega merged commit 53646d1 into merge/foundation-release/1.13.14 Jun 7, 2024
6 checks passed
@diega diega deleted the merge/foundation-release/1.13.15-p2p-discover-unwrap-4in6 branch June 7, 2024 16:19
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.

4 participants