go-ethereum/p2p/discover
Felix Lange 94a8b296e4
p2p/discover: refactor node and endpoint representation (#29844)
Here we clean up internal uses of type discover.node, converting most code to use
enode.Node instead. The discover.node type used to be the canonical representation of
network hosts before ENR was introduced. Most code worked with *node to avoid conversions
when interacting with Table methods. Since *node also contains internal state of Table and
is a mutable type, using *node outside of Table code is prone to data races. It's also
cleaner not having to wrap/unwrap *enode.Node all the time.

discover.node has been renamed to tableNode to clarify its purpose.

While here, we also change most uses of net.UDPAddr into netip.AddrPort. While this is
technically a separate refactoring from the *node -> *enode.Node change, it is more
convenient because *enode.Node handles IP addresses as netip.Addr. The switch to package
netip in discovery would've happened very soon anyway.

The change to netip.AddrPort stops at certain interface points. For example, since package
p2p/netutil has not been converted to use netip.Addr yet, we still have to convert to
net.IP/net.UDPAddr in a few places.
2024-05-29 15:02:26 +02:00
..
v4wire p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
v5wire p2p/discover/v5wire: add tests for invalid handshake and auth data size (#29708) 2024-05-06 13:17:19 +02:00
common.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
lookup.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
metrics.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
node.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
ntp.go all: remove dependency on golang.org/exp (#29314) 2024-03-25 07:50:18 +01:00
table.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
table_reval.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
table_reval_test.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
table_test.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
table_util_test.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
v4_lookup_test.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
v4_udp.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
v4_udp_test.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
v5_talk.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
v5_udp.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00
v5_udp_test.go p2p/discover: refactor node and endpoint representation (#29844) 2024-05-29 15:02:26 +02:00