go-ethereum/cmd/devp2p/internal/ethtest
Felix Lange bc6569462d
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.
2024-06-05 19:31:04 +02:00
..
testdata cmd/devp2p: update eth/snap protocol test suites for PoS (#28340) 2023-12-20 17:23:48 +01:00
chain.go all: remove dependency on golang.org/exp (#29314) 2024-03-25 07:50:18 +01:00
chain_test.go cmd/devp2p: update eth/snap protocol test suites for PoS (#28340) 2023-12-20 17:23:48 +01:00
conn.go p2p: use netip.Addr where possible (#29891) 2024-06-05 19:31:04 +02:00
engine.go cmd: use package filepath over path for file system operations (#29227) 2024-03-12 10:00:34 +01:00
mkchain.sh cmd/devp2p: update eth/snap protocol test suites for PoS (#28340) 2023-12-20 17:23:48 +01:00
protocol.go cmd/devp2p: update eth/snap protocol test suites for PoS (#28340) 2023-12-20 17:23:48 +01:00
snap.go core/rawdb, trie: improve db APIs for accessing trie nodes (#29362) 2024-04-30 16:25:35 +02:00
suite.go crypto/kz4844: pass blobs by ref (#29050) 2024-03-13 07:51:46 +01:00
suite_test.go cmd: use package filepath over path for file system operations (#29227) 2024-03-12 10:00:34 +01:00
transaction.go all: replace fmt.Errorf() with errors.New() if no param required (#29472) 2024-04-08 12:59:17 +02:00