Specifically, move them _here_ from the peerstore. That way
packages (like the DHT) that currently directly rely on the peerstore,
can just use go-libp2p-core.
Moved from f7f22569f7/peerstore.go (L79-L93)
With some small modifications.
* run go mod tidy
* omit receiver name if unused
* remove unused type testkey in tests
* fix duplicate import of go-multiaddr
* fix use of deprecated peer.IDB58{Encode,Decode}
* use bytes.Equal instead of bytes.Compare
* fix unnecessary assigments to blank identifier
* use time.Until instead of t.Sub(time.Now())
* fix use of deprecated go-multihash.ID
* add missing error check in envelope test
* fix error check in tests
* add a helper function to go directly from a string to an AddrInfo
* Update peer/addrinfo.go
Co-authored-by: Will <will.scott@protocol.ai>
Co-authored-by: Will <will.scott@protocol.ai>
* SplitAddr is a simpler way to split an address into a multiaddr and an ID.
* AddrInfosFromP2pAddrs converts a set of multiaddrs into a set of AddrInfos.